Tian Yi love
Cause: when I see a flash online player on the Shanghai dictation website that is more practical, I plan to take advantage of it. In the meantime, I encountered some problems and used one day to completely solve them, turning my dream into reality.
The simplified code for the Shanghai dictation website is as follows:
Html. JPG: 2Kx is required for downloading this attachment, which is automatically deducted from the download process.
Specific process:
First, discover the problem. It is found through programming that if the swf file is used directly, even if the path of the mp3 file is changed, the original audio is still played.
The second is analysis and solution.
Step 1: Decompress voa_player.swf using swfdecompiler4.5.exeto obtain voa_player.fla (flash source file) and voa_player_new.as (Action Script.
Reverse_swf.JPG: 2Kx is required for downloading this attachment, which is automatically deducted from the download process.
Step 2: Use Flash CS3 Pro to open voa_player.fla, patch the script to enhance its functions, and compile and generate a new swf file.
Modify_1.JPG: 2Kx is required for downloading this attachment, which is automatically deducted from downloading.
Modify_2.JPG: 2Kx is required for downloading this attachment, which is automatically deducted from downloading.
Step 3: Use delphi to compile the application software and load the newly generated swf in the flash control.
The program interface is as follows:
Demonstration. JPG downloads this attachment will consume 2Kx and will be automatically deducted during the download.
Key code: Flash1.SetVariable (_ file, D: xxx123.mp3 );
The modified voa_player.swf file can be used to play MP3 files as needed.
The specific dephi implementation code is as follows:
Unit Unit1;
Interface
Uses
Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls, OleCtrls, ShockwaveFlashObjects_TLB;
Type
TForm1 = class (TForm)
Flash1: TShockwaveFlash;
Button1: TButton;
Button2: TButton;
Procedure FormCreate (Sender: TObject );
Procedure Button1Click (Sender: TObject );
Procedure Button2Click (Sender: TObject );
Private
{Private declarations}
Public
End;
Var
Form1: TForm1;
Path: string;
Implementation
{$ R *. dfm}
Procedure TForm1.FormCreate (Sender: TObject );
Begin
Path: = ExtractFilePath (ParamStr (0 ));
Flash1.Movie: Using path‑player.swf;
End;
Procedure TForm1.Button1Click (Sender: TObject );
Var
TargetWnd: Thandle;
R: TRect;
Point: TPoint;
Begin
Flash1.setvariable(_file,path00001.mp3 );
TargetWnd: = FindWindow (TForm1, Tian Yi love );
If targetWnd <> 0 then
Begin
GetWindowRect (targetWnd, r );
Getcursorpos (point );
Setcursorpos (r. Left + 96, r. Top + 80 );
Mouse_event (MOUSEEVENTF_LEFTDOWN,); // double-click stop_btn
Mouse_event (MOUSEEVENTF_LEFTUP, 0, 0, 0 );
Mouse_event (MOUSEEVENTF_LEFTDOWN, 0, 0, 0 );
Mouse_event (MOUSEEVENTF_LEFTUP, 0, 0, 0 );
Setcursorpos (point. x, point. y );
End;
End;
Procedure TForm1.Button2Click (Sender: TObject );
Var
TargetWnd: Thandle;
R: TRect;
Point: TPoint;
Begin
Flash1.setvariable(_file,path1_2.mp3 );
TargetWnd: = FindWindow (TForm1, Tian Yi love );
If targetWnd <> 0 then
Begin
GetWindowRect (targetWnd, r );
Getcursorpos (point );
Setcursorpos (r. Left + 96, r. Top + 80 );
Mouse_event (MOUSEEVENTF_LEFTDOWN, 0, 0, 0 );
Mouse_event (MOUSEEVENTF_LEFTUP, 0, 0, 0 );
Mouse_event (MOUSEEVENTF_LEFTDOWN, 0, 0, 0 );
Mouse_event (MOUSEEVENTF_LEFTUP, 0, 0, 0 );
Setcursorpos (point. x, point. y );
End;
End;
End.