Communication between delphi and Flash + Implementation of drag-and-drop events of flxa

Source: Internet
Author: User

Delphi itself is difficult to implement some Very dazzling or flexible animation changes, Flash is to achieve these are more common functions, is there a way to combine Delphi and flash?

The answer is yes. How can I use it?

(1) install swflash. ocx in Delphi and run flash in other environments.
Find it in $ WINDOWS \ SYSTEM \ macromed \ flash in Win98 or in $ winnt \ system32 \ macromed \ flash in Win2000.

After running Delphi, select component → import ActiveX Control and find the swflash. ocx file for installation. After the installation is complete, the tshockwaveflash control appears in the ActiveX panel.

The encapsulation of swflash. ocx enables you to use the Delphi language to control flash in the Delphi environment.

(2) how to make Delphi interact with Flash

You need to solve two problems: running the hosts file.

Question 1: Delphi receives flash messages

Flash sends messages to delphi. You only need to use the fscommand in flash. This command exists in various flash versions that the author can see,
For example, in qqp_528flash.swf ):
// Code in flash
On (click ){
Fscommand ("Test", "flash sends messages to the delphi Program ");
}
The following is the receiving code used in delphi:
Procedure TFrmMain. Flash1FSCommand (Sender: TObject; const command,
Args: WideString );
Begin
If command = 'test' then
Showmessage (ARGs );
End;
The tshockwaveflash control contains an event that specifically receives commands ".

Question 2: Delphi sends commands to flash

For Delphi, The Execution Code is as follows:
Flash1.setvariable ('test', 'this is what Delphi transfers to flash ');
The component named "test" must exist in the executed flash. It must be a text component (required) followed by the transmitted content. After the command is executed, the input "this is uploaded by Delphi to flash" will be displayed in the text component named test in flash.

Segment Content.

(3) If you want to implement drag and drop events for flash in Delphi, there is a way not to send commands to flash.

  TShockwaveFlash = class(ShockwaveFlashObjects_TLB.TShockwaveFlash)  protected    { TWinControl }    procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;  end;  procedure TShockwaveFlash.WMNCHitTest(var Message: TWMNCHitTest);  begin    Message.Result := HTTRANSPARENT;  end;

This function means to tell the mouse that it is null. In this case, you only need to implement the relevant method of the flash control.

Delphi controls flash in many aspects, such as playing, stopping, and starting from which frame. For details, see the tshockwaveflash control.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.