1 Reply Latest reply on May 4, 2012 10:20 AM by skant

    Referencing a mxml component from an external class

    skant

      Hello,

       

      anyone knows how to reference a mxml component from an external class?

      The idea is to do what we did with AS2, root.instancename.

       

      Example quote of my external class:

       

      protected function stopCamara():void

      {

      sv.removeChild(videoDisplay);

      cameraStarted = false;

      btn.label = "Start Camera";;

      }

       

      Example quote of mxml

       

      <s:SpriteVisualElement id="sv" includeIn="Caption" />

       

      <s:Button id="btn" includeIn="Caption" x="10" y="353" width="300" height="45" label="Start Camera" click="button1_clickHandler(event)" includeInLayout="true"/>

       

      and the error message is:

       

      -Access of undefined property sv/btn

      -1120: Access of undefined property sv/btn

       

      Anybody knows how to fix or how to understand what's going on,

      I have read a lot but all talk about instances from flash, not flex components

       

      thanks,

      best regards,

      Cristian