This content has been marked as final. Show 1 reply
> in this case I am setting all of my variables using SetVariable()
> to support Player 7.
specific to Flash, is in cases where you want to update a variable *after*
the SWF has already loaded (such as, for example, to change it from a
default value at some later time). If the variable only needs to be set
once, when the SWF is requested by the HTML, then FlashVars or a query
string on the SWF's file name itself is all you need.
> My question is: how can I set a button to open a destination URL
> and call the tracking URL dynamically using SetVariable()?
There are quite a few ways to define variables in a SWF (variables are
nothing more than special containers to hold data). In a keyframe of any
timeline, for example, you can do something like this:
var destination:Sring = " http://www.domain.com/";
Of course, that "bakes" the variable into the SWF itself. It is set and
may be referenced by that SWF. If you want to set such a variable from
*outside* the SWF, such as from the HTML document, then it can be attached
as a querty string to the name of the SWF file itself ...
<param name="movie" value="myMovie.swf?destination=http://www.domain.com/"
... or passed in via a FlashVars attribute ...
<param name="FlashVars" value="destination=http://www.domain.com/" />
... or, as you've indicated, with the SetVariable() function ...
swfFileReferenct.SetVariable("destination", " http://www.domain.com/");
In any of the above cases, a variable named destination (just an
arbitrary, descriptive name) is created in the main timeline (assuming the
first example, with "var", was typed in a keyframe of the main timeline).
At any point in the SWF, the variable destination can be referenced, and its
value will be (in this case) http://www.domain.com/, unless it is changed to
something else later.
> The current logic looks like this:
> 1. flash file loads
Does this mean it is requested by the HTML document, or you're using a
main SWF file to load another SWF file?
> 2. Using the watch() method, the flash file populates as
> variables are passed in using SetVariable()
I'm curious why you're using Object.watch(). Not saying you're
necessarily wrong to do so, but maybe it would help to show your code?
> I've figured out how to do simple things like change the text,
> but I'm not sure how to set a button URL and a tracking URL
> for when that button is clicked.
Your button would presumably call getURL() (or maybe a LoadVars
instance?) in response to a mouse click. The first parameter of getURL() is
a URL, which would be the name of whatever variable contains the value you
want to reach.
Co-author, Foundation Flash CS3 for Designers
"Luck is the residue of good design."