3 Replies Latest reply on Jan 6, 2010 10:45 AM by Shongrunden

    AS3 equivalent of MXML code?

    allanjard

      Hello all,

       

      I've recently be experimenting with AS3, and been absolutely delighted with it's capabilities in Flex 4 (coming from a web dev background). One thing that has me fairly confused though, is the relationship between MXML and AS3. I realise that at compile time the mxmlc will take the MXML and convert it to AS3, so there is a way to represent all MXML as AS3. Which brings me to my question:

       

      Because I've been focusing on AS3 initially, I've found a lot of examples which are MXML based rather confusing. For example this scroller code block ( from http://www.adobe.com/devnet/flex/articles/flex4_viewport_scrolling_03.html ) - I have no idea how one would do that in AS3. If I create a Scroller object and try to 'addElement( new Group() )' I just get an error about this not being possible.

       

      <s:Scroller left="1" right="1" top="1" bottom="1">

         <s:Group>

            <mx:Image source="guyrobot.jpg"

               horizontalCenter="0"

               verticalCenter="0">/

         </s:Group>

      </s:Scroller>

       

      Is there anyway to view the AS3 that the compiler fires out, as I'm hoping this will help my understanding of AS3? I release of course that MXML is geared towards layout, and that is what is happening here - but I'm curious about how this is done in AS3.

       

      Many thanks,

      Allan