PDA

View Full Version : help with links



jazzman121
May 29th, 2003, 04:19 PM
this is what i wanna do... when i make website.. I use variable names for each page i load... soo there is one frame.. that checks what the page_status variable value is.. and if that value is "page1" it loads page1.swf... if its "page2" it loads page2.swf...
and so on...
what i wanna do is... make my website soo that... i can give direct links too specific pages.... for eg... if i want i can give a direct link in html ... so that.. when clicked it loads the main_page.swf... with the loaded swf... depending on the link i gave... for eg... i can give a link...

www.mywebsite.com/main.swf?page_status=page2

soo that should direcly load page2.swf into my main_page.swf...

how can i do this??? please help

aurelius
May 29th, 2003, 06:55 PM
Hi there,

The only time Flash can read URL variables is if they are embedded in the html document which first instantiates the .swf:



<embed src="myMovie.swf?myURLVar=hello%20World">
etc...

If you did that, then "myURLVar" would be available to the entire .swf.

This is the "FlashVars" approach (http://www.macromedia.com/support/flash/ts/documents/flashvars.htm). This sounds to me like what you're after.

Your html would have "main.swf?page_status=2". Then your main.swf would have this code:


switch (page_status) {
case "1":
this.loadMovie("page1.swf");
break;
case "2":
this.loadMovie("page2.swf");
break;
case "3":
this.loadMovie("page3.swf");
break;
etc...
} // end switch (page_status)
That kind of thing should work.

However, you cannot include url query strings inside a .swf.

When you use mc.loadMovie(), for example, you can't pass URL variables in the same manner, at least not as a url query string.

If you try this:


this.loadMovie("myMovie.swf?myURLVar=hello%20world");

you get an error, because the Flash Player can't resolve a url query string.

On the other hand, if you use loadMovieNum (or use the global loadMovie() with _levels) and use the "GET" or "POST" method, you can send variables to a script that can then load a .swf, but this script is not a .swf.

Also, see this thread:
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=24622