これはできますか?
stage.addEventListener(TouchEvent.TOUCH_END, finish);
private function new(e:TouchEvent):void {
function finish(e:TouchEvent):void {
}
}
ありがとう
これはできますか?
stage.addEventListener(TouchEvent.TOUCH_END, finish);
private function new(e:TouchEvent):void {
function finish(e:TouchEvent):void {
}
}
ありがとう
まず、strille は正しく、finish() 関数は new() 関数の外にある必要があります。転送したい変数は、オブジェクトのプロパティに格納でき、finish() 関数内でそれらを参照できます。また、Actionscript 3 ではすでに意味があるため、関数に「新しい」という名前を付けることは敢えてしません。
private function newTouch(e:TouchEvent):void {
touchedAtX=e.localX;
touchedAtY=e.localY;
// store more if you want to
}
private function finish(e:TouchEvent):void {
// here you can use your touchedAtX and touchedAtY stored values,
// as well as anything else
}
いいえ、内側のfinish()関数は、外側のnew()関数の外側では使用できません/表示されません。問題は、finish()をnew()で定義する必要があり、その外部に常駐できないのはなぜですか?
private function new(e:TouchEvent):void {
finish(e);
}
private function finish(e:TouchEvent):void {
}