A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Flash memory

  1. #1
    Senior Member
    Join Date
    Mar 2010
    Posts
    107

    Flash memory

    Hi Flashers,

    Im creating a game, and its working out pretty well. I just encountered a little problem. I have a timer in my game which creates every 5 seconds an new instance of a class and adds it on the stage. No problem voor memory, but when I use bitmaps to be called on any 5 seconds, flash is slowing down more and more by every bitmap it shows more on the stage.

    I can't re-use or delete the bitmaps. What can I do to make it not slow down? I'm out of options.

    Thanks.

  2. #2
    Junior Member
    Join Date
    Aug 2012
    Posts
    6
    I mushrambo, you should use the function dispose to clear the bitmap from memory when you dont need it anymore..
    exemple :
    bitmaptodelete.bitmapdata.dispose();

  3. #3
    Senior Member
    Join Date
    Mar 2010
    Posts
    107
    Thanks for your answer!

    It works fine, however it doesnt solve my problem. I disposed my bitmap images and also removed my sprites when I don't need them anymore (atleast I think I did) but still, after a short while playing the game, it lags, everytime a little bit more and more. I let objects come with a certain timer. When the score reached several points, the timer decreases so the objects which will be generated newly incrased aswell. The memory peak is 15.000 kb, so I guess that is OK. I don't know how to optimize my code further!

  4. #4
    Junior Member
    Join Date
    Aug 2012
    Posts
    6
    hey mushrambo,
    if the sprites have any listeners attatched to it It can cause lag too.

    anyways its hard to guess whats wrong without seeing the code, can you post it? or send it to my email josuemota@gmail.com (just the part with the problem)

  5. #5
    Junior Member
    Join Date
    Aug 2012
    Posts
    6
    hey mushrambo,
    if the sprites have any listeners attatched to it It can cause lag too.

    anyways its hard to guess whats wrong without seeing the code, can you post it? (just the part with the problem)

  6. #6
    Senior Member
    Join Date
    Mar 2010
    Posts
    107
    Hi spacemonkey,

    Thanks for your time, but I fixed it myself. I forgot about an array filling itself and I never deleted it.

    Thanks!

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