PDA

View Full Version : goto frame using URL query (Flash)


mindlessLemming
04-10-2004, 05:44 AM
I'm making a flash nav that uses a query string to decide what page is being displayed and in turn displays the related frame.
The basic actionscript I'm using is this:

if (_root.page=news){
gotoAndStop("news");
}

and the HTML that's passing the query string is this:
<object type="application/x-shockwave-flash" data="nav_master.swf?page=news" width="600" height="200">
<param name="movie" value="nav_master.swf?page=news" />
</object>


Now, that should work, as the frame that the AS is pointing to is labelled "news". I've also tried it with the frame number instead, but that didn't work.
Can anyone see what I'm doing wrong here? Any ideas?

lejon
04-10-2004, 10:14 AM
this works, but uses frame numbers instead of labels:

http://www.jmparsons.com/goto/exampleframe1.html

http://www.jmparsons.com/goto/exampleframe20.html

http://www.jmparsons.com/goto/exampleframe40.html

all the same swf.

view source for frame 20 example, its all done with dreamweaver.

hope that can help.

mindlessLemming
04-12-2004, 05:11 AM
Thanks for that lejon ;)
I knew about the dreamweaver/javascript method, but Iknew it had to be more simple than that, and I wanted to rely on as few technologies as possible. (even though not many people would surf with Flash and without JS...)

All i needed to change was my syntax in the actionscript.
Here's the corrected code if anyone in the future stumbles across the post with a similar problem.

<!-- passing the query string via html -->
<object type="application/x-shockwave-flash" data="nav_master.swf?page=news" width="600" height="200">
<param name="movie" value="nav_master.swf?page=news" />
</object>

//Actionscript
if (_root.page=="news"){
gotoAndStop("news");
//Goes to a frame labelled "news"
}

mindlessLemming
04-12-2004, 07:04 AM
Update: Keeping with tradition, the simple method I posted above doesn't work in IE...
And, in keeping with their tradition, Dreamweaver's version only works in IE...
So, I've had to combine the two to get some decent browser support.
I feel used :mad:

B Mental
09-23-2009, 10:19 PM
mindlessLemming

You are an absolute star. I joined the forums to say thanks and to share my solution.
I've been searching for a couple of days (and kept getting back to the same sites) for a way to link from each slide in a xml driven project gallery slideshow (thanks Kirupa.com) to a frame showing a different slideshow

Anyway I worked out from mindlessLemming post that all I had to do was add the following to my actionscript

myButton.onRelease = function() {
gotoframelabel();
};

function gotoframelabel() {
if (desc_txt.text=="Kresge"){
gotoAndStop("Kresge");
}
};


where desc_txt is the name of my Dynamic Text Box and Kresge is text coming from my XML - see below, AND the frame label



MY XML
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>images/03.jpg</image>
<caption>Kresge</caption>
<thumbnail>images/50p_a.jpg</thumbnail>
</pic>
<pic>
<image>images/04.jpg</image>
<caption>Different Caption</caption>
<thumbnail>images/50p_b.jpg</thumbnail>
</pic>
</images>