2 Replies Latest reply on Jul 21, 2008 11:04 PM by gongati2k

    Flex and Externally Loaded SWF communication


      I am trying to Load an SWF file and I want to call a method in this SWF file using Flex API. But I get some ERROR #1034(Type Error). the SWF file I am trying to load is developed in Flash CS3 with AS2.0 and the flex version I am using is Flex 3.0.

      Below is the Flex code of my sample. and here I am just trying to put some text into the text field of loaded SWF file.

      My actual aim is to call a function in Flex from SWF which is loaded dynamically. I hope the details are clear about my problem and some one helps me find the solution or where I am going wrong.

      Thanks in advance.

      <?xml version="1.0"?>
      <!-- Simple example to demonstrate the SWFLoader control. -->

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      import mx.controls.Alert;
      import mx.managers.SystemManager;

      public var loadedSM:SystemManager;

      public function uploadFinish(msg:String):void{
      mx.controls.Alert.show("call from SWF --> "+msg);

      public function initNestedAppProps():void {
      loadedSM = SystemManager(myUploader.content);
      Alert.show(err.message+" : "+err.name);

      public function setFlashText():void{
      loadedSM.application["flex_txt"].text = "Text from Flex";
      //Uploader.content["flex_txt"].text = "flex text";
      <mx:Panel title="SWFLoader Control Example" height="90%" width="90%"
      paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">

      <mx:Label id="ltxt" text="The Label control of the outer application."/>
      <mx:Button label="Button" id="btn1" click="setFlashText();"/>
      <mx:SWFLoader autoLoad="true" id="myUploader" source="../bin-debug/uploader.swf" height="345" width="560" init="initNestedAppProps()"/>