PDA

View Full Version : 2 swf's Communicate?


moheb
07-07-2002, 09:45 PM
hi,
I have 2 swf's
1.swf and 2.swf
1 is very long, 2 is very short
so that creates an L shape ... but since im already trying to use some HTML on the compliment of the L shape so i cant make them both into 1 block or 1 swf ... i have 2 make them 2 ...

I just want 2 have a button in 1.swf to simply LOAD 2.swf NEXT to 1.swf (& not over it) .... thats all
it sounds so simple but i just cant figure out a thing

I heard that Flash MX can make 2 swf's communicate but i never found that in the help .... also if the only way is JS can someone make up a mock file 2 show me the exact coding needed to acheive this interaction?
Thanks

JHallam
07-07-2002, 10:08 PM
If you look in the actionscript dictionary there is a command which is usefull in this process.

basically, on a button use;

on(release) {
loadMovie("swf2.swf", _root)
}


If you want it in a certain place on the movie, then you need to load it into a empty MC.

so create a MC (movieClip) don't put anything in it and then put it on the _root and place it where you want the swf to show.
Instance the MC to whatever you like.

then use on a button;

on(release) {
_root.mcINSTANCE.loadMovie("swf2.swf")
}


Simple

Billy T
07-07-2002, 11:55 PM
cant you just load them into separate html frames?

yes mx has some new stuff for separate swfs to talk to each other - have a read of this - http://www.actionscripts.org/tutorials/intermediate/LocalConnections/index.shtml

cheers

korayem
07-08-2002, 02:23 AM
perfect!!!......

moheb
07-08-2002, 07:34 AM
hi
thanx alot for your help :)
now i was wondering if I could use this technique to make 1 movie actually load the other movie THEN goto a flagged frame (or frame number) in it ... is that possible?

Billy T
07-08-2002, 07:39 AM
should be possible - did you try it?

moheb
07-08-2002, 07:41 AM
Well, I'm trying to but I'm pretty much terrible with actionscripting ... could u take a look at it please?

Billy T
07-08-2002, 12:54 PM
I have to go to bed

if I get time to play with it tomorrow I will

I just did a quick test and you dont seem to be able to communicate with a movie that is not already loaded (which is understandable) but there is probably some sort of work-around

cheers

moheb
07-08-2002, 01:02 PM
ok i dont need to interact with an unloaded movie
i'll load a movie with a blank first frame
thats all i need

if u've been able to do that with two loaded movies can u please attach them as a zip file and post them here?

Billy T
07-08-2002, 11:37 PM
ok here's a bit of a dodgy hack up of Jesse's code

cheers

Billy T
07-08-2002, 11:57 PM
here's another one that loads a new movie and then sends it to a certain frame

moheb
07-09-2002, 03:45 PM
Billy T
ur gr8 man
this is perfect
its exactly what i wanted

thank u soooooooooooooooooooooo much

there's something else i want to do but i'm not sure if it's possible
i want to have a listbox with some entries and when u click on 1 of them it does that exact same command (it loads a movie next to it and goes to a certain frame inside it ..) can that b done with listboxes or not?

I'll understand if ur too busy to do all this u've already helped me with a gr8 deal already ... Thank you :)

Billy T
07-09-2002, 11:08 PM
sorry but really don't know much about mx and components yet..


cheers

binkyboo
07-11-2002, 09:19 PM
Billy T,

Is it possible to load the right.html into the leftFrame (replacing the left.html) and still send the right.html to frame 10? I think I just confused myself:) I've been playing around with this with no success. Thanks in advance!

Billy T
07-11-2002, 09:41 PM
I "think" you might have to do something like this - http://www.actionscripts.org/tutorials/intermediate/passing_variables_around/index.shtml

cheers

binkyboo
07-11-2002, 09:48 PM
I was hoping I wouldn't have to utilize any sort of middleware.
I may not have explained myself clearly.

Right now it's designed so that when you click the button on the left frame it loads right.swf into the rightFrame and sends it to frame ten. Is it possible to replace the left.swf in the leftFrame with the right.swf and still send it to frame ten?

If you did understand me the first time and I'm being redundant I apologize:(

Thanks much!!

Billy T
07-11-2002, 09:54 PM
yeah I did understand you...

I don't know how else you could do it

cheers