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.

madasczikAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dutchfoxerCommented:
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/
0
nishasrilankanCommented:
You can check whether the variable is defined or not with following code

if(variable=='undefined'){
//returns true if variable is not defined
//code goes here
}
//

for javascript things...please refer http://www.actionscript.org/tutorials/intermediate/FS_Command_JavaScript_Library/index.shtml

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.