views:

19

answers:

1

Hello, I"m new to AS3 and I would like to know how can I get to graphics of a Sprite so I could draw it directly from it. I mean I don"t want to use Sprite class as my concrete objects I just want Sprite to hold graphics so if my own object needs to be drawn it asks for graphics to SpriteManager which returns Sprite with required graphics and draws it exactly where I want to not where Sprite's coordinates points to.

Thank you for answer.

+1  A: 

I'm not sure I get what you want to do, but you can use a Shape object and draw on it like this

var s:Shape = new Shape();
s.graphics.beginFill( 0 );
s.graphics.drawCircle( 10, 10, 10 );
s.graphics.endFill();

It's just a basic object that acts as a drawing layer.

__dominic
Well I thought about something like you have an image (image that is loaded in that Sprite) and then you for example draw that image ten times in for loop on random position on the screen.
uther.lightbringer
maybe you should be using a BitmapData if all you need is something to hold some graphics over time. Because drawing lots of stuff on a sprite will end up killing the performance.
__dominic
Thank you that is probably what I was looking for.
uther.lightbringer