1120: Access of undefined property
Hi, I need a solution for my script for school assignment.
This is my codes:
stop();
var kanan:Boolean = false;
var kiri:Boolean = false;
var jumlah:int = 0;
var n=0;
var t=3;
kalah.visible = false;
mulai.addEventListener(MouseEvent.CLICK, mulaimain);
function mulaimain(event:MouseEvent):void
{
kalah.visible = false;
mulai.visible = false;
home.visible = false;
n=0; score.text=String(n);
t=3; lives.text=String(t);
stage.addEventListener (KeyboardEvent.KEY_DOWN, tekantombol);
stage.addEventListener (KeyboardEvent.KEY_UP, lepastombol);
cacto.addEventListener(Event.ENTER_FRAME,jalan);
taco.addEventListener(Event.ENTER_FRAME,jatuh);
heart.addEventListener(Event.ENTER_FRAME,jatuhhati);
function tekantombol (event:KeyboardEvent):void
{
switch (event.keyCode)
{
case Keyboard.RIGHT :{kanan = true;break;}
case Keyboard.LEFT :{kiri = true;break;}
}
}
function lepastombol (event:KeyboardEvent):void
{
cacto.gotoAndPlay(1);
switch (event.keyCode)
{
case Keyboard.RIGHT :{kanan = false; jumlah=0;break;}
case Keyboard.LEFT :{kiri = false; jumlah=0;break;}
}
}
function jalan (event:Event) :void
{
cacto.x+=jumlah;
if (kanan){cacto.gotoAndStop(3); jumlah=11;}
if (kiri){cacto.gotoAndStop(2); jumlah=-11;}
if (cacto.x>=997){cacto.x=-10;}
if (cacto.x<=-37){cacto.x=977;}
}
function jatuh(event:Event):void
{
taco.y+=7;
if(taco.y>=390)
{
t=t-1;lives.text=String(t);
taco.y=-2;
taco.x=Math.floor(Math.random()*800);
}
if(taco.hitTestObject(cacto))
{
n=n+1;score.text=String(n);
taco.y=-2;
taco.x=Math.floor(Math.random()*800);
}
if(t==0)
{
cacto.removeEventListener (Event.ENTER_FRAME,jalan);
taco.removeEventListener (Event.ENTER_FRAME,jatuh);
kalah.visible = true;
mulai.visible = true;
}
function jatuhhati(event:Event):void
{
heart.y+=12;
if(heart.y>=390)
{
heart.y=-30;
heart.x=Math.floor(Math.random()*800);
}
if(heart.hitTestObject(cacto))
{
t=t+1;lives.text=String(t);
heart.y=-30;
heart.x=Math.floor(Math.random()*800);
}
}
}
}
| Scene 1, Layer 'Actions', Frame 1, Line 26 | 1120: Access of undefined property jatuhhati. |
and this Output:
ReferenceError: Error #1065: Variable TCMText is not defined.
Can somebody help me?
