Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6826759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:11:09+00:00 2026-05-26T22:11:09+00:00

I want to send a float variable to Actionscript. I use window.document.setVariable() , but

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:11:10+00:00Added an answer on May 26, 2026 at 10:11 pm

    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 ExternalInterface class

    (1): Pull the variable into ActionScript

    //JavaScript:
    var myVariable=3.14159; //or whatever you want to set it as
    
    function getMyVariable() {
        return myVariable;
    }
    
    
    //Flash
    var myVariable:Number=ExternalInterface.call("getMyVariable");
    

    (2): Push the variable into ActionScript

    //Flash
    ExternalInterface.addCallback("pushVar", varPushed);
    var myVariable:Number=0;
    function varPushed(x:Number):void {
        myVariable=x;
    }
    
    
    
    //JavaScript
    var myVariable=3.14159; //or whatever you want to set it as
    var fl = document.getElementById('myflashobject');
    fl.pushVar(myVariable);
    

    EDIT
    (3): Use flashVars

    If you use swfObject, then you add flashVars using the following line:

    var flashvars = {}; 
        flashvars.myVariable=3.14159
    ...
    ...
    swfobject.embedSWF( 
        "FlashVarTest.swf", "flashContent", "100%", "100%", swfVersionStr, 
        xiSwfUrlStr, flashvars, params, attributes); 
    

    If you use the <object> tag then you add flashVars like this:

     <object id='mySwf' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' height='100%' width='100%'>
            <param name='src' value='FlashVarTest.swf'/>
            <param name='flashVars' value='myVariable=3.14159'/>
            <embed name='mySwf' src='FlashVarTest.swf' height='100%' width='100%' flashVars='myVariable=3.14159'/>
        </object>
    

    Regardless of your embedding method, you access flashVars in AS3 like this:

    If you are using the Flex SDK:

    var myVariable:Number = FlexGlobals.topLevelApplication.parameters.myVariable;
    

    If you are not using the Flex SDK:

    var myVariable:Number =Number(LoaderInfo(this.root.loaderInfo).parameters.myVariable);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want send a email by Email Class in codeigniter with gmail, but i
Hello Sir i want send list of data to php server i use following
Want to send the text from my current vb application to the Active Window
In my application i want send a email to one account.in one button click
I want to send a xml file to my wcf service , how can
I want to send SQL server Dashboard & Health Report to my client on
I want to send ViewData.model to Special action with the last user data entry.
I want to send a message whenever RabbitMQ creates or deletes a queue, exchange
i want to send a byte array on udp through an ansi c program
I want to send a barcode, read with my cellphone, to my computer. My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.