A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: BitmapData Question

  1. #1
    Senior Member
    Join Date
    Feb 2005
    Posts
    237

    BitmapData Question

    Once I have drawn from a loaded image to a BitmapData instance, is there any way of converting the BitmapData back to an image so that I can then dispose of the Bitmap?

    Thanks

  2. #2
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    the bitmap data stores the bitmap information and then you tell an empty movie clip to use the bitmap data object and it will display the image.
    ~calmchess~

  3. #3
    Senior Member
    Join Date
    Feb 2005
    Posts
    237
    Hi,

    I understand what attachBitmap does, but I'm running into memory problems.

    Instead of loading and displaying images using MovieClipLoader, I'm loading them then caching them as BitmapData instances so I can pass them into another class.

    My Problem is that attaching these to MCs to display them is causing a memory issue and slowing my swf down. (There are a lot of images and they are huge).

  4. #4
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    well there is your problem you have alot of information to write to the bitmapdata objects and then all that data has to be written to the movieclips .....do you know the rules to using images on the web or with any scripting language? i suggest you learn the rules to managing content on a webpage before you try to break the rules.
    ~calmchess~

  5. #5
    Senior Member
    Join Date
    Feb 2005
    Posts
    237
    Thanks for your rude and unhelpful reply.

    I'm perfectly aware of the potential problems and have done everything I can to manage them. I have a class which stacks requests for images so that only one image is loaded at a time. The problem is not with getting the images in, but seems to be with the amount of information stored locally once they are. Only one bitmap is written to at a time. Only 2 Mcs with Bitmaps attached are ever displayed at a time - any others are set to _visible(false). There is no memory lag until there are a lot of Bitmapdata instances in the memory.

    i suggest you learn the rules to managing content on a webpage before you try to break the rules.
    You make me sound awfully naughty. As far as I'm aware, what I'm doing is fairly common practice, and there are a number of engines around which allow the caching of Bitmaps for later use. I have used the engine I'm currently using many times without problem, but given the size of the Bitmap Data instances I'm using this time, I'm looking for a more efficient way of handling the situation.

  6. #6
    http://www.in3d.eu Kostas Zotos's Avatar
    Join Date
    Jul 2007
    Location
    Athens - Greece
    Posts
    408
    Hi,

    Maybe use the MyBitmapData.dispose();
    The command releases the resourses used by the specific BitmapData object.. (You cann't use that BitmapData after execute the dispose(), removes it permanently)

    Kostas
    K. Zotos online portfolio: http://www.in3d.eu

  7. #7
    Senior Member
    Join Date
    Feb 2005
    Posts
    237
    Hi Kostas,

    Yeah, was using that already, It actually turned out to be a result of having a large stack of MCs with BitmapDatas attached within which I was swapping depths. Changed the code to set any but the top 3 MCs to _visible = false and all my problems went away. Wierd as I wasn't using any transparency, but it worked.

  8. #8
    http://www.in3d.eu Kostas Zotos's Avatar
    Join Date
    Jul 2007
    Location
    Athens - Greece
    Posts
    408
    Fine! good news
    K. Zotos online portfolio: http://www.in3d.eu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center