PDA

View Full Version : sending variable from one swf to another


Todd
10-16-2002, 08:04 PM
hi to everybody,

first problem is solved and the next is just appeared.

I have two buttons (bt1, bt2) at the end of my first movie. if the user press on of them the movie "next.swf" will be loaded. in this movie (next.swf) I like to know which button (bt1 or bt2) was pressed by the user.

how can I send a variable from the first movieclip to the second (next.swf) and check this variable (if(){} else(){}) ?

pls help, greetinx from Brazil
Todd

jimburton
10-17-2002, 02:35 PM
do the buttons load the next movie with loadMovie or getURL? If they use loadMovie, load it into a holder type mc and you still have all variables on your timeline, eg:

on(release) {
clicked = this;
holder.loadMovie("next.swf");
}

then the value of *clicked* is available to the new movie.

if you use getURL you have a different problem cos by the time *next* is loaded, the old movie and all it's vars have disappeared, so load it as:

getURL("next.html?clicked="+this);

then use javascript or something serverside like php/asp/cf to get theat var from the querystring into the movie

flashdev
10-18-2002, 09:54 AM
you can send variables directlyto a loaded swf ,the syntax is :
loadMovieNum("myFile.swf?variable1=value1&variable2=value2",0,"");
You can see there is a "?" and the variable after separetaed with "&".
also you can achieve this using javascript with flash if you load ur swf from html page ,for details about this,macromedia forums,
Thread title :
send variable from swf to new loaded one