as


a new feature of flex 2 is “view” states whereby i can layout multiple views on the same component using mxml (or actionscript) and change state by setting the currentState property on my view. you can also specify which transitions to use etc when switching from one state to another.
viewstacks in flex 1.5 (and 2) sortoff offer the same functionality.

in flex 1.5 some of the people who work with me tried to create 40 switcing icons that switched between 2 states.they quickly discovered this was a bad idea since all the movieclips got created at once, then the flex framework kicks in with its layout logic, so suddenly the time it took before the user could see a screen jumped from 1 second to 8 seconds. so the next approach was adjusting the creationPolicy, but this let them down an axis of evil (creationpolicy is not always as  straightforward as expected). so what they did was create the clip in flex and use the embed directive. problem solved.
(this could have been done in flex 2 by creating a mxml component with 2 states.)

this example however highlights a limitation of viewstatcks in the past (i have not looked into the dynamics of viewstacks in flex2 so am not certain if all the views gets created immediatly but i suspect so) and maybe in the present. in contrast to this (view) states add and remove the clips as is needed. this is awsome in my opinion. also the zorn plugin for eclipse allows you to look at states independently when designing a form. its just been pointed out to me as well that the design view in zorn allows you to toggle between viewstacks as well

An advantage of building your unit tests as you develop and tying these tests to some application entry point (a mx:Application tag for flex or a movieClip in a AS3 project) is that the eclipse editor uses incremental compilation to show your errors to you. thus developing something that exists in isolation and gets used nowhere won’t give you proper feedback. having unit tests solves this problem nicely since every class you are writing has a test and every test is linked to the main test runner thus you can be garunteed that every peice of code you write is somehow imported and compilled.

based on this article by werner sharp from the adobe engineering team i tried creating a typed array storing 16bit uint’s in strings (the 16 bit limit coming from utf-16). the getITemAt turned out to be quite a bit slower than i expected and peter then suggested using bytearray to do this as well.
the experiment is posted here, the code is availible via the context menu.

using any tool to monitor your flashlog you will see the results. included you will find some unit test using asunit

the results:

Array test
added 10000 items  1
retrived 10000 items 1
altered 10000 items 0
byte array test
added 10000 items  2
retrived 10000 items 2
altered 10000 items 2
string array test
added 10000 items  8
retrived 10000 items 3
altered 10000 items 4005
wow, arrays in AS3 are just super fast!

« Previous Page