33 Replies Latest reply on Nov 28, 2011 10:40 AM by Francisc

    How to import MXML Component in ActionScript

    Francisc Level 3

      Hello,

       

      I'm having a structure similar to this:

       

      root

         - components

             - subcomponents (MyCustomMXMLComponent)

         - views

       

      In views package I have a piece of AS where I want to instantiate an MXML Component from subcomponents.

       

      In Views:

       

      var data:DisplayObjectContainer=new components.subcomponents['MyCustomMXMLComponent'];

       

      But that throws an error.

      I need a syntax similar to the one above because I'm running a for loop and changing data variable to be a new MXML component on each iteration.

       

      Any idea how I can solve this?

       

      Thank you.