topical media & game development

talk show tell print

flex-component-subscriber.mx

flex-component-subscriber.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.events.FlashInterfaceEvent;
                          import flx.external.FlashInterface;
                          import mx.controls.Alert;
                          
                          private var flaface:FlashInterface;
                          private var count:Number = 1;
  
                          [Embed(source="local/flex/assets/images/flex_icon.png")]
                          [Bindable]
                          public var logo:Class;
                          
                          private function init():void
                          {
                                  FlashInterface.addEventListener("talkToFlash", talkToFlashHandler);
                          }
                          
                          private function talkToFlashHandler(evt:FlashInterfaceEvent):void
                          {
                                  txtOutput.htmlText = "<p>" + evt.data + "</p>";
                          }
                          
                          private function clearOutput():void
                          {
                                  txtOutput.text = "";
                          }
                  ]]>
          </mx:Script>
          <mx:Canvas cornerRadius="8" borderStyle="solid" left="5" top="5" bottom="5" right="5">
                  <mx:Image x="330" y="10" width="48" height="48" source="{logo}" scaleContent="false"/>
                  <mx:Label x="14" y="6" text="Flash 9 - Subscriber" fontWeight="bold" fontStyle="italic" fontSize="16" fontFamily="Arial" color="#cc0000"/>
                  <mx:Label x="14" y="33" text="FlashInterface.addEventListener" fontWeight="bold" fontSize="12"/>
                  <mx:Text x="14" y="61" fontSize="11" text="Type message to send to subscriber."/>
                  <mx:Button label="Clear" click="clearOutput()" right="10" bottom="10"/>
                  <mx:TextArea x="10" y="82" width="368" height="66" id="txtOutput"/>
          </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.