Timer not moving movieclip
Hello I have set up a timer in order to try to get char_mc to move when i hold in a button because i am making an ios app. I have this code
import flash.events.*;
import flash.utils.Timer;
import flash.display.MovieClip;
import flash.events.MouseEvent;
var movetimer:Timer = new Timer(50);
leftarrow.addEventListener(MouseEvent.MOUSE_DOWN, leftarrowfunctionDown);
leftarrow.addEventListener(MouseEvent.MOUSE_UP, leftarrowfunctionUp);
rightarrow.addEventListener(MouseEvent.MOUSE_DOWN, rightarrowfunctionDown);
rightarrow.addEventListener(MouseEvent.MOUSE_UP, rightarrowfunctionUp);
movetimer.addEventListener(TimerEvent.TIMER, leftarrowfunction);
movetimer.addEventListener(TimerEvent.TIMER, rightarrowfunction);
function leftarrowfunctionUp(e:MouseEvent):void
{
movetimer.stop();
}
function rightarrowfunctionUp(e:MouseEvent):void
{
movetimer.stop();
}
function leftarrowfunctionDown(e:MouseEvent):void
{
movetimer.start();
}
function rightarrowfunctionDown(e:MouseEvent):void
{
movetimer.start();
}
function leftarrowfunction(eventObject:Event):void
{
char_mc.x -=1
}
function rightarrowfunction(eventObject:Event):void
{
char_mc.x +=1
}
This should move my character one pixel every 50ms while im holding either the left or the right buttons but the character doesnt move at all. There are no errors. Any ideas? This code is on my actions layer.
