How do I access flashvars in AS3, and add them to an existing text field?

后端 未结 3 605
情深已故
情深已故 2021-01-19 00:12

Edit: I\'ve come to realize the main problem I\'m facing is that I want a text field that already exists in a movieclip or on the stage to take the string from a flashvar. F

相关标签:
3条回答
  • 2021-01-19 00:59

    I've been wasted all the day long for that...

    AS3:

    var uid:String;
    // your code
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
    // your code
    function loaderComplete(e:Event=null):void
    {
        var fv = stage.loaderInfo.parameters;
        uid = fv['uid'] || "'uid' not found";
    }
    

    HTML:

    <object type='application/x-shockwave-flash' data='/flash/yourSWF.swf' width='320' height='240'>
    <param name='wmode' value='transparent' />
    <param name='FlashVars' value='uid=yourData' />
    <param name='movie' value='/flash/yourSWF.swf' />
    </object>
    
    0 讨论(0)
  • 2021-01-19 01:07

    If you are still having this problem, follow below lines. I used flash vars, they work fine for me.

    My html script was:

    <html>
    <body>
    <div id="flashContent">
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"FlashVars="uid=123&name=santhu" width="100%" height="100%" id="index" align="middle">
      <param name="movie" value="index.swf" />
      <param name=FlashVars value="uid=123&name=santhu">
      <!--[if !IE]>-->
       <object type="application/x-shockwave-flash" data="index.swf" 
                FlashVars="uid=123&name=santhu"  width="100%" height="100%">
         <param name="movie" value="index.swf" />
         <param name=FlashVars value="uid=123&name=santhu">
      <!--<![endif]-->
      <!--[if !IE]>-->
       </object>
      <!--<![endif]-->
    </object>
    </div>
    </body>
    </html>
    

    and my AS code to load vars is

    this.root.loaderInfo.addEventListener(Event.COMPLETE, SWFLoadComplete);
    private function SWFLoadComplete(e:Event)
    {
      obj=this.root.loaderInfo.parameters;
      trace(obj.uid , obj.name);  // outputs: 123 santhu
    }
    
    0 讨论(0)
  • 2021-01-19 01:09

    Try this: stage.loaderInfo.parameters.yourparam or stage.loaderInfo.parameters["yourparam"]

    Can you post your html code, so we can see how you pass the flashvars to Flash.

    0 讨论(0)
提交回复
热议问题