Reputation: 1280
Can this be done ??
stage.addEventListener(TouchEvent.TOUCH_END, finish);
private function new(e:TouchEvent):void {
function finish(e:TouchEvent):void {
}
}
Thanks
Upvotes: 0
Views: 216
Reputation: 18747
First, strille is right, your finish() function should reside outside new() function. The variables you want to transfer can be stored in your object's properties, then you refer to them within your finish() function. Also, I wouldn't dare naming your function "new", as it already has a meaning in 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
}
Upvotes: 2
Reputation: 5781
No, the inner finish() function is not available/visible outside of the outer new() function. The question is why finish() needs to be defined in new(), and can't reside outside of it?
private function new(e:TouchEvent):void {
finish(e);
}
private function finish(e:TouchEvent):void {
}
Upvotes: 0