I tried something similar to Aral. I have two questions:
1. Is this the intended way to create a entry point?
2. Shouldn't the assignment of enterFrame automatically create a
delegate? Doesn't seem to be the case right now, because i is unknown
inside onEnterFrame.
Here is the code:
class MyFirstHaxe
{
private var i:Int;
public function new(){
i = 0;
//Boot.current.i = 0;
Boot.current.createTextField("tf", 0, 0, 0, Stage.width,
Stage.height);
Boot.current.onEnterFrame = onEnterFrame;
}
private function onEnterFrame(){
Boot.current.tf.text = "Wow, it's frame: " + i++;
}
private static var instance:MyFirstHaxe = new MyFirstHaxe();
}
Cheers,
Ralf.
Nicolas Cannasse wrote:
> Aral Balkan wrote:
>
>>Hey man,
>>
>>Cool stuff! Any idea why I'm getting the following error:
>>"Field onEnterFrame have different access right than previous one"
>>
>>AFAICS, the methods have the overloaded methods have the same access
>>rights. A trace for "this" returns "_level0" so I would expect it to
>>compile.
>>
>>With:
>>
>>class Counter extends MovieClip
>>{
>> var i:Int;
>> var tf:TextField;
>>
>> function onEnterFrame ():Void
>> {
>> tf.text = "Wow, it's frame: " + (i++);
>> }
>>
>> function onLoad():Void
>> {
>> this.createTextField("tf",0,0,0,Stage.width,Stage.height);
>> }
>>}
>
>
> MovieClip is declared as an "extern" so all its fields are public by
> default. For normal classes, haXe default access is "private", so you
> only need to tell "public function onEnterFrame" and same for onLoad.
>
> Nicolas
>
> _______________________________________________
> osflash mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/osflash_osflash.org
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org