Skip to main content
Participating Frequently
April 21, 2024
Question

1120: Access of undefined property error AS3

  • April 21, 2024
  • 15 replies
  • 1451 views

Hi! I've been working on an interactive character animation for a school project and have been having some issues with it. I'm very new to Animate and was originally working with an HTML5 canvas. I was having issuses with some of my animations and music not playing, so my professor suggested I convert it to an ActrionScript3 file. That fixed those issues, but presented many more as I have to recode all of my animation.

 

The animation is a basic dress up game where the player can press start, click on an area to reveal a piece of clothing, click on the clothing to put it on the character, and then click a button that restarts the animation. I've been working with simple timeline animation, calling frames and frame labels to jump around, however when using code snippets to re-code my buttons I got an error saying, "1120: Acess of undefined property clothesRVL." My animation was working fine before I added an action to clothesRVL, and I suspect it's not working because I called a frame label and not a frame. I appreciate any help I could get with this as this is my final project and I'd like to get this working by tonight! I'll paste my current AS3 code and original Javascript code below:

 

JS Code ---

 

Frame 1:

 

var _this = this;

_this.stop();

var _this = this;

_this.Button2.on('click', function(){

_this.gotoAndStop(242);

});

 

var _this = this;

_this.blanketBTN.on('click', function(){

_this.gotoAndStop(251);

});

 

var _this = this;

_this.shirtBTN.on('click', function(){

_this.gotoAndStop(253);

});

 

var _this = this;

_this.clothesBTN.on('click', function(){

_this.gotoAndPlay('clothesRVL');

});

 

var _this = this;

_this.pantsBTN.on('click', function(){

_this.gotoAndStop(263);

});

 

var _this = this;

_this.drawerBTN.on('click', function(){

_this.gotoAndStop('drawer open');

});

 

var _this = this;

_this.socksBTN.on('click', function(){

_this.gotoAndStop('Socks On');

});

 

var _this = this;

_this.curtainBTN.on('click', function(){

_this.gotoAndStop('shoesRVL');

});

 

var _this = this;

_this.shoesBTN.on('click', function(){

_this.gotoAndPlay('Shoes On');

});

 

Frame 266:

 

this.stop();

 

Frame 361:

 

//
//var _this = this;
//_this.endBTN.on('click', function(){
//_this.gotoAndStop(1);
//});

 

AS3 Code:

 

Frame 1:

 

Button2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);

function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(242);
}

blanketBTN.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);

{
gotoAndStop(251);
}

shirtBTN.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);

{
gotoAndStop(253);
}

 

clothesBTN.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);

function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
gotoAndPlay(clothesRVL);
}

 

This topic has been closed for replies.

15 replies

JoãoCésar17023019
Community Expert
Community Expert
April 22, 2024

Hi.

 

I'm not sure if this is your case, but in HTML5 Canvas documents the first frame index is 0 and in AS3 documents is 1. So make sure to adjust it accordingly.

 

If that's not a issue, I think it would be helpful to help debugging the issues you're facing if you can send a link to your FLA here even if you have to use placeholders or even remove assets from your file.

 

Regards,

JC

Community Expert
April 24, 2024

This is a good point that @JoãoCésar17023019  has made.

kglad
Community Expert
Community Expert
April 24, 2024

i don't see how an erroneous line number would trigger a 1009 error.

iabillupsAuthor
Participating Frequently
April 21, 2024

I forgot to add that I looked through other forum posts on this error and tried the suggestion of turing off advanced layers but it didn't work. 😞

kglad
Community Expert
Community Expert
April 21, 2024

file > publish settings > tick enable debugging > retest

 

what's the line of code triggering the error?

iabillupsAuthor
Participating Frequently
April 21, 2024

Hi! Thank you very much for responding. I tried your suggestion and I was still getting the same error. 😞 The error is on line 42, which has the code " gotoAndPlay(clothesRVL);"