Forest_wawa (Bad Guy 007)
Http://search.csdn.net/expert/topic/50/5003/2003/2/16/1432958.htm
Description: I used the shockwaveflash control in the program. The functions I need to implement are:
1) press the left mouse button on a button of the flahs animation and execute the left-click message response function onfscommand () of flash ();
2) Right-click the button and execute onfscommand (). A popup menu needs to be displayed.
Reply to: masterz ()
Bool cuseflashdlg: pretranslatemessage (MSG * PMSG)
{
// Change right button message to left button message by masterz
Point pt;
PT. x = loword (PMSG-> lparam );
PT. Y = hiword (PMSG-> lparam );
Cstring MSG;
Crect RC;
M_flash.getwindowrect (& rc );
Screentoclient (& rc );
MSG. format ("mouse (% d, % d), flash (% d, % d)", PT. x, PT. y, RC. left, RC. top, RC. right, RC. bottom );
If (PMSG-> message = wm_rbuttondown | PMSG-> message = wm_rbuttonup | PMSG-> message = wm_rbuttondblclk)
Outputdebugstring (MSG );
If (RC. ptinrect (PT) |: getfocus () = m_flash.m_hwnd | PMSG-> hwnd = m_flash.m_hwnd)
// If (: getfocus () = m_flash.m_hwnd)
{
If (PMSG-> message = wm_rbuttondown)
PMSG-> message = wm_lbuttondown;
If (wm_rbuttonup = PMSG-> message)
PMSG-> message = wm_lbuttonup;
If (wm_rbuttondblclk = PMSG-> message)
PMSG-> message = wm_lbuttondblclk; If (PMSG-> message = wm_rbuttondown | PMSG-> message = wm_rbuttonup | PMSG-> message = wm_rbuttondblclk)
Outputdebugstring ("point in rect ");
}
Return cdialog: pretranslatemessage (PMSG );
}
Reply to: masterz ()
M_flash.loadmovie (0, "C: // downloads // icons.swf ");
M_flash.play ();
Moderator comments:
The message replacement function in MFC is generally implemented in the pretranslatemessage function.
[Conversion] Using callfunction in combination with VC, VB, C # And flash8 Development
How to Use callfunction of objects in flash8.ocx. Note that SWF files must be created in flash8.0 and flash controls in flash8.ocx.
VB description (pass multiple parameters)
VB end
Private sub commandementclick ()
Flash1.callfunction "<invoke name =" "show" "returntype =" "XML"> <arguments> <string> Hello </string> <string> world </string> </ arguments> </invoke> "'length relationship, same as above
End sub
Private sub form_load ()
Shockwaveflash1.loadmovie 0, app. Path & "/showstring.swf"
End sub
Flash end
① Add a text box text_txt to display the effect
② The ActionScript code is
Function show (str1: String, str2: string): void {
Test_txt.text = str1 + ":" + str2;
}
Flash. External. externalinterface. addcallback ("show", this, show );
C ++ or C # description (only one parameter is passed, used)
Main program end:
Flash1.loadmovie (0, application. startpath + "/showstring.swf ");
Flash1.callfunction ("<invoke name =/" test/"returntype =/" XML/"> <arguments> <string> helloworld </string> </arguments> </invoke>" );
Flash end:
① Add a text box text_txt to display the effect or use trace ("call:" + Result + "")
② The following is the ActionScript code. The result is only a parameter, but the parameter name does not need to be concerned when the main program uses the as function. Only the number of parameters or the parameter location are known.
Function Test (Result: Object): void {
Test_txt.text = result;
}
Flash. External. externalinterface. addcallback ("test", this, test );