Use flash control in Delphi

zhaozj2021-02-11  159

Flash is made of Macromedia, with dynamic, interactive Shockwave on the Internet. its

The advantage is that the size is small, and can be played on the side, so that the user is waiting for a long time.

Flash can use it to generate an animation, and you can add sounds in the web page. This way you can generate multimedia graphics and interfaces, but make the volume of the files very small.

Although Flash cannot be programmed like a language, but use its built-in statement and combined

JavaSCripe, you can also make a very interactive home page.

Another feature of Flash is to install plug-in can be accepted by the browser! Of course this also

Avoid the difference between the browser, so as one of the colleagues!

But do you know? In Delphi, you can open the Flash animation directly and control it to play and stop. you still

Can you get its total number of frames, know how to implement it? please follow me.

Component in Delphi, IMPORT ACTIVEX Contrals ... ShockWave

Flash (Version 1.0) "and click Install, an install window will appear.

If you want to add it to an already existing package, in the "INTO EXIXISTING PACKAGE" dialog

"File Name:" Select the path you want to install and click "OK"; will pop up a confirmation dialog, it

Ask you "package dclusr50.bpl will be rebuilt. Continue?", Click "Yes"; window in the pop-up

In the mouth, click "Install", the plugin is installed.

If you want to add it to a new package, "File" in the INTO NEW PACKAGE dialog

Name: "Select the path you want to install and create a package, if named TEST, and click" OK "; it

Ask you "Package Test.bpl Will BUILT. Continue?", Click Yes. Single in the pop-up window

Knock "install", the plugin is installed.

At this time, you will find a new control under the ActiveX of the control strip, named Shokewaveflash, single

Hit it put it in the Form, put an OpenDialog control and a panel in the form, put on the panel

Four Button, their CAPTION attribute is named "OpenFile", "Play", "STOP", "Close". Set

Panel1, Shockwaveflash's Align property is Alleft and Alclient, respectively; in these four

The following code is written in the Button's onclick event:

Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT);

Begin

IF openDialog1.execute the

Shockwaveflash1.movie:=

OpenDialog1.filename;

END;

Procedure TFORM1.BUTTON2CLICK (Sender: TOBJECT);

Begin

Shockwaveflash1.play;

END;

Procedure TFORM1.BUTTON3CLICK (Sender: TOBJECT);

Begin

Shockwaveflash1.stopplay;

END;

Procedure TFORM1.BUTTON4CLICK (Sender: TOBJECT); Begin

Shockwaveflash1.freeonRelease;

CLOSE;

END;

You can get the number of frames of the open flash image, add a Label on Panel1, in Form1

The following code is written in the onclick event.

Procedure TFORM1.FormCreate (Sender: TOBJECT);

Begin

Label1.caption: = shockwaveflash.totalframes;

END;

You can also control the open flash image start playing from that frame,

Add a Button and an Edit control on Panel1,

Add the following code in the Button's OnClick event.

If shockwaveflash1.playing then

Shockwaveflash1.gotoframe (Spinedit1.Value);

Shockwaveflash1.play;

Email the frame you want to jump in Edit, and click this button, you can implement this feature.

How about, try it, the effect is not bad.

转载请注明原文地址:https://www.9cbs.com/read-5425.html

New Post(0)