PDA

View Full Version : Incorrect reference type



tpann
November 8th, 2007, 12:40 PM
For the following class snippet:



private var ali:Loader;

public function MyClass():void {
ali = new Loader();
addChild(ali);
ali.load(new URLRequest("images/ali.swf"));

...
ali.addEventListener(MouseEvent.MOUSE_DOWN, moveAli);
}

private function moveAli() {
ali.startDrag();
}


I get the error "1061: Call to a possibly undefined method startDrag through a reference with static type flash.display:Loader."

I get that I can't drag a Loader object. But I need to be able to. What's the solution here?

Thanks!

senocular
November 8th, 2007, 12:42 PM
place it inside of something that can be dragged, like a sprite. Either that or handle dragging on your own using the ENTER_FRAME event