How to make two buttons do different movements in flash?
I am creating flash android game with as3. I created two buttons on stage with which I want to make my object move. With first button (left) I want that object would move to left and with other button (right) to right.
The problem is when I test it, output from trace shows just left pressed and left released, even thought I am pressing both buttons. Here is my code as far as I done it:
import flash.events.Event;
import flash.events.MouseEvent;
stage.addEventListener(MouseEvent.MOUSE_DOWN, down);
stage.addEventListener(MouseEvent.MOUSE_UP, rel);
function down(e:MouseEvent😞void{
if (left) {
trace("left pressed");
} else if (right) {
trace("right pressed");
}
}
function rel(e:MouseEvent😞void{
if (left) {
trace("left released");
}else if (right) {
trace("right released");
}
}
Thanks for any help!!!