Saturday, June 16, 2007

File Import and Display


Importing image files from the local file system and populating the image file browser deserves a close inspection. Here the major interactions and collaborating classes are shown in static form along with collaborative details.

When openImageFile is invoked, the File Selection Dialog Box is opened. Once a file has been selected a private event handler, fileOpenSelected(event:FileEvent), is invoked this event handler calls getBitmapFromFile(imageFile:File, onOpenComplete:Function, suppressErrors:Boolean = false) for each image in the directory of the selected file.

For the user selected image onOpenComplete is set to a specific event handler which performs the opening of the image the user requested and submitting the corresponding event. This event is heard by the LightTable and the proper image is displayed in the MainCanvas. Next, fileOpenSelected cranks through every other open-able image in the directory, ignoring errors, and dispatches the "directoryImageFileLoaded" event for each successfully opened image. LightTable listens and adds each image in to the directoryImageViewer.

MainCanvas Structure and Interaction


The MainCanvas class contains viewingSurface, which masks currentImage. MainCanvas adds the current image as a child of viewingSurface. viewingSurface is a UIComponent which creates a mask sprite dynamically. This viewingSurface is what makes it possible to hide the contents of the image that would other wise spill out of the main canvas onto other parts of the screen. To add currentImage to viewingSurface, mainCanvas uses the inherited method UIComponent.addChild of the viewingSurface class. mainCanvas maintains a reference to currentImage and applies filter directly too current image. When getBitmap is invoked mainCanvas

Note: The way that the image data is retrieved by getBitmap is a bit tricky. The filters must stay on the image for the user’s changes to reach the saved file. For this reason it is necessary to create a new bitmap with the bitmapData of currentImage. Next this bitmap is added as a child to a new Sprite. We then reapply the filters to the new Bitmap. Now we have a sprite containing our filtered Bitmap. We must copy the BitmapData of a container containing our filtered bitmap. If we copy the BitmapData of the currentImage.

Friday, June 15, 2007

Adobe Bug Leaves us Stuck with no ASDocs

Unfortunately, Adobe's ASDoc documentation generator is crashing on the Flash SWC components that are embedded in the LightTable application. I am currently using the Flex Component Kit for Flash CS3. Maybe when I migrate to Adobe Flex Builder 3 this problem will be fixed. For now, we are stuck with no ASDoc's. Sorry guys.