Separate your ActionScript from your MXML

I believe I’ve mentioned before how I really like Flex but it has annoyed me that the ActionScript is mixed with the MXML on in a module and this can mean big modules that are hard to work with.

What was missing was something akin to a script tag on a HTML page so you can create common script files saving duplication while simultaneously making it easier to see what is going on with your modules.

It turns out that I should have been a little more observant.  The solution is so bloody simple I’ve been kicking myself for the past few days.

To include an external ActionScript file you simply need to add a line similar to the following:
[cc lang="actionscript"]

[/cc]
The file will then be included in the module and you can keep your script and pages cleaner and more efficient.

Doh!

, ,

 

Comments are closed.