Jump to content
xisto Community
round

Getting Two Flash Movies To Communicate communicating between two flash movies

Recommended Posts

I'm just wondering if anyone here has tried or gotten two flash movies to communicate. I'll explain. If say you had an html page which had two embeded flash movies, can you or have you gotten the two to communicate between each other. I realise that i could just create one really huge flash movie of the site and make it work that way but i want the flash header to do something everything another flash movie gets to a certain place. I have been able to control flash movie from text files, and throught links on pages but i've not been able to get different to control each other. Not sure how to start this one. Anyone have any ideas?round

Share this post


Link to post
Share on other sites

Hi, roundI would like to see your fla file on that.Flash makes a communications server you can get the developers version for free at the macromedia web site it will let you connect to another flash movie.If your trying to connect over the web you must run the communications server within an http server from what Ive red about it also smartfox makes a portable gamming server that will do the same.Ive tryed both, but I havnt yet tryed going public yet

Share this post


Link to post
Share on other sites

well, there is a not at all easy way to do what you want. In ActionScript 2.0 there is an object called LocalConnection that allows two SWF files to send instructions to each other, without external code snippets like javascript.

this litle example will show you how to communicate two differents swf files, even if they are openned in different windows.

// This is the reiciving swf://creation of the textfield to display what other swf tellsthis.createTextField("info_txt", 1, 10, 10, 100, 22);info_txt.border = true;//definning the object local connectionvar receiving_lc:LocalConnection = new LocalConnection();receiving_lc.showInfo = function(n1:Number, n2:Number) {     info_txt.text = n1+n2;};receiving_lc.connect("lc_name");The following SWF file sends the request to the first SWF file. // the sending SWF:var sending_lc:LocalConnection = new LocalConnection();sending_lc.send("lc_name", "showInfo", 5, 7);

ok, as you see, you make your two swf files, one that reicives information, and one that sends it. first, in the reiciving swf you define a LocalConnection object configured to recieve information and do something with it with the functions you define, note that you can add the amount of functions that you want. After you would define the chanel in which the swfs will communicate, you make it with -receiving_lc.connect("lc_name"); -line

Now you have the reiciving swf, but you need the swf who will tell the reiciving swf what to do, in the code are two single lines that make that, and it's not hard to understand, first you define a sending localConnection object, and then tell it that communicate with other swf in a common channel, in this case the same channel for the reiciving swf("lc_name"),and then invoke the method you want in the reiciving swf with its respective parameters to execute.

this is a basic usage of localconnection object, because it has more useful methods and features, like restrict which dns can acces to your swf and security options. May be you can find helpful the flash docummentation, just type LocalConnection, and press f1 key over it, and it will display the class deffinition with its methods descriptions.

i hope you find it useful!

Share this post


Link to post
Share on other sites

well i think u can set up a new swf and add some code to include the other two swf u want to be communicated and as now those two and the "loader" make one u can communicate easily without having problems...BUT u must be careful in calling this, _root and _parent because now the _root belongs to the "loader"load the other two in the loader like:_root.loadMovie("thenameofthefirstmovie");_root.loadMovie("thenameofthesecondmovie");

Share this post


Link to post
Share on other sites

thanks for the reply. I'm looking into the LocalConnection commands, seems to be what i'm looking for. The reply just above wasn't what i was looking for. I can do that but it involves creating one really huge swf file and putting that on the page. i was just trying to see if i could get two different flash files like banners to communicate with each other. It might make a page much more interactive.round

Share this post


Link to post
Share on other sites

Hey , round did you get the two to talk yet? Looks like you ,and sanbeand are the only ones that Ive found in trap working with flash. I would be intrested seeing what you come up with.Also I'm looking to make new contacts with people that are using the flash IDE . I've been working on building a chat ap.

Share this post


Link to post
Share on other sites

I haven't posted any files yet, got side tracked on another project and flash movie.Will pm you the second i have something worthwhile to show. Willing to share any fla files with people.round

Share this post


Link to post
Share on other sites

i want to run two swf file in another swf file as a banner how i will do it

Getting Two Flash Movies To Communicate

 

I am making a banner in that I need to run another swf file as a product list on right side how I will do it. I am just new in action script

If any one know it pls mail me that will be helpful for me.

 

-reply by Anulasingh

Share this post


Link to post
Share on other sites

how to communicate 2 different flash movie??

Getting Two Flash Movies To Communicate

 

Ok.. I'll make it simple.. I'm new at this whole flash thing.. and I've got a few question to ask..

 

How can I called a .Swf movie from another .Swf movie??

Right now I'm using adobe flash cs3..

 

 

-question by siti

Share this post


Link to post
Share on other sites
Link to a certain frame in a flash movieGetting Two Flash Movies To Communicate

Hi,I have a similar problem...I have a page consisting oftwo flash movies, one with a scroll function and one picture gallery.Now I would like the gallery movie to start at different framesdepending of which thumb in the scroll I click... But I'm stuck! I canjust get it to start at frame 1 all the time... Anyone who knows whatto do?The script looks like this:ItemList.Thumb3._alpha = 65;ItemList.Thumb3.OnRollOver = function() {Tweener.AddTween(this, {_alpha:100, time:0.6});};ItemList.Thumb3.OnRollOut = function() {Tweener.AddTween(this, {_alpha:65, time:0.6});};ItemList.Thumb3.OnRelease = function (){_parent.LoadGallery.LoadMovie("gallery1.Swf");}I would like to put in something like gotoAndStop(3)in the last line...-reply by Lupo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.