Not long ago, I wrote a essay about the Interactive Development of flash and Microsoft products, which received a lot of attention from webpages, but few people participated in the discussion.ArticleAddress: Please discuss the programming of the combination of flash. ocx (8.0) and. net. ) At that time, I left a problem: how to use callfunction of the object in flash8.ocx, now I am here to simply compensate for the use of callfunction, Note that the SWF file must be created in flash8.0 and flash control 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>" 'The length of the article is in line with the 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
② 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)
MasterProgramTerminal:
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 );
From the above, we can see that flash has supported calling The ActionScript Script Function to an external program in multiple versions of flash8.0, and passed parameters using XML, this brings great convenience and Development inspiration to many programmers.
As an example, leave a question for your consideration,That is, if you want to pass a dataset, such as a SQL query table, how can the flash end write, and how the VB or VC ++ end write (XML ), do not use a record to upload a recordIf you are interested, you can reply.