[Flash8]Help Setting an external Variable?

Hi guys,

Any idea how I can declare a variable that is retrievable when the browser reloads.

spanks:pirate3:

If you want it to be retrieved by the same SWF, check out SharedObject in the help files.

hi glosrfc,

It needs to be used by two swf files. Can I use a cookie?

thanks

See post #3 & #5

Pablo

Try this easy primer too:
http://www.kirupa.com/developer/actionscript/tricks/passingvariables.htm

Hi, thanks for your help it’s much appreciated.

I have this working to an extent. I am doing this for a client who would like the feature in an oscommerce shop install.

I have an index.php page where we have designed a flash program to sit on its own. On product pages we want to have a flash navigation bar appear in the leftColumn.

This actually works very well. I simply replaced the the var name to the default oscommerce var (cPath).

So I have:

if(cPath==“24”){
gotoAndStop(31);
}else{
gotoAndStop(30);
}

My problem is that cPath will not always equal 24. It will be all sorts of strings? (24_29 this is a string not number because of the _)?

Is there a way to define lots of variable values in flash? Just carry on the If statement?

chris

You can code a switch/case statement rather than create loads of if statements and you can use strings or numbers:
switch (cPath) {
case 24 :
trace(“cPath is number 24”);
break;
case “24” :
trace(“cPath is string 24”);
break;
case 25 :
case 26 :
case 27 :
trace(“Some other number”);
case “25” :
case “26” :
case “27” :
trace(“Some other string”);
break;
default :
trace(“Number or string invalid”);
}

This will make it easier to edit because the problem that I see with this navigation in the future is that it will need editing every time the product range changes along with their respective strings.

Hi glosrfc,

thanks, I take your point about updating this navigation. May have to look at some xml code.

Just to let you know I found that is works best (so far) if I do this:

if(cPath==""){
gotoAndStop(30);
}else{
gotoAndStop(31);
}

by way of redirect page, i have sent people to cPath= which results in the index.php page.
As you know, this means any other cPath vars will result in FRAME 31 (in my example…i think).

probably a bit oscommerce specific but might help someone.

thanks again