Topic: touchscreen
in actionscript is there a way to read where you touch the screen and a character will respond?
You are not logged in. Please login or register.
chumbysphere forum → Flash/Widget → touchscreen
in actionscript is there a way to read where you touch the screen and a character will respond?
Sure - the touchscreen is treated the same as the mouse on your computer, except that it doesn't support "over" events (since we can't track your finger when it's *not* touching the screen).
That means you can use 'onPress' and 'onRelease' handlers on a MovieClip to react to the touchscreen.
Let's take a simple case - a MovieClip with two frames - you want the first frame to show when it's *not* pressed, and the second frame to show when it's pressed.
The first frame would have something like this:
stop();
this.onPress = function() {
this.gotoAndStop(2);
}
this.onRelease = this.onReleaseOutside = function() {
this.gotoAndStop(1);
}
The "onReleaseOutside" covers the case where you press on the MovieClip, but drag your finger off the clip and lift up somewhere else.
This is pretty basic Actionscript programming, so there are lots of tutorials, books, and examples out there.
chumbysphere forum → Flash/Widget → touchscreen
Powered by PunBB, supported by Informer Technologies, Inc.