I want to send a float variable to Actionscript.
I use window.document.setVariable(), but it only supports type String, and ignores 0 and point (.)
I try to use parseFloat() and value * 1 in javascript,but it doesn’t work.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your question is pretty vague. Still, here goes:
There are 2 (edited to 3) methods to get a variable into Flash from the html. Both use the
ExternalInterfaceclass(1): Pull the variable into ActionScript
(2): Push the variable into ActionScript
EDIT
(3): Use flashVars
If you use swfObject, then you add flashVars using the following line:
If you use the
<object>tag then you add flashVars like this:Regardless of your embedding method, you access flashVars in AS3 like this:
If you are using the Flex SDK:
If you are not using the Flex SDK: