私は単純なシンボルを持っています
var button:graphic = new graphic();
button.x=250;
button.y=200;
addChild(button);
これを真ん中にしたい:
var posX:number = stage.width/2
var posY:number = stage.height/2
button.x=posX
button.y=posY
これは私の頭に浮かびました^しかし、実行すると次のエラーが表示されます:
1046: Type was not found or was not a compile-time constant: number. //for pos X
1046: Type was not found or was not a compile-time constant: number. //for pos Y
これが唯一の解決策だと思いますが、残念ながらこれは機能していません。プログラミング全体に慣れていないため、これらの行を間違って書いている可能性があります。
私の解決策を修正してください、または間違っている場合は正しいものを教えてください