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 8805801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:57:30+00:00 2026-06-14T01:57:30+00:00

I am trying to pass parameters to my swf file using flash vars. I

  • 0

I am trying to pass parameters to my swf file using flash vars. I am using Swfobject to embed my swf. I, however, am not able to access these flashvars inside the swf file. I’ve been having trouble with this for weeks now. I have searched the internet, swfobject’s documentation, and other questions related to this.

Here is my js code using the swfobject to embed the swf file.

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
flashvars.name1 = "hello";
swfobject.embedSWF("Comics.swf", "myContent", "950", "650","9.0.0","expressInstall.swf", flashvars, flashvars,flashvars);
</script>

Here is my the html code to be used for embedding

<div id="myContent"></div>

The swf is embedded fine and produces the following

<object type="application/x-shockwave-flash" name1="hello" data="Comics.swf" width="950" height="650" id="myContent" style="visibility: visible; ">
    <param name="name1" value="hello">
    <param name="flashvars" value="name1=hello">
</object>

Again, the swf is embedded fine. I can see the content but the flashvars seems to be null.
Here is my flash code that tries to access the flashvars

var flashVars = root.loaderInfo.parameters;
addChild(Util.newLabel("  FlashVars: " + flashVars+" "+root.loaderInfo,0,0,400,100,12,0x0));        


var y=0;
for(var i in flashVars){
    addChild(Util.newLabel("FlashVars:"+i+":"+flashVars[i],0,y+=30,300,100,12,0x0));
}

Util is a custom class I made where newLabel(str:String,x:Number,y:Number,w:Number,h:Number,fontSize:uint, color:uint) is a method that returns a label component with str as its text, x and y as its location, w and h as its dimensions and etc. Im pretty sure that the util stuff works so I would like to know how do I really load flashvars?

I should see a list of variable names when running this code.

PS: The flash code above is coded in the main timeline(im using the flash ide to compile my code), in the first frame, while Util is in a seperate as file. The root object in the first frame in the main timeline is an [object MainTimeline].

Let me know if you need more info. Thanks in advance.

  • 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-06-14T01:57:31+00:00Added an answer on June 14, 2026 at 1:57 am

    Flash captures the variables either by getting the variables inside the URL or by flashvars and they are key/value pairs. So basically if you had a URL like this:

    http://someurl.com/flashmovie.swf?testVariable=101&testVariable2=tank
    

    testVariable is the key and 101 is the value and you could get these key/value pairs as below;

        //creating a textfield for debugging
    var _textField:TextField = new TextField();
    _textField.autoSize = TextFieldAutoSize.LEFT;
    _textField.border = true;
    addChild(_textField);
    
    //flashvars code
    try {
        var valueString:String;
        var keyString:String;
        var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
        for (keyString in paramObj) {
            valueString = String(paramObj[keyString]);
            _textField.appendText("\t" + keyString + ":\t" + valueString + "\n");
        }
    }catch (error:Error) {
        _textField.appendText(error.toString());
    }
    

    Hope this helps, Cheers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass PHP Function parameters using Javascript (not JQuery) AJAX. Do I
I am trying to pass parameters from Visual Studio using VB.net to a Crystal
I am trying, in vain it seems, to be able to pass additional parameters
I am trying to pass the parameters from a .feature file (cucumber) to a
I'm trying to pass a parameter to flex: <embed name='costsProject' src='CostsOfProject.swf' height='800%' width='600%' pluginspage='http://www.adobe.com/go/getflashplayer'
I am trying to pass parameters via URL using: setParams({id:id,model:mod}) , and in the
I am using apscheduler and I am trying to pass in parameters to the
I am trying to pass some parameters to a php file and then load
I'm trying to pass parameters from HTML-land to Flex-3 Flash-land, and can't seem to
I'm using plupload, the JQuery UI implementation. I'm trying to pass additional parameters to

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.