Monthly Archives: July 2005

IFBIN – The ‘Hello World’ Case Study


While developing IFBIN – Flash by Example, authors provided a ‘Hello World’ example as a showcase of their perspective on the age old example. In every case, I learned something new from these examples.&

There are literally thousands of ways to solve a particular problem. None of them are right or wrong, they are all just different. The ‘Hello World’ case study really changed my perspective on the product we were developing. When you ask 20 or so top quality developers for ‘Hello World’ examples you get some strange emails in return. I know many on the team thought I was crazy but I wanted to see a common problem solved from independent perspectives. The end result continues to amaze me.

The real difference for me came when I was reviewing the examples for approval. I was really shocked to see such varied perspectives on Flash and to find so many different valid techniques for authoring SWF content. It was as if I was allowed to peer over the shoulder of another developer and see how they work. In every case I walked away looking at Flash differently and adding another tool into my solution set. I thought we were making something great, but this altered perspective really drove the value home.

Then Jon Williams posted his ‘Hello World’ example. Here is the SWF file:

I have yet to see anything so cool as this example. The math and drawing API driven ToolTip class is simply amazing. The code for this is about 3 pages of rock solid hard core AS. Is it any wonder Jon created one of the first frameworks for Flash development, IOLib? I expected allot of things but having this arrive was a real wake-up call as to the core value of the Flash by Example product. Jon, thanks for this fantastic example!

I just enabled the Hello World examples as free content in IFBIN – Flash by Example. Download the IFBIN Service and install these examples for free. Make sure to set aside some time to review these examples, you will be surprised just how much Flash you will learn in a short period of time. I thought I knew allot about Flash but it seems that I still have allot to learn.

Regards,

Ted Patrick

IFBIN Begins – New Company and New Products


I started a new company 8 months ago and partnered with the best developers in Flash® and Flex® to create a new class of product. IFBIN is about great software examples and great developers. IFBIN Begins…&

http://www.ifbin.com

IFBIN is a code distribution service that provides example software for learning and reuse. It is a desktop application that provides secure access to an ever growing library of software for use in Macromedia® Flash® and Flex®. The examples within the products range from small usage examples to large development frameworks and servers to complete applications.

I would like to thank everyone who has made IFBIN happen. It is a great honor for me to work with such great partners on a project of this scale. To all of our author partners your support has been invaluable and I look forward to working with you on this marathon of a project. Also special thanks to Macromedia® for the internal support needed to make IFBIN happen. On so many levels Macromedia® has really made a profound difference in this project.

Many many examples to go! :)

Enjoy,

Theodore Patrick
IFBIN Founder and CEO

Flash Player Mental Model – The Elastic Racetrack


Having worked with Flash since FutureSplash, I have come to some conclusions about how to think about the player during development. Welcome to the elastic racetrack.&

I think about the Flash Player as a racetrack. There are 2 distinct sections of the racetrack, one for executing ActionScript (subsection for event processing) and one for rendering content to screen. While running, the Flash Player loops around this racetrack at a preset speed designated as FPS in the SWF file. At all times the player will attempt to maintain the speed set regardless of what the player is asked to do. The designated FPS is the maximum speed of the racetrack and processing can never go faster than this limit but can go slower.

Player Racetrack

A SWF file tells the player to do certain things at certain times. As the player processes these instructions, the racetrack is stretched in either the ActionScript section or the Rendering section or both. If you are processing lots of data or rendering lots of clips, either half expands to process everything you add in a single loop of the track. The player will not skip over anything that it is asked to do and will always attempt to finish a loop in the least amount of time possible but never faster than the designated FPS.

ActionScript Heavy

Graphics Heavy

ActionScript and Graphics Heavy

There are several additional aspects that compound this model. First off, the player structures graphical elements into a descending tree. Starting at the base node(_leve0), there can be many branches each with frame content and sub nodes/timelines. With every loop of the player all of the elements on the tree must be processed. In the current F7 player, frame content is swept and processed in depth order as needed from the _level0 node. In terms of graphical performance, the key is to keep the tree shallow combined with making elements as simple as they need to be. The fewer items in the tree and the shallower the tree, the faster the graphics will render.

