Link to home
Start Free TrialLog in
Avatar of madasczik
madasczik

asked on

How do you express if a passed in variable is defined?

I'm using 2 instances of a single swf file on my webpage, one on the left nav and one on the right nav.  Both of which I'm trying to output from flash, the height of the movieclip that is generated dynamically.  Since i'm using the same swf I changed the id on the param and embed tags so the javascript function can resize each accordingly.  I'm having trouble with some syntax though to specify wheather a variable is defined or not in flash.

How do I express if a variable is defined in flash?
I also need to add on the same variable to the javascript function name, confused on the syntax.

Here's what I got so far:

if (_root.siteID ???is defined???) {
    var jsFunction = "resizeMovie" + _root.siteID;
}
else {
    var jsFunction = resizeMovie;
}

getURL("javascript:jsFunction('" + navWidth + "','" + startLeftNavY + "');");

---------------------------------------
or should it go something like this:

if (_root.siteID ???is defined???) {
     getURL("javascript:"resizeMovie" + _root.siteID('" + navWidth + "','" + startLeftNavY + "');");
}
else {
     getURL("javascript:resizeMovie('" + navWidth + "','" + startLeftNavY + "');");
}

---------------------------------------

I think the first one is more on track but I am unsure, any help would be greatful.

Avatar of dutchfoxer
dutchfoxer
Flag of Netherlands image

getURL("javascript:resizeMovie('300','150')");

and then in page script:

function resizeMovie(mywidth,myheight)


But you can also use VBscript and FScommand to have flash talk to Html and back. See a nice and complete tutorial here where multiple methods are explained in detail:

http://www.moock.org/webdesign/flash/fscommand/
ASKER CERTIFIED SOLUTION
Avatar of nishasrilankan
nishasrilankan
Flag of Sri Lanka image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial