PDA

View Full Version : Need to get some variable values from javascript


siddhi
01-15-2002, 09:06 PM
Hi everyone

This is the first time i am using flash and working on javascript so i need some help.

When i press a button on the flash animation, in my action script mouse press event, i need to get the value of a variable which has been declared in the script section of an HTML file. I have a javascript func. which returns the value of the variable declared in the HTML file.

My question is - How can action script obtain the value of a variable declared in the script section of the HTML file ?

Actionscript does have functions like getURL etc. but none have been helpful so far.

Ricod
01-16-2002, 07:57 AM
example javascriptfunction that sets a variable :
function functionName(myVariable) {
if (window.document.mymovie) {
window.document.mymovie.SetVariable("jscriptVariable", myVariable);
}
}

U'll need to add some in the html-file where u embed the swf :

In the OBJECT tag : id="mymovie"
In the EMBED tag : NAME=mymovie
swLiveConnect=true

To get the variable :
on(release){
someVariable = _root:jscriptVariable;
}

With thanks to Robert Penner.