Posted By

chrisaiv on 09/20/08


Tagged

as3 swfobject2


Versions (?)

Who likes this?

9 people have marked this snippet as a favorite

Winkyboy
vvarp
THEPWN3R
dx0ne
vip4lyf
moselicious
ssolen
tspitzr
myke


AS3: Pass variables using SWFObject2 and AS3


 / Published in: ActionScript 3
 

For almost every Flash project I present on the web, I use SWFObject and with version 2 out, it's easier than ever to pass variables. This is how I collect variables using Flash CS3

  1. /*************************************
  2. This is how the SWF Object would look
  3. *************************************/
  4. <script type="text/javascript" src="js/swfobject.js"></script>
  5. <script type="text/javascript">
  6. var flashVars = { key: "AAA555XXXYYYZZZ", title: "This is my Title" };
  7. var flashParams = { menu: "false"};
  8. var flashID = { id : "swfContent" };
  9. swfobject.embedSWF("main.swf", "swfContent", "550", "400", "9.0.0", "expressInstall.swf", flashVars, flashParams, flashID);
  10. </script>
  11.  
  12. /*************************************
  13. Place this code in the Actions window of Flash CS3
  14. *************************************/
  15.  
  16. var APP_ID:String = getFlashVars().key;
  17. var title:String = getFlashVars().title;
  18.  
  19. function getFlashVars():Object
  20. {
  21. return Object( LoaderInfo( this.loaderInfo ).parameters );
  22. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: myke on December 8, 2010

JUST what I was looking for. Thanks.

Posted By: feeorin on March 24, 2011

i think this is faster...

stage.loaderInfo.parameters.key; stage.loaderInfo.parameters.title;

Posted By: chrisaiv on June 23, 2011

@frrorin, Sounds good. Thanks for the comment.

You need to login to post a comment.