Copy link to clipboard
Copied
When I use BitmapData.loadBitmap() to load an image from the library and then attachBitmap() to add it to a MovieClip it takes a lot more memory as opposed to just having the same image inside a MovieClip statically in a frame on it's timeline.
The function dispose() not only clears the BitmapData object but also destroys the previously attached bitmap inside the MovieClip, so it can not be used to free any memory.
Is it how it is supposed to be or is there any other way to dynamically attach bitmaps with memory usage comparable to just having them on stage?
you can do the same with movieclips: create a bitmapdata instance and use the draw() method to overlay as many as needed.
Copy link to clipboard
Copied
add them to (or convert them to) movieclips and use attachMovie to dynamically add them.
Copy link to clipboard
Copied
Unfortunately, I need to produce one flat image, so I have to combine different bitmaps into one "on the fly".
Copy link to clipboard
Copied
you can do the same with movieclips: create a bitmapdata instance and use the draw() method to overlay as many as needed.
Copy link to clipboard
Copied
What do you mean? BitmapData.loadBitmap() doesn't work with MovieClips, and if I use draw I need to create an instance of a MovieClip to be drawn on stage first.
Copy link to clipboard
Copied
no, you use attachMovie() to create instance from library movieclips that have a linkage id.
you can then create a bitmapdata instance and use the draw() method to overlay as many as needed.
Copy link to clipboard
Copied
Got it, thanks!
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now