0 Replies Latest reply on Sep 21, 2010 12:06 PM by BRebey

    Access  properties of custom  component's base  class from  Action Script

    BRebey

      When I create a custom component in MXML from, for instance, a VBox, I can't access all the properties of the VBox when I later instantiate the component from Action Script.

       

      For instance, if I  have a component TestComponent defined in

       

           TestComponent.mxml:

       

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

       

      and I later instantiate it from script like  this, I can't access  things  like  "horizontalCenter" and "top"  so that I can manage the component's location.

       

       

           ...    
           private var compInst:TestComponent;


           private function onInitialize():void
           {

                compInst = new TestComponent();
                compInst.top = 50;   // *** <<<>>> *** This produces a compiler error (below).
           }

       

      The error is:  "Access of possibly undefined property top through a reference with static type TestComponent".

       

      My component is based on a VBox, and "top" is a property of VBox, but I can't access it.   What am I doing wrong?