PDA

View Full Version : FMX: controling another movie



Uli
February 21st, 2003, 11:16 AM
Hello All,
Could someone point to me some tutorial on how to control another swf in a html page?

I'm having a 2 flash movies in my web page (let's say index.html , movie01.swf and movie02.swf). Is there a way, when something happens on movie01 (like a click) that movie02 does something as well like plays a MC? My HTML page has 3 frames, 1 top, 1 left, 1 main. Movie01 on top and Movie02 just a small area in left frame.

TiA :-)

h88
February 21st, 2003, 12:18 PM
Yeah that's pretty easy using LocalConnection.

on The first frame of Movieone.swf (The sender movie in this case), insert this action:

myButton.onRelease = function() {
myLocalConnection = new LocalConnection();
myLocalConnection.send("IncomingMessage", "onRecieve", myTextBox.text);
myLocalConnection.close();
};

Ok, here goes, when myButton is pressed, a local connection object will be created, then it will send an incoming message to the function onRecieve with the parameter myTextBox.text (The text you will be inputing in that field) to the reciever movie.

on The first frame of Movietwo.swf (The reciever movie in this case), insert this action:

myLocalConnection = new LocalConnection();
myLocalConnection.onRecieve = function(parameter){
myTextField.text = parameter
//Anything else, mc.play() etc
}
myLocalConnection.connect("IncomingMessage");

When the incomingMessage is recieved, the parameter will be assigned to myTextField...Looks confusing, check the attached example then. open both movies together, submit a message, and you'll get what you submited in the other movie. :)

Guig0
February 21st, 2003, 12:28 PM
nice example =)


Thanks for sharing this with us ;)

Uli
February 21st, 2003, 12:29 PM
Thanks a bunch!
Will check/tweak it out, thanks for the attached files, very helpful!8]

Uli
February 21st, 2003, 01:49 PM
mm ok well i'm not that advanced it seems :/ hehe you kinda went too soon too fast for me :hangover:

I don't really understand how i can call a MC and tell it to go to a frame and stop with that function ... can you help me out?

TiA
:trout:

h88
February 21st, 2003, 02:19 PM
> I don't really understand how i can call a MC and tell it to go to a frame and stop with that function ... can you help me out?

Yeah your sending strings, however, I have seen a function called doCommand that let you execute strings:

If the parameter from sender movie is "myMC.play()", then use doCommand:

myLocalConnection = new LocalConnection();
myLocalConnection.onRecieve = function(parameter){
doCommand(parameter)
}
myLocalConnection.connect("IncomingMessage");

I'll try to get the link and post an example as well.. :)

h88
February 21st, 2003, 02:47 PM
There:

Example:

MC1.play();

will play the movie! :)

Uli
February 21st, 2003, 03:53 PM
thanks a million!!
Now it's getting clearer. Much appreciated!!<:}

h88
February 21st, 2003, 03:54 PM
Glad it worked.