<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="475" height="400" backgroundColor="#CCCCCC" viewSourceURL="tutorials/FF_Talk_Simple/srcview/index.html">
<mx:Script>
<![CDATA[
[Bindable]
private var flashSaid:String = "";
private var mySwfMc:MovieClip;
private function setSwfMc():void{
mySwfMc = mySWFLoader.content as MovieClip;
mySwfMc.myFlexParent = this;
}
public function listenToFlash(stringToShow:String):void{
flashSaid = stringToShow;
}
private function talkToFlash(stringToPass:String):void{
mySwfMc.listenToFlex(stringToPass);
}
]]>
</mx:Script>
<mx:Label horizontalCenter="0" text="This version calls functions directly between Flash and Flex"/>
<mx:Label top="15" horizontalCenter="0" text="Right-click to view source"/>
<mx:VBox width="450" height="150" top="35" left="10" backgroundColor="#EEEEEE" paddingLeft="10" paddingRight="10">
<mx:Label text="Hi, I'm the parent Flex app."/>
<mx:Label id="flashSaidLabel" text="My loaded .swf child said: {flashSaid}" fontSize="18"/>
<mx:HRule width="100%"/>
<mx:Label text="You can talk to my loaded .swf file here:"/>
<mx:TextInput id="flexInputTxt" text="Place your text here" width="320" maxChars="20" borderColor="#000000" borderThickness="1"/>
<mx:Button label="Talk to Flash" buttonMode="true" click="talkToFlash(flexInputTxt.text)"/>
</mx:VBox>
<mx:SWFLoader id="mySWFLoader" bottom="10" left="10" source="/_flash/ffTalkSimpleSwf.swf" complete="setSwfMc()"/>
</mx:Application>