I am new to AS3 and come from .net background
I can move an image with a mouse and use a class to load the image .
It works.
q1)how do i put this code in a game loop in .fla file as I need to move objects automatically? Do I use a timer or is there something better?
q2) How do I declare an event when the image from the class ClassImg2 has been loaded? I need to know this in the .fla file.
.fla file below
////
var li:ClassImg2= new ClassImg2("ladybug.png",120,120);
addChild(li);
stage.addEventListener(KeyboardEvent.KEY_DOWN,doSomething);
function doSomething(e:KeyboardEvent):void
{
if (e.keyCode==37) //39 is right arrow
{
trace("left pressed")
li.moveleft();
}
if (e.keyCode==39) //39 is right arrow
{
trace("right pressed")
li.moveright();
}
}