Ted Patrick > { Events & Community } > Adobe Systems


FMX 2004 Compiler & createClassObject

If you use createClassObject() in the MX 2004 IDE, it forces the compiler to compile all AS2 dependent classes. Depending on the class selected, that can be quite a few classes in the V2 framework.\0

I was playing around with Components over the weekend and discovered the compiler delay in building swf files when createClassObject was used in AS. In MX2004 components are precompiled to a swf within the SWC (zip) wrapper. When you add a component to a project, the swf in the SWC is added pre-compiled to the output swf file on compile. Yet if you use createClassObject anywhere within your FLA, all dependent classes are recompiled from scratch regardless of what is precompiled within the SWC.

Simple Example:

1. Drop a Button on Stage
2. Compile - Instantly!

3. Add this AS >

createClassObject(mx.controls.Button,'mystring',0)

4. Complie - 4 Seconds

5. Add this AS>

createClassObject(mx.controls.Button,'0',0)
createClassObject(mx.containers.Window,'1',1)
createClassObject(mx.containers.Accordion,'2',2)
createClassObject(mx.controls.Alert,'3',3)
createClassObject(mx.controls.CheckBox, '4',4)
createClassObject(mx.controls.List,'5',5)
createClassObject(mx.controls.RadioButton,'6',6)
createClassObject(mx.controls.DataGrid,'7',7)
createClassObject(mx.controls.DateChooser,'8',8)
createClassObject(mx.controls.RadioButton,'9',9)

6. Compile - 14 Seconds

Note I am running FMX2004 7.01 on a Dual 1.7Ghz Zeon Workstation with 2GB RAM, WIN XP Pro.

If I simply add all of the SWC components in the last example into a project with no actionscript and compile, it compiles nearly instantly. SWC's are a really great form of reuse as it saves the compiler from doing any work.

This seems to be the same issue in FORMS & SCREENS & SLIDES development metaphor in the MX2004 IDE.

One great solution would be to pre-compile classes to swf for use with createClassObject as classes are first used. This would allow a very similar paradigm to the use of SWC yet allow much faster compiling.

Cheers,

Ted ;)




Jobs


Flex Jobs
city, state, zip


© 2008 Ted On Flash