Undefined Function !?
Hello everyone !
First I'll give the code I am having the problem about :
import flash.events.MouseEvent; stop() start_btn.addEventListener(MouseEvent.CLICK, startclicked); function startclicked(e:MouseEvent):void { gotoAndStop(10) } object1.addEventListener(MouseEvent.MOUSE_OVER, overobject1) object2.addEventListener(MouseEvent.MOUSE_OVER, overobject2) object3.addEventListener(MouseEvent.MOUSE_OVER, overobject3) function overobject1(e:MouseEvent):void { moveobject1(); } function overobject2(e:MouseEvent):void { moveobject2(); } function overobject3(e:MouseEvent):void { moveobject3(); } this.stage.addEventListener(Event.ENTER_FRAME, moveMyObjects); function moveMyObjects(event:Event):void { function moveobject1() { object1.x -= (object1.x - mouseX) / 3; object1.y -= (object1.y - mouseY) / 3; } function moveobject2() { object2.x -= (object2.x - mouseX) / 3; object2.y -= (object2.y - mouseY) / 3; } function moveobject3() { object3.x -= (object3.x - mouseX) / 3; object3.y -= (object3.y - mouseY) / 3; } }
The idea is so when I move my mouse over any of these objects they start to follow the pointer.
I get these errors below :
Scene 1, Layer 'Actions', Frame 1, Line 14 1180: Call to a possibly undefined method moveobject1.
Scene 1, Layer 'Actions', Frame 1, Line 17 1180: Call to a possibly undefined method moveobject2.
Scene 1, Layer 'Actions', Frame 1, Line 20 1180: Call to a possibly undefined method moveobject3.
Haven't I defined the methods in moveMyObjects function ?
Can anyone help me to achieve the idea this way (with the corrected code) or an other way ( maybe using an array
)
Thanks in advance.