Accessibility

Table of Contents

Exploring a unified component workflow between Flex and Flash

Creating the Flash application

I should preface this description by explaining that this workflow is the result of what I learned by doing this project. Without having a nifty article like this one at my disposal, I did not know exactly how to begin the project. I began with what I assumed was the first step: getting the application to work in Flash as a stand-alone Flash SWF file. And that's exactly what I did. I spent a couple of days working on the code and integrating my designer's assets. I'll call this Version 1.

At the end of Version 1, I had a Flash application with all my symbols. The app had a document class called Player and each MovieClip symbol in the library was linked to a class file (for example, the progress bar movie clip was linked to a ProgressBar class file). Because of how I've come to work with Flash since the addition of ActionScript 3.0, the Stage and Timeline were completely empty—the Player document class instantiated all display objects through code. Instantiating all visual elements gave me a lot of flexibility.

Because this player had to be flexible, I wanted the discretion of adding and removing visual elements at runtime. For example, if the player receives an XML playlist without a <title> node, I do not need to attach the title bar—which means that the video display window has more room to expand. If the playlist XML has no <link> node, I do not need to add a link button—which means the other controls in the control bar can be positioned differently. In short, instantiating all visual elements through code, rather than directly on the Timeline, gave me a lot more control over the rendering and performance of the video player. My player looked something like Figure 4.

Initial Flash video player

Figure 4. Initial Flash video player

The specific code I used is irrelevant to this topic—since the goal is to build a workflow that works for any Flash CS3 application. However, the basic structure of my app does matter a fair bit, as you'll see next.

Building the video player to work as a regular Flash application was just the first step. I proceeded next by making the project publishable as a Flex component. I'd already authored Flex components in Flash, and the process was pretty familiar.