Using Flex Components in ActionScript Projects

A lot of people have had questions about whether you can use the Flex 2 Framework classes / controls (everything in mx.*) within an ActionScript 3 project without using any MXML.

You can definitely do this, and we have posted some info on the labs wiki that shows how (written by Gordon Smith).

You can view the info here.

You can download Flex Builder 2 and ActionScript from

9 Responses to Using Flex Components in ActionScript Projects

  1. JimmyH says:

    This is great mike… was just aksing round about this yesterday. Thanks a lot.

  2. benjamin says:

    i can`t get it to work ;-(Are you sure you`re talking about an AS3 only project? Does anyone can provide a full class.Everytime i try it it compiles fine but nothing shows up.ThanxBenz

  3. Mike says:

    Hello,Will the Flex 2 compiler eventually target versions 7 and/or 8 of the Flash Player?Mike

  4. Francis Gabon says:

    Thanks for the tip Mike but according to that info it seems we need a Container to be able to attach the Button on stage, like in MXML projets. Is there a way to create one then instantiate it on runtime ?Thanks

  5. Campbell says:

    You could use the method explained here to see the generated actionscript file and have a bit of a look around what mxml files produce. Might help understand whats going on:

  6. Campbell says:

    Take that back seems you cant do it in flexbuilder 2 :o(

  7. Campbell says:

    Aparently “-keep-generated-actionscript=true” is a compiler argument in Flex 2 but:”Normally, you would put an argument like that in the box provided on theFlex Compiler page of the project properties in Flex Builder. However, inthe current alpha build, Flex Builder is not passing that through properlyto the compiler. This will be fixed in a subsequent build.For now, you can use the mxmlc command-line compiler to view the generatedActionScript.–Phil CostaSr. Product ManagerMacromedia”

  8. cheol jin eom says:

    This is my as3.0 sample. sample is show combinations of Marix, bitmap, realtime MP3 Spectrum.Just Look and feel AS3.0′ powers.

  9. Flexer says:

    Hello,Almost a year later what do you know, well, I cannot find any info on how to do this “Using Flex Components in ActionScript Projects” can someone please send me an email with a clear example of how I can do this because I tried a lot of things including the explanation found here which almost worked was able to access the mx.controls but when I tried to create a control dynamically it was not shown on the stage ? pls send me an emailKind Regards,thanks.