код АС3 работает, а haXe нет(не вращается box) ((((
в чем грабли?
не флешере не ответили :(
АС3 - работает, крутится, все гуд:
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
private var box:MovieClip;
private function draw():void {
with (box.graphics) {
beginFill(0xffff00);
lineStyle(3, 0x000000, 1);
drawRect( -100, -100, 200, 200);
endFill();
}
}
private function RotateBox(e:Event):void {
box.rotationX++;
box.rotationY++;
box.rotationZ++;
}
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
box = new MovieClip();
draw();
stage.addChild(box);
box.x = stage.stageWidth / 2;
box.y = stage.stageHeight / 2;
addEventListener(Event.ENTER_FRAME, RotateBox);
}
}
}
haXe, box стоит как вкопаный, хотя RotateBox() точно вызывается.
package ;
import flash.display.MovieClip;
import flash.events.Event;
import flash.Lib;
class Main
{
private var box:MovieClip;
private function draw():Void {
box.graphics.beginFill(0xffff00);
box.graphics.lineStyle(3, 0x000000, 1);
box.graphics.drawRect( -100, -100, 200, 200);
box.graphics.endFill();
}
private function RotateBox(e:Event):Void {
box.rotationX++;
box.rotationY++;
box.rotationZ++;
}
public function new():Void {
box = new MovieClip();
draw();
Lib.current.addChild(box);
box.x = Lib.current.stage.stageWidth / 2;
box.y = Lib.current.stage.stageHeight / 2;
Lib.current.addEventListener(Event.ENTER_FRAME, RotateBox);
}
static function main()
{
new Main();
}
}
-> fp10 )
похоже всё очень просто.
не знаю как вы собираете проект - из FD или иначе, но видимо что у вас он компилируется под версию меньше 10, а свойства rotationX и т.д. появились только в десятке.
я просто выбрал в свойствах проекта в FlashDevelop компиляцию для версии 10 и box послушно вращается как и ожидалось )
Ну а если собираете из под командной строки: -swf-version 10
СПАСИБО.
СПАСИБО.
действительно все было очень просто