Home > Flash development > AS3 Custom Video Controller

AS3 Custom Video Controller

July 26th, 2007 Randy

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.
Categories: Flash development Tags:
  1. August 16th, 2007 at 14:40 | #1

    hi Randy,
    on your last point, you’ve probably found out by now that you can use the .client property of NS and NC to catch these ‘events’.

    Stefan

  2. August 16th, 2007 at 21:10 | #2

    Stefan, you are correct. Still took a bit of fussing to get it to work. How reliable are these events?

Comments are closed.