2/14/2008 12:00:00 PM
by Stefan Kratz in Technology | Flex | RIA
Our Gallery for displaying and selecting graphical objects includes vector images as well as bitmap images. The vector images are SWF files containing the actual artwork. When one of our graphical designers began adding his artwork to the Gallery he simply imported the Illustrator files into Flas and published an SWF. We didn't bother settings the stage dimensions to fit the artwork, since we've learned from before that it's the content of the Flash that counts - not the actual stage dimensions.
This turned out to be a false assumption...
The thumbnail included an mx:Image that simply had its source property set to the SWF URL. When the Gallery thumbnails loaded the artwork, the whole area of the SWF stage was included. Since we obviously only wanted to show the actual artwork in the thumb this had to be fixed. Adjusting each file from within Flash would be too time consuming so we had to come up with something else. In the end we loaded the SWF files using a Loader, adding its content to a Sprite and finally setting the Sprite as the Image source. This meant that we had to fix loading effects, since the loading now took place in the Loader and not the Image. So, how come the Sprite doesn't include the whole stage area but the Loader does? I haven't figured that out just yet, but this is one way to get the desired result.
Tags: development, gui, adobe, flex builder