I have mostly completed migrating my “Superlight Video Controller” (SVC) from Actionscript 2 to Flash CS3 and AS3. The AS2 version is class based code and the swf weighs in at 8k. The surprise to me is that the AS3 swf currently weighs in at 24kb. AS3 requires increased class specificity and therefore there are more import statments needed. I can accept this since I assume I have more flexibilty and control about what classes are included and what are not so therefore I would expect the file size to go down instead of up. I believe the increase has to do with the inclusion of the BaseButton class which is part of the v3 component set. In the AS2 version I used a custom SmartButton class that simply mapped MovieClip mouse events to frame based states and dispatch events so I could use the addEventListener model with SmartButtons.
The migration has been fraught with a few gotchyas:
- BaseButtons combined with startDrag caused a bug whereas the BaseButton x getter was not working properly.
- The NetConnection object was failing to connect to our Flash Streaming Media server. The solution was to downgrade object encoding property:
netConnection.objectEncoding = ObjectEncoding.AMF0;
- The NetStream onMetaData, onPlayStatus, and onCueData events use old skool callbacks and can not be accessed using the event listener model. Adobe states in their docs that these event are not part of the official API but are supplied for our convenience. Thats strange. This is probably due to that fact that these events rely on how the videos are encoded. FLV video encoded by third party encoders (or even older Macromedia encoders) may not have the metadata needed to make these callbacks reliable.
To access Stage events from a Flex app, the property “stage” is available to the application since it is inherited from DisplayObject. What the docs don’t explain is that the stage property is not available on “creationComplete” but is available on “applicationComplete”. My test was to resize a Flash-made-component’s width and height as the Stage resizes by using the resize Stage event. It worked but the performace was poor and the resizing didn’t keep up all the time; sometimes scroll bars would appear during testing. If I turn on Scale9 for the Flash-made-component and then place it in an HBox, set both to have 100% width and height, then the graphic scales well and keeps up with the browser resizes. This does not help me since I want to overlay graphics using an “absolute” layout where 100% width and height values are ignored.
Glenn Ruehle and Ted Patrick from Adobe demo an upcoming feature of the Flex Component Kit for Flash CS3 in this video. Glen shows the results of building layout containers in Flash and bringing them into Flex where they exist as “first class citizens”. This is a killer feature and I need it for a current project. I have found no other news on this.
I have been playing with the Component Kit. It is less onerous than Grant Skinner’s DisplayObjectWrapper.
UPDATE: In this video Glen talks about the Componet Kit and the upcoming “Make Flex Container”. At this path in Flex 3 is a newer FlexComponentKit.mxp which adds a “Make Flex Container” command:
… Adober Flex Builder 3/sdks/moxie/frameworks/projects/flash_integration/
Further instructions can be found here. There is a reported bug which I encountered. The swc still gets compiled and I have had some success getting it to work. This test example shows the green border that is Flash made with a mask for the inside. The green border contains an HBox and an accordian. You can see that the fonts are missing (probably related to system fonts with a mask) and the content inside is not scaling properly. The green border is scaling according to its Sclae9 grid set in Flash.

Recently I downloaded and installed Adobe Integrated Runtime (AIR) beta and Flex 3.0 beta from http://labs.adobe.com. Yesterday I discovered that AIR applications would not run. ONLY THEN did I read the AIR release notes which explicitly states that you should “uninstall the Apollo Alpha 1 before installing AIR Beta 1.” Instructions for OSX are:
To uninstall the runtime on Macintosh:
1. Delete the /Library/Frameworks/Adobe Apollo.framework directory.
2. Delete the /Library/Receipts/Adobe Apollo.pkg file.
3. Empty the Trash.
Then I reinstalled the AIR runtime and all is good