The tree structure also applies to ActionScript bytecode processing. In the AS phase, the tree is swept for bytecode given the tree’s current state. Should any events be designated they will be processed in depth order. ActionScript is stack based and thus all bytecode is pushed onto the stack and processed in a linear fashion down the tree. Depending on the volume of code and events on a given frame, the AS portion of the racetrack elongates. As there is no build-in way to defer code execution, the player will process everything that it is asked to process in a given frame loop. It is interesting to note that even code that uses functions and events can be sequenced into a long line of bytecode to be processed. In a sense the player is never lossless, it will always do all the work you ask of it and never defer to a later frame cycle. The key is to never ask the player to do too much on a given frame and to be able to defer logic and events to later frames optionally.

As for Flash 8, from the looks of the beta player, cacheAsBitmap allows the graphics renderer to cache a MovieClip branch as a Bitmap. In caching vector graphics to an to a Bitmap, the renderer does not need to rerender until the graphics have changed (dirty). Ideally this allows the player to focus rendering on different areas of the player and specialize how the vector renderer is utilized. In a tree based rendering model, assuming some branches of the tree are set to branch.cacheAsBitmap=true, the renderer will create a Bitmap on the first pass and reuse this Bitmap until the vector graphicis of this area are marked as dirty. In the same light, if the cacheAsBitmap branch is dirty every frame(animated), you have forced the player to generate a Bitmap (processing + memory) with every frame cycle. In my testing, optimizing using cacheAsBitmap is not as straightforward as it seems.

In summary, the player performance is a combination of 2 distinctly different elements, graphics processing and ActionScript bytecode processing. If you abuse one or both of these aspects the player will slow down to make sure everything is completed before the next cycle. In development of larger projects, the elastic racetrack has helped me explain the logic behind many seemingly strange performance optimizations for Flex and Flash development.

As it has been said many times before, “Just wait a frame!” :)

Cheers,

ted ;)

Moving to Ankara, Turkey – Packout


Rebecca and I are moving to Ankara, Turkey for 3 years. The movers arrived this morning to pack all our belonging in advance of our departure. I knew this was coming but it feels real now.&

Our bags are ready and movers have been packing boxes for shipping all day long. The office is ready to go, the documents are sorted, and I have a big announcement coming this week with the new company. The new office in Ankara got Internet access yesterday and almost everything is ready for our arrival on August 11th. All of our stuff will arrive in Baltimore, MD tomorrow where it will be packed into a container headed for Istanbul by ship. The car goes later this week heading for Turkey.

I am going to miss DC allot, I had a great time here and made some lifelong friends. Darron, Chafic, D.Wolf, and C.Cantrell special thanks for all the Flash/Flex lunches, I will especially miss the technical talks. Those lunches/dinners were far better than any conference I have attended. I learned allot, thanks guys!

So the new business and products are shaping up nicely and initial reviews are looking very favorable. I cannot wait to show you what the team has been working on for the past 6 months. Having the opportunity to work with a team of this quality alone has been an honor. In 3 days time, you will know what I am talking about. There is nothing like a great example! :)

More to come.

Ted ;)

Flash "The Ocho" Install Process


Did anyone else catch the beta installation process? It used the Flash installer technology to upgrade the player within itself. This is a really big deal!&

It looks like for the first time in Flash history, we are going to see the existing 6 & 7 generations players install the Flash 8 player directly. Starting with Flash Player 6, Macromedia included a cross browser/cross platform installation technology with a light ActionScript API in System.product. This API was used to install Central and Breeze to the local machine securely. This process has been battle tested with Central and Breeze and now this technology is turning towards the Flash Player itself.

The question lurking in my mind is how much faster are we going to get to 80% installed? If I had to guess, I believe that combined with player to player installation and the previewed feature set, we could cross 80% in 6 months.

I am really fired up about “The Ocho”!

Cheers,

ted ;)

Kinetic Fusion 3.0 Beta 6 – Flex-like XML/SWF Development


I have been a huge fan of Alex Bradley’s work on KineticFusion. This round trip SWF to XML compiler/decompiler is an amazing product and keeps getting better. Version 3 is worth a deeper look. Actually with this release the product makes the leap to a productive XML development tool. Prior to this the XML was very verbose and supported the entire low level SWF format. With version 3 you can create higher level XML with event support and MXML like functionality.

http://www.kinesissoftware.com/index.php

Nice work Alex, KF has come a long way!

Cheers,

Ted :)