FlashVars in Flex

Ray Camden has some examples on how you can pass FlashVars to your Flex apps as well as read them in a Flex app. Here is what he goes over:

HTML code:

"flashvars",'flashvar1=ray&flashvar2=camden&historyhistoryUrl=history.htm%3F&lconid=' + lc_id + '',

Flex code:

<?xml version="1.0" encoding="utf-8" ?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:comp="components.*">
   
   <mx:Script>
   <![CDATA[
   import mx.controls.Alert;
   
   private function test():void {
      Alert.show(this.parameters.flashvar1+' '+this.parameters.flashvar2, "Flashvars");   
   }
   ]]>
   </mx:Script>
   
   <mx:Button id="btnTest" label="Test" click="test()" />
   
</mx:Application>

You can read the entire post here!

No comments yet.

(will not be published)
Leave this field empty: