topical media & game development

talk show tell print

flex-component-receive-method.mx

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


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" backgroundGradientColors="[#ffffff, #ffffff]" width="400" height="200">
          <mx:Script>
                  <![CDATA[
                          import flx.external.FlashInterface;
                          import flx.events.FlashInterfaceEvent;
                          
                          [Embed(source="local/flex/assets/images/flex_icon.png")]
                          [Bindable]
                          public var logo:Class;
                          
                          private function init():void
                          {
                                  var swfId:String = Application.application.parameters.swfId;
                                  FlashInterface.publish(this, true);
                          }
                          
                          public function nextValue():Number
                          {
                                  var nextValue:Number = Math.round((slider.value % slider.maximum) + 1);
                                  slider.value = nextValue;
                                  return nextValue;
                          }
                  ]]>
          </mx:Script>
          <mx:Canvas cornerRadius="8" borderStyle="solid" left="5" top="5" bottom="5" right="5">
                  <mx:HSlider x="32.5" y="137" width="323" minimum="1" maximum="7" id="slider" showDataTip="true"/>
                  <mx:Image x="330" y="10" width="48" height="48" source="{logo}" scaleContent="false"/>
          </mx:Canvas>
          <mx:Label x="14" y="6" text="Flash 9 - Receive Method" fontWeight="bold" fontStyle="italic" fontSize="16" fontFamily="Arial" color="#cc0000"/>
          <mx:Label x="14" y="33" text="FlashInterface.register" fontWeight="bold" fontSize="12"/>
          <mx:Text x="14" y="111" fontSize="11" text="Will increment the slider from the caller."/>
  </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.