It's my first time using AS3, and I'm having a bit of trouble migrating from AS2. I've found some guides that have got me by so far, but I've got a weird error I can't seem to fix. It says "1046: Type was not found or was not a compile-time constant: TimerEvent." and this is the piece of code it is referring too:
var loadTimer:Timer=new Timer(5000);
loadTimer.addEventListener(TimerEvent.TIMER, timerListener);
function timerListener(e:TimerEvent):void {
Strange thing is, it works in a new flash document, but not the one I'm working on (with external AS files and that), but there's no reused variables/mismatches or anything like that, so I don't see what the problem is. Another one is trying to get a loaded image to centre, In AS2 I could just use something like:
_root.image._x=((stagewidth-image._width)/2)
but AS3 doesn't like it (with the new property names of course). I think it's because I had to create a bunch of different variables and objects to load the image. Tracing image.width just returns 0, I think because it's just a placeholder for the actual image. I tried creating another variable to get the image width from the server where the image is hosted, but it didn't work out too well. Any help would be great.