Author Topic: "Graphics.clear" for FlxSprites  (Read 2168 times)

IQAndreas

  • Member
  • **
  • Posts: 35
  • Karma: +0/-0
    • View Profile
    • IQAndreas.com
"Graphics.clear" for FlxSprites
« on: Tue, Dec 20, 2011 »
What is the FlxSprite equivalent for Graphics.clear? For instance if you have drawn a square using "makeGraphics", how would I reset that line?

I read in another post someone using "flxSprite.fill(0x00000000)", but will that even reset the size of the sprite to the way it was before?


What about for loaded graphics, how are they best cleared without resetting the position, visibility, and existence of a FlxSprite?

auriplane

  • Snails!!
  • Contributor
  • ****
  • Posts: 497
  • Karma: +1/-0
  • Snails!!
    • View Profile
Re: "Graphics.clear" for FlxSprites
« Reply #1 on: Wed, Dec 21, 2011 »
I don't know.

But I'd guess that makeGraphic() with 0 width and height would throw out the internal _pixels and replace it with an empty one, essentially doing what you want.  You can check if this is, in fact, true!

pixelomatic

  • Active Member
  • ***
  • Posts: 131
  • Karma: +0/-0
    • View Profile
Re: "Graphics.clear" for FlxSprites
« Reply #2 on: Thu, Dec 22, 2011 »
You can access the current animation frame using framePixels. This is a bitmapData object.