Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

FlashVars in action script 3

New Here ,
May 25, 2017 May 25, 2017

I have searched this forums for an answer, but have not had any luck. Here is my problem. I have a swf file that I need to load in a value via flash vars. Here is the html I am using to try to pass the variable:

   <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="test" align="middle">

    <param name="movie" value="test.swf" />

    <param name="quality" value="high" />

    <param name="bgcolor" value="#ffffff" />

    <param name="play" value="true" />

    <param name="loop" value="true" />

    <param name="wmode" value="window" />

    <param name="scale" value="showall" />

    <param name="menu" value="true" />

    <param name="devicefont" value="false" />

    <param name="salign" value="" />

    <param name="allowScriptAccess" value="sameDomain" />

    <param name="FlashVars" value="filename=a-1.xml" />

    <!--[if !IE]>-->

    <object type="application/x-shockwave-flash" data="test.swf" width="550" height="400">

     <param name="movie" value="test.swf" />

     <param name="quality" value="high" />

     <param name="bgcolor" value="#ffffff" />

     <param name="play" value="true" />

     <param name="loop" value="true" />

     <param name="wmode" value="window" />

     <param name="scale" value="showall" />

     <param name="menu" value="true" />

     <param name="devicefont" value="false" />

     <param name="salign" value="" />

     <param name="allowScriptAccess" value="sameDomain" />

     <param name="FlashVars" value="filename=a-1.xml" />

    <!--<![endif]-->

     <a href="http://www.adobe.com/go/getflash">

      <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />

     </a>

    <!--[if !IE]>-->

    </object>

    <!--<![endif]-->

   </object>

As you can see I do have a FlashVars parameter with a value of "filename=a-1.xml".

After doing some research I found two solution below:

Solution 1:

var strFilename:String = loaderInfo.parameters.filename;

urlLoader.load(new URLRequest(strFilename));

And solution 2:

urlLoader.load(new URLRequest(GetFilename()));

//Get Test Name to Load

function GetFilename():String

{

var objParam:Object = LoaderInfo(this.root.loaderInfo).parameters;

var strFilename:String;

strFilename = String(objParam["filename"]);

return strFilename;

}

I tried them both and all it get when I view the HTML page in a browers is a flashing image of graphics I use as my buttons.

My entire "movie" is four frames long. In frame 1 I have all my actionscript code. Frame two I use as a title screen, frame three where the work is done, and frame four is a results screen. I have a stop(); command as the first line in each actionscript in each frame. frames 2, 3, and 4 only have two commands in them. The stop() command, and a call to a function in frame one to do the work. Everything works fine if I hardcode the filename in the swf file, but I will need to be abe to load it from and HTML page. I know I am over looking something, and it is probably simple. I would appreciate any help anyone can offer.

Thank you,

Troy L. Marker

TOPICS
ActionScript
520
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 26, 2017 May 26, 2017

With any plugins you would normal do object/embed, not just object. I'm not fully sure which one would fail for the browser you're using. Read this short discussion for more insights:

html - EMBED vs. OBJECT - Stack Overflow

Also, look into swfobject, that can make embedding easier:

SWFObject: Javascript Flash Player detection and embed script | deconcept

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 26, 2017 May 26, 2017
LATEST

Colin,

I looked into the SWFobject you suggested, I am still having trouble getting it to work. I put all the file I into: test.zip - Google Drive

If you have chance, can you please look at them and help me figure out what is wrong?

Thank you,

Troy

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines