« Tutorial : Using the XPath API in Flash | Main | Usable Flash Menus »

Tutorial : Understanding ExternalInterface in Flash 8

Listen to this article Listen to this article :: Talkr

I have posted a tutorial on "Understanding ExternalInterface in Flash 8" in the tutorial section of this site. Have a look at it here.

|

TrackBack

TrackBack URL for this entry:
http://www.lastashero.com/blog/mt-tb.cgi/19

Comments

Thanks for this tutorial.
I wonder if I could use the same procedure if my flash movie was not embedded within the html file containing the javascript. I mean how can I use the Externallinterface class to communicate between the html file and a separate flash movie?
Many thanks Shirley

Well, if you want to communicate between two SWF's on a HTML and another SWF running in the player then you can use the LocalConnection Object. This helps to communicate between teo SWF's running on the same machine but in different containers to communicate between each other. You can read more about LocalConnection Object here : http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary437.html

Cheers,
KP

thanks for the suggestion.
I have used the LocalConnection Object in the past and this is fine if I wanted communicate between two flas movies.
But now I am intending to communicate between an html file (which doesnt contain flash movies) and an external flash movie!
At the present I can achieve this only by a very complicate "getting around" solution.
Shirley

Hi Shirley ! This is something new which I am hearing of - is the external flash movie a standalone exe file or a SWF? And is the HTML page a local one or on a server. If you could share more information on this and how you solved this it would be useful for others who are facing a similar problem.

Cheers,
KP

Let me try explain:

Mainly I have different flash movies communicating each other by sending to and loading variables from one asp.net file

I started by creating an asp.net file that requests, stores and sends back variables to flash movies. I saved this file as “request_variables.aspx”

Then I create a two frames flash Movie (this is the main movie the one requesting variables form the aspx.file). By using the properties panel I name the first frame: “English” and the second frame “French” .

I put some actionscript code in the first frame of my movie: onEnterFrame (by using the LoadVars.load method) the movie will retrieve variables from the “request_variables.aspx” file. Then it plays an action that sends the flash movie to one or the other frame accordingly to the value of the variable it retrieves.
I save my movie as "multilingual.swf".

Next I create two new flash movies (those are the movies receiving variables from an external html and sending the said variables to the aspx.file). And I call them "English.swf" and "French.Swf" They contain nothing else but few lines of code: i.e. a function that (onEnterFame) sends variables (whose value will be equal to “English” and “French” respectively) to the “request_variables.aspx” file. In this case the variables are sent by using the LoadVars.sendAndLoad method
Very important (crucial) on the last part of the code an onLoad event fires : getURL (“multilingual.swf”).

Finally on my "home.html" page I place two text links: "English" and "French", the first pointing to "English.swf", the second to "French.swf".
So when I click the "English" text link the "English.swf" will send a variable to the aspx.file and then will open (by invoking getURL) the "multilingual.swf" in the desired frame.
It works fine. But this seems to me a very long get around in order to achieve communication between the "home.html" page and the "multilingual.swf

thank you very much for your help. You guys rock, thanks again.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Recent Visitors

Feeds


Link to Podcast (RSS feed) for this blog

Aggregated By :