AS3: Pass variables using SWFObject2 and AS3


/ Published in: ActionScript 3
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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

You need to login to post a comment.