PDA

View Full Version : variable controlled navigation between swfs


nick_kind
02-27-2003, 11:58 AM
Hi there,

If I have a variable called 'buttonpress'

if (buttonpress == "back") {
_root.control.loadMovie("Main Menu.swf", 10);
}

Is there a way I can do the above, but putting in the 'buttonpress' variable where the 'Main Menu.swf' is.

Therefore I can go back to the movies (swf) that I came from - a bit like back buttons on the browser.

Thanks very much

Nick

Angrytuna
02-27-2003, 06:28 PM
Are you trying to pass information between two separate flash movies? If so, flash MX offers a new feature called LoadConnection (http://www.macromedia.com/support/flash/ts/documents/localconnection.htm) that may help.

nick_kind
02-27-2003, 07:49 PM
Thanks for your reply,

But no, it's not necesary about transfering variables from one swf to another ( I have to say I've got a nice way of doing that, but we can talk about that another time !!)

It's just simply to handle the name of a movie within a variable so that if I want to go back to say 'main menu.swf' I can code it to go

loadmovie('variable'.swf,0);

and that variable is set from the movie where it came from,

setvariable variable = 'main menu';

do you get what I mean ??

instead of

loadmovie('main menu.swf',0);

It will be much more dynamic.

Cheers

Nick

CyanBlue
02-28-2003, 11:15 AM
Howdy...

I'm just throwing an idea here... :)

Why don't you create an array that contains loaded SWF file names and get the value of the array when you need to go back or forth???

For example...

Your user has viewed 'movie1.swf', 'movie3.swf', 'movie4.swf' then the array contains that information... and if the user viewed 'movie1.swf' again, the fourth element of the array becomes that... (Maybe this is how you have set it up already...)
All you need is to update the array content as back or forward button is pressed... and keep the current location within that array...

So, the possible code might look like this...if (buttonpress == "back")
{
if (currentPosition > 1)
currentPosition--;
else
currentPosition = 0;
_root.control.loadMovie(loadedSWFArray[currentPosition]);
}Know what I mean???

Back to your question with variable...loadMovie('variable'.swf,0);I don't know what that variable contains, but I'll just assume that contains the name only... (variable is not really the name of the variable, right???)loadMovieNum(theSWFName + ".swf", 0);that should do what you want to do... (loadMovie() function doesn't take level number... You gotta use loadMovieNum() function to use level number... So, you gotta make up your mind whether you want to use loadMovie() or loadMovieNum()...)

Please don't crosspost just because you don't get an answer... People don't like crossposts... Alrighty??? :)

nick_kind
02-28-2003, 01:35 PM
Hi there,

thanks for you help, and sorry for the crosspoint, to be honest I really didn't know that if I posted in a different forum it would be bad.

Cheers for letting me know dude,

Nick

CyanBlue
02-28-2003, 02:35 PM
No problem... Just don't do that again... :)

Did that solve your problem though???

Oh... Don't call me dude... If you do that again, I'll have to !@#$ you... :D

nick_kind
02-28-2003, 05:18 PM
You're quite an angry chap aren't you !

I know us brits tend to be a bit more diplomatic and calmer about things, but there's really no need.

You're a Flash designer, you should fiind great content and satisfaction in what you do. So please don't try to find it in cheeky threatening language!

But, thank you very much, you certainly have helped my current problem solving situation.

:) :( :o :D ;) :p :cool: :rolleyes: :eek: :confused:

Cheers

Nick

CyanBlue
02-28-2003, 05:24 PM
:confused: :mad: :( :( ;) :D :cool:

I was just kidding... Are you mad at me??? I hope you are not... :D

nick_kind
03-01-2003, 08:11 AM
No worries mate,

Take it easy

Nick