3 Replies Latest reply on Mar 19, 2008 10:17 PM by Sreenivas R

    accessing components in a module from my applciation

    riesvantwisk Level 1
      Hey all, I have this simple module:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" implements="fo_ImoduleInterface">

      <mx:Script>
      <![CDATA[
      import mx.controls.MenuBar;
      public function test():String {
      return "Test String";
      }
      public function getMenuBar():Array {
      return myMenuBar.menus;
      }

      ]]>
      </mx:Script>
      <mx:ApplicationControlBar dock="true" paddingTop="0" paddingBottom="0">
      <mx:MenuBar id="myMenuBar" labelField="@label">
      <mx:XMLList>
      <menuitem label="menu" >
      <menuitem label="sub 1" />
      <menuitem label="sub 1" />
      </menuitem>
      </mx:XMLList>
      </mx:MenuBar>
      </mx:ApplicationControlBar>
      </mx:Module>


      Now I want to access getMenuBar from my application to create a 'general' menu in my main application (much like what OSX does).

      I can successfully access the function test and get my test string back, so I know my module is loaded (I can see it on the screen to) but trying to get access to the component always fails.

      What is the proper solution to let my main application access a component in a module?

      Ries