then..all you need to do is have your embedded .swf thats in he products .html page check this url string and grab the var from it.. and jump to that specific frame in the movie.
Im not sure how your embeding your .swf's into your .html page..but I highly recommend using SWFObject to do so.. and then use the built in query string var feature...
How exactly do I go about checking that url string in actionscript? I really have a limited knowledge of it. I've been looking around online but can't seem to find any code that relates.
a little more than half way down:
swfobject.getQueryParamValue(paramStr)
swfobject.getQueryParamValue(catID)
is what you need to use when you embed the .swf into your .html page..
then inside your products.swf you need to check for the:
_root.catID; variable.. and see if it is hydronics (or whatever).. and then jump/start on that frame..
so to summarize for you.
1.) you need to get SWF Object and use that method of embedding your .swf into your products.html page
2.) read the link above and edit your embed code (only an example above) as you need to.... adding the code to xxxx.getQueryParamValue(xxx); get the var name form the query string.
by doing this.. it automatically creates a var on the _ROOT of the .swf for you to use..
its available once the .swf loads.. so you can use an if() statement right away in the first frame to do 'whatever'..
whispers, thanks for the quick response. I've read it over and over. I understand the concept but not how to apply it.
My flash (and general computer) knowledge is minimal but I'm trying my best.
I've downloaded the source files for swfobject and uploaded the javascript onto my server- into the same folder where my swf's are.
I've tried to embed using this code:
Code:
<script type="text/javascript" src="swfobject.js"></script><script type="text/javascript">
var so = new SWFObject("3boxes.swf", "3box", "700", "125", "10", "#336699");
so.write("flashcontent");
</script>
however nothing shows up.
Also, I'm unsure of how or where to use the function 'swfobject.getQueryParamValue(paramStr)'.
I've doublechecked and the .js in on my server in the same folder as these pages and swf's.
All I'm getting is 'alternative content'.
Also, where would i use the swfobject.getQueryParamValue function?
this is so way over my head. shoulda told my boss to get someone who knew what he was doing to build this site.
Insert alternative content using standards compliant markup and embed Flash content with unobtrusive JavaScript (also called dynamic publishing).
Arguments:
* swfUrl (String, required) specifies the URL of your SWF
* id (String, required) specifies the id of the HTML element (containing your alternative content) you would like to have replaced by your Flash content
* width (String, required) specifies the width of your SWF
* height (String, required) specifies the height of your SWF
* version (String, required) specifies the Flash player version your SWF is published for (format is: "major.minor.release" or "major")
* expressInstallSwfurl (String, optional) specifies the URL of your express install SWF and activates Adobe express install. Please note that express install will only fire once (the first time that it is invoked), that it is only supported by Flash Player 6.0.65 or higher on Win or Mac platforms, and that it requires a minimal SWF size of 310x137px.
* flashvars (Object, optional) specifies your flashvars with name:value pairs
* params (Object, optional) specifies your nested object element params with name:value pairs
* attributes (Object, optional) specifies your object's attributes with name:value pairs
* callbackFn (JavaScript function, optional) can be used to define a callback function that is called on both success or failure of embedding a SWF file (SWFObject 2.2+)
your missing a bit in your embed code.
1.) you need to create and (grab) your flashvars form the query string (and any params you want to add)
Code:
var flashvars = {};
if (swfobject.getQueryParamValue("catID")) {
flashvars.catID = swfobject.getQueryParamValue("catID");
}
var params = {};
params.quality = "high";
params.bgcolor = "#FFFFFF"
as your last step.. you need to edit your .fla/code so you can do whatever you need (jump to a certain frame) in your flash movie once that var is received.
Ok so I'm getting there.
I'm making a test file first to figure this out.
I have this code on the first frame:
Actionscript Code:
var whatCat:String = _root.catID; switch(whatCat){ case"hydronics" : trace("hydronics"); someClip.gotoAndStop("hydronics"); break; case"eco" : trace("eco"); someClip.gotoAndStop("eco"); break; case"plumbing" : trace("plumbing"); someClip.gotoAndStop("plumbing"); break; default : trace("No category of that kind found"); someClip.gotoAndStop("errorFrame"); }
as well as a movieclip, 'someClip' with 4 frames. With labels 'hydronics', 'eco', 'plumbing', and 'errorframe'.
This is online at fulfordsupply.com/test.html.
On the errorframe is a blue box- and whether you put in /test.html or
/test.html?catID=hydronics/eco/plumbing you get the error frame.
i've tried playing around with "s and can't seem to find the issue arghh
I'll keep playing around with it.
i knew it was gonna be something stupid like that.
I didn't think it was gonna do anything but adding expressinstall.swf worked... so weird 'cause it was already embedded just fine.
anyways, thanks tons! you're the best.
So I got the code into my actualy .swf and after a little tinkering its working awesome.
I'm inspired to make a tutorial of how to do this- I've seen lots of forum posts looking for answers to this but no detailed answers like you gave me. I'm sure people could really use this for marking in their banner what page they're on.
If anyone happens to take a look at my site- www.fulfordsupply.com/products.html- refresh it a couple times and you'll see that the bottom bar appears in multiple at the top of the screen before the page fully loads. weird. any ideas of what might be happening here? this has never happened before I used swfobject.