Posted By

glup on 02/01/11


Tagged

swf movieclip AIR Flex


Versions (?)

Flex/Air Accessing movieclip in loaded swf


 / Published in: MXML
 

URL: http://www.digitalwks.com/blogs/fabio-belga/

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
  3. xmlns:s="library://ns.adobe.com/flex/spark"
  4. xmlns:mx="library://ns.adobe.com/flex/mx"
  5. minWidth="400" minHeight="100"
  6. >
  7. <fx:Script>
  8. <![CDATA[
  9.  
  10. import mx.controls.Button;
  11. private var loaderContent1:Object;
  12. private var loaderContent2:Object;
  13.  
  14. protected function InitMovieClips(event:Event):void
  15. {
  16. var BtnClick:SimpleButton = SimpleButton(loader1.content["BtnClick"]);
  17. BtnClick.addEventListener(MouseEvent.CLICK, ShowHelloWorldText);
  18. loaderContent2 = loader2.content;
  19. }
  20.  
  21. protected function ShowHelloWorldText(event:MouseEvent):void
  22. {
  23. loaderContent2.FunctionInsideSWF(event);
  24. }
  25.  
  26.  
  27. ]]>
  28. </fx:Script>
  29.  
  30. <fx:Declarations>
  31. <!-- Place non-visual elements (e.g., services, value objects) here -->
  32. </fx:Declarations>
  33.  
  34. <mx:HBox backgroundColor="#CCCCCC">
  35. <mx:SWFLoader id="loader1" source="assets/Loader1.swf" complete="InitMovieClips(event)"/>
  36. <mx:SWFLoader id="loader2" source="assets/Loader2.swf" complete="InitMovieClips(event)"/>
  37. </mx:HBox>
  38.  
  39. </s:Application>

Report this snippet  

You need to login to post a comment.