[haXe] Graphics and flash9

Baffo32 baffo32 at gmail.com
Fri Apr 6 01:32:08 CEST 2007


On 4/5/07, Gilles Maire <Gilles.Maire at ungi.net> wrote:
>
> But I can't make graphics by
>
> var clip = new flash.display.Graphics();


You're making graphics but they're not set to be appearing anywhere!  A
graphics object is normally a member of some object that inherits from
DisplayObject (such as a Sprite or a MovieClip) and needs to be used as part
of such -- and then this object must be added as a child object to some
DisplayObjectContainer on the stage in order to be visible.

Change that line with the following code:

var sprite = new flash.display.Sprite();
flash.Lib.current.addChild(sprite);
var clip = sprite.graphics;

// draw a filled square now and it should show up
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20070405/4ddec100/attachment.htm


More information about the Haxe mailing list