topical media & game development

talk show tell print

flex-component-call-method.mx

flex-component-call-method.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application 
          xmlns:mx="http://www.adobe.com/2006/mxml" 
          layout="absolute" 
          backgroundGradientColors="[#ffffff, #ffffff]" 
          width="400" height="200">
          
          <mx:Script>
                  <![CDATA[
                          import mx.controls.Alert;
                          import flx.external.FlashInterface;
                          
                          private var sendToSwfId:String;
                          
                          [Embed(source="local/flex/assets/images/flex_icon.png")]
                          [Bindable]
                          public var logo:Class;
          
                          private function exec():void
                          {
                                  var sendToSwfId:String = Application.application.parameters.sendToSwfId;
                                  var info:Object = FlashInterface.call(sendToSwfId + ".nextValue");
                                  txtResult.text = info.result;        
                          }
                  ]]>
          </mx:Script>
          <mx:Canvas cornerRadius="8" borderStyle="solid" left="5" top="5" right="5" bottom="5">
                  <mx:Text x="10" y="81" fontSize="11" text="The call method will tell the receiver to move to the next slider value. The return value will represent the new value." width="368"/>
                  <mx:Button x="105.5" y="133" label="Call Method" click="exec()"/>
                  <mx:Label x="204.5" y="134" text="Result:" fontWeight="bold" color="#CC0000" fontSize="12"/>
                  <mx:Label x="258.5" y="134" id="txtResult" fontSize="12" fontWeight="bold"/>
                  <mx:Image x="330" y="10" width="48" height="48" source="{logo}" scaleContent="false"/>
                  <mx:Label x="14" y="6" text="Flash 9 - Call Method" fontWeight="bold" fontStyle="italic" fontSize="16" fontFamily="Arial" color="#cc0000"/>
                  <mx:Label x="14" y="33" text="FlashInterface.call" fontWeight="bold" fontSize="12"/>
          </mx:Canvas>
  </mx:Application>
  


(C) Æliens 27/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.