I'm creating an Android game using Adobe Animate CC for our thesis, and every time I test my work, at first, it works fine, but when I go to the main game, there's an error appears:
Error #1010: A term is undefined and has no properties at RECOVER_RECOVER_dmthesis_demo_ver__paggumanarename_Scene14_fla::MainTimeline/frame1()[RECOVER_RECOVER_dmthesis_demo_ver__paggumanarename_Scene14_fla.MainTimeline::frame1:160]
And this is my code (including commented code):
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;
import flash.utils.Timer;
gril.gotoAndStop('a');
var gril:MovieClip = new MovieClip;
var linya:MovieClip = new MovieClip;
var timer:MovieClip = new MovieClip;
var scorer:MovieClip = new MovieClip;
var xDistance:Number
var yDistance:Number
var fl_SecondsToCountDown:Number = 5;
var fl_CountDownTimerInstance:Timer = new Timer(1000, fl_SecondsToCountDown);
var vx:Number = 5;
var vy:Number = 5;
var bg:MovieClip = new MovieClip;
var bg2:MovieClip = new MovieClip;
var qnaWin:MovieClip = new MovieClip;
var corekWin:MovieClip = new MovieClip;
var maliWin:MovieClip = new MovieClip;
var gameOverWin:MovieClip = new MovieClip;
//var btnPause:Button = new Button;
//var forward:Button = new Button;
bg.visible = true;
bg2.visible = false;
gril.visible = true;
linya.visible = true;
btnPause.visible = true;
pauseWin.visible = false;
qnaWin.visible = false;
corekWin.visible = false;
maliWin.visible = false;
scorer.visible = false;
timer.visible = false;
forward.visible = true;
gameOverWin.visible = false;
//var rightpressed:Boolean = new Boolean(false);
//var leftPressed:Boolean = new Boolean(false);
//var linkspeed:Number = 10;
//var contactApak: Boolean =false;
/*else if(keyEvent.keyCode == Keyboard.LEFT){
leftpressed = true;
}*/
//forward.enabled = true;
forward.addEventListener(MouseEvent.CLICK, myClickReaction);
// speeds ALONG NYPOTENUSE
function myClickReaction (e:MouseEvent):void {
vx = mouseX - gril.x;
vy = mouseY - gril.y;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
gril.x+=10;
gril.gotoAndStop('i');
}
/*stage.addEventListener(MouseEvent.CLICK, keyDownHandler);
function keyDownHandler(event:MouseEvent):void{
if(event == Keyboard.RIGHT){
rightpressed = true;
}
}*/
function onEnterFrame(event:Event):void {
//mc increments by 5 until it reaches mouse - mc (ie the distance)
gril.x += vx;
gril.y += vy;
xDistance = Math.abs(mouseX - gril.x);
yDistance = Math.abs(mouseY - gril.y);
trace (xDistance)
if (xDistance == 0 ) {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
/*forward.addEventListener(MouseEvent.CLICK, lakad);
function lakad(event:MouseEvent):void{
if(event.keyCode == Keyboard.RIGHT){
rightpressed = false;
gril.gotoAndStop('a');
}
}*/
/*else if(keyEvent.keyCode == Keyboard.LEFT){
leftpressed = false;
mcgril.gotoAndStop("Stand Left Frame");
}*/
/*stage.addEventListener(Event.ENTER_FRAME, gameLoopi);
forward.addEventListener(MouseEvent.CLICK, gameLoopi);
function gameLoopi(e:Event):void{
gril.x+=10;
gril.gotoAndStop('i');
}*/
/*else if(leftpressed){
linkMC.x-=linkspeed;
linkMC.gotoAndStop("Walk Left Frame);
}*/
if(linya.hitTestObject(gril)){
qnaWin.visible = true;
}
/*if(apak.hitTestPoint(mcgril.x,mcgril.y+15,true)){
contactApak=true;
}
else{
contactApak=false;
}}*/
//btnPause.enabled = true;
btnPause.addEventListener(MouseEvent.CLICK, pois);
function pois(event:MouseEvent):void{
stage.frameRate = 0;
bg.visible = true;
bg2.visible = false;
gril.visible = false;
linya.visible = false;
btnPause.visible = false;
pauseWin.visible = true;
qnaWin.visible = false;
corekWin.visible = false;
maliWin.visible = false;
scorer.visible = false;
timer.visible = false;
forward.visible = false;
gameOverWin.visible = false;
}
pauseWin.btnResume.addEventListener(MouseEvent.CLICK, gorau);
function gorau(event:MouseEvent):void{
bg.visible = true;
bg2.visible = false;
gril.visible = true;
linya.visible = true;
btnPause.visible = true;
pauseWin.visible = false;
qnaWin.visible = false;
corekWin.visible = false;
maliWin.visible = false;
scorer.visible = false;
timer.visible = false;
forward.visible = true;
gameOverWin.visible = false;
}
pauseWin.btnQtm.addEventListener(MouseEvent.CLICK, kweet);
function kweet(event:MouseEvent):void{
gotoAndStop(1, "Scene 1");
}
/*var objectoriginalX:Number;
var objectoriginalY:Number;*/
**corekWin.btnGo.addEventListener(MouseEvent.CLICK, gorabelx);**//this is in the line 160, the main problem
function gorabelx(event:MouseEvent):void{
bg2.visible = true;
bg.visible = false;
//mcbackground.room.pinto(scaleY =-1);
}
//timer.timee.text=fl_SecondsToCountDown.toString();
fl_CountDownTimerInstance.start();
fl_CountDownTimerInstance.addEventListener(TimerEvent.TIMER, foo);
function foo(event:TimerEvent):void
{
fl_SecondsToCountDown--;
timer.timee.text=fl_SecondsToCountDown.toString();
trace(fl_SecondsToCountDown + " seconds");
if(fl_SecondsToCountDown == 0){
gameOverWin.visible = true;
}
}
gameOverWin.btnTry.addEventListener(MouseEvent.CLICK, tryk);
function tryk(event:MouseEvent):void{
bg.visible = true;
bg2.visible = false;
gril.visible = true;
linya.visible = true;
btnPause.visible = true;
pauseWin.visible = false;
qnaWin.visible = false;
corekWin.visible = false;
maliWin.visible = false;
scorer.visible = false;
timer.visible = false;
forward.visible = true;
gameOverWin.visible = false;
}
Oops! My code is too long. I checked my code in many times and nothing is wrong, I also debug it and this kind of error still appears. I already declare the corekWin (the movieclip) but the btnGo (the another movieclip which enables to click) inside of corekWin doesn't need to declare it, right? Because the corekWin is already declared.
I'm trying to fix that error, and unfortunately, it fails. I have double-checked it. What do you think is the problem with this code?