Question

Hopefully somebody can help me out here.

I'm working within an embedded ActionScript2 and FlashLite 3.0 environment (outside of a browser). The application I'm developing makes repeated use of movieclip containers that contain external images that are loaded into those movieclips using loadMovie. Putting the images into the library and using attachMovie is not an option, because the images can be uploaded by the user, and need to be loaded dynamically from outside Flash. The environment I'm working in is very constrained, and there is a noticeable performance hit to loading these external images using loadMovie repeatedly, when many of these movieclip containers are on the screen at once.

I'd like to have some way to load an external image into a movieclip container once, and then repeatedly use copies of that movieclip at various points in the application, which would eliminate the need to constantly be loading external images every time.

At first, I thought the answer would be fairly straightforward, using duplicateMovieClip, but unfortunately it looks like duplicateMovieClip does not duplicate any of the properties or child objects of the clip that's being duplicated. From what I can tell, each time you duplicate the clip, you need to load the external image again, which defeats the purpose of doing this in the first place.

I also looked into solutions dealing with AttachBitmap() and bitmap caching in general, but unfortunately, this is something Adobe doesn't seem to support in Flash Lite 3. (see "What features of Flash 8 does Flash Lite 3 not support?") http://www.adobe.com/uk/products/flashlite/faq/.

Does anyone have any experience dealing with a problem like this?

Edit: An example from Adobe nicely illustrates the situation. Notice the 2nd call to loadMovie after the duplicate:

this.createEmptyMovieClip("img_mc", this.getNextHighestDepth());
img_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/112x112/box_studio_112x112.jpg");
duplicateMovieClip(img_mc, "newImg_mc", this.getNextHighestDepth());
newImg_mc._x = 200;
newImg_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/112x112/box_studio_112x112.jpg");
Was it helpful?

Solution

Well, both BitmapData.draw and MovieClip.attachBitmap are supported by FlashLite 3.1.

Unfortunately if you can't utilize FlashLite 3.1 you will have to do multiple loads.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top