Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to reduce memory usage when loading bitmaps from the library?

Guest
May 24, 2013 May 24, 2013

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?

TOPICS
ActionScript
903
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 24, 2013 May 24, 2013

you can do the same with movieclips: create a bitmapdata instance and use the draw() method to overlay as many as needed.

Translate
Community Expert ,
May 24, 2013 May 24, 2013

add them to (or convert them to) movieclips and use attachMovie to dynamically add them.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 24, 2013 May 24, 2013

Unfortunately, I need to produce one flat image, so I have to combine different bitmaps  into one "on the fly".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 24, 2013 May 24, 2013

you can do the same with movieclips: create a bitmapdata instance and use the draw() method to overlay as many as needed.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 25, 2013 May 25, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 25, 2013 May 25, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 25, 2013 May 25, 2013

Got it, thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 25, 2013 May 25, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines