Волгоградец
20.08.2008, 16:13
Привет еще раз. Помогите понять вот что:
private function init(e:Event):void{
e.target.addEventListener(MouseEvent.MOUSE_DOWN, startTest);
}
private function startTest(e:MouseEvent):void{
trace (e.target is Sprite);//true
test(e.target);//ошибка: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:Sprite.
test2(e.target);//работает
}
private function test(mc:Sprite):void{
mc.x += 50;
}
private function test2(mc:Object):void{
mc.x += 50;
}
Почему эта ошибка?
private function init(e:Event):void{
e.target.addEventListener(MouseEvent.MOUSE_DOWN, startTest);
}
private function startTest(e:MouseEvent):void{
trace (e.target is Sprite);//true
test(e.target);//ошибка: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:Sprite.
test2(e.target);//работает
}
private function test(mc:Sprite):void{
mc.x += 50;
}
private function test2(mc:Object):void{
mc.x += 50;
}
Почему эта ошибка?