0 Replies Latest reply on Dec 28, 2009 11:12 AM by Scott R. Hamilton

    Referencing a control defined in a module from ActionScript

    Scott R. Hamilton Level 1

      What do I need to do to be able to reference a mxml component
      defined in a module from an action script function loaded into
      that module? I'm getting a not defined error at compile time.


      The module:


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


      <mx:Script source="../ActionScript/fas_mysql.as"/> 
      <mx:Script source="../ActionScript/SqlQuery.as"/>




      <mx:DataGrid x="49" y="188" id="dqQryRes">
              <mx:DataGridColumn headerText="Title" dataField="sTitle"/>
              <mx:DataGridColumn headerText="Sub Title" dataField="sSubTitle"/>
              <mx:DataGridColumn headerText="Origin" dataField="sOrigin"/>


      fas_mysql.as contains a reference to the dgQryRes datagrid defined in the module:


      private function mysqlResult(event:ResultEvent):void{
              case "RecipeDBQry":
                  dqQryRes.dataProvider = event.result.results.record;


      dqRqyRes cannot be referenced by name from the action script file. This works
      if the mxml file is an application instead of a module.


      Can somebody point me in the right direction here?


      The entire code is attached.