Hello Flashcoders,

Let's say I have two files, myApp.mxml:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
applicationComplete="EntryClass.main()">
    <mx:Panel>
      <mx:VBox id="myChart" width="900" height="300" />
    </mx:Panel>
</mx:Application>

and EntryClass.as:
package {
  public class EntryClass {
    public static function main():void {
      myChart.graphics.drawRect(100,100,100,100);
    }
  }
}


Why does "mxmlc myApp.mxml" complain with this error message:

    quote:
    /path/to/EntryClass.as(4): col: 7 Error: Access of undefined
property myChart.

    myChart.graphics.drawRect(100,100,100,100);
    ^

According to devguide_flex3.pdf:
"The IDs for all tags in an MXML component, no matter how deeply
nested they are, generate public variables of the component being
defined. As a result, all id properties must be unique within a
document. This also means that if you specified an ID for a component
instance, you can access that component from anywhere in the
application: from functions, external class files, imported
ActionScript files, or inline scripts."

I thought perhaps this would work:
package {
  public class EntryClass {
    public static function main():void {
      var mxmlApp:Application = Application(Application.application);
      mxmlApp.myChart.graphics.drawRect(100,100,100,100);
    }
  }
}

but mxmlc complains about this with:
/path/to/EntryClass.as(7): col: 15 Error: Access of possibly undefined
property myChart through a reference with static type
mx.core:Application.

Any suggestions appreciated!

Thanks,
Steve
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to