List Info

Thread: flash9 Graphics prototype extending




flash9 Graphics prototype extending
user name
2007-02-27 10:03:14
hello,

i'm new to haxe and i'm stuck with this problem: i need to
add some
methods to DisplayObject.Graphics prototype, so it is
available in all
instances. in AS3 i can do this:

flash.display.Graphics.dashTo = function(...) {...}

but it doesn't work in Haxe. how could i do it?

Boris




-- 
haXe - an open source web programming language
http://haxe.org

Re: flash9 Graphics prototype extending
user name
2007-02-27 11:56:03
I think you can use Reflect class:

Declare function:
function dashTo (...) { ... }

Associate with Graphics:
Reflect.setField( Graphics, 'dashTo', dashTo );

Note that the function doesn't need to have the same name of the field. You could declare de funtion inside the Reflect.setField method.

On 2/27/07, Boris Bartsyts < bartzitzgmail.com">bartzitzgmail.com> wrote:
hello,

i'm new to haxe and i'm stuck with this problem: i need to add some
methods to DisplayObject.Graphics prototype, so it is available in all
instances. in AS3 i can do this:

flash.display.Graphics.dashTo = function(...) {...}

but it doesn't work in Haxe. how could i do it?

Boris




--
haXe - an open source web programming language
http://haxe.org

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )