1 Reply Latest reply on Jul 27, 2007 6:06 PM by Newsgroup_User

    FABridge in a AS file

    CameronI
      I'm sure there is a way to do this, but I can't find it. I have an action script file that I want to be able to expose some of the methods in it to Javascript. The actionscript functions in my <mx:Application are bieng accessed just fine, from the FABridge. So , if I have an action script file that I need to be able to call from the FABridge how would I do that? In the following code example I can set the label in the application all day long, however I can never seem to be able to call myMethod in FlexBridgeTest class.

      The code I am using is some thing like this.
      var flexApp = FABridge.flash.root();
      flexApp.myMethod();

      Any ideas??

      example code.


      <mx:Application
      xmlns:mx=" http://www.adobe.com/2006/mxml"
      xmlns="*" layout="absolute"
      backgroundGradientColors="[#CCCCCC,#CCCCCC]"
      updateComplete="currentState='zoomedState'"
      creationComplete="creationCompleteHandler(event);">

      <fab:FABridge xmlns:fab="bridge.*" />

      <mx:Script>
      <![CDATA[

      private var flexTest: FlexBridgeTest = new FlexBridgeTest();
      ]]>
      </mx:Script>


      <mx:Label id="lblMyLabel" />



      </mx:Application>


      package test {

      import mx.controls.Alert;
      import bridge.FABridge;

      public class FlexBridgeTest {

      private var faBridge: FABridge = new FABridge();

      public function myMethod():void {
      Alert.show("Called!");
      }
      }
      }