Skip to main content
Participating Frequently
July 20, 2022
Answered

1120: access of undefined property of symbol

  • July 20, 2022
  • 2 replies
  • 296 views

Hi,

I have a symbol (movieclip) named GirlPlayer and am coding simple keyboard movement. Every reference to GirlPlayer in the code produces the 1120: access of undefined property error. It is like the symbol is not being seen as a symbol. Any help appreciated. 

 

Donna

 

import flash.events.Event;
import flash.events.KeyboardEvent;


var leftarrow:Boolean = false;
var rightarrow:Boolean = false;
var uparrow:Boolean = false;
var downarrow:Boolean = false;
var previouskey:Number = 0;
var girlspeed:Number = 10;

//main program//
stage.addEventListener(KeyboardEvent.KEY_DOWN, onkeydown) ;
function onkeydown(e:KeyboardEvent){
if(e.keyCode == 37){leftarrow = true;}
if(e.keyCode == 38){uparrow = true;}
if(e.keyCode == 39){rightarrow = true;}
if(e.keyCode == 40){downarrow = true;}
}
stage.addEventListener(KeyboardEvent.KEY_UP, onkeyup) ;
function onkeyup(e:KeyboardEvent){
if(e.keyCode == 37){leftarrow = false;}
if(e.keyCode == 38){uparrow = false;}
if(e.keyCode == 39){rightarrow = false;}
if(e.keyCode == 40){downarrow = false;}
GirlPlayer.gotoAndPlay("idle");
previouskey = 0;
}

GirlPlayer.addEventListener(Event.ENTER_FRAME, girlenterframe);
function girlenterframe(e:Event){
if(leftarrow){
GirlPlayer.x -= girlspeed;
GirlPlayer.scaleX = -1;
if(previouskey !=37){GirlPlayer.gotoAndPlay("walk");}
previouskey = 37;
} etc.....

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

     

    Is GirlPlayer the symbol name (the one displayed in the Library panel) or the instance name (the one set in the Properties panel)?

     

    Please make sure it is the instance name.

     

    Regards,

    JC

    2 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    July 20, 2022

    Hi.

     

    Is GirlPlayer the symbol name (the one displayed in the Library panel) or the instance name (the one set in the Properties panel)?

     

    Please make sure it is the instance name.

     

    Regards,

    JC

    Participating Frequently
    July 20, 2022

    Thank you JC. It was the symbol name and not the instance name. Working now 🙂

    JoãoCésar17023019
    Community Expert
    Community Expert
    July 20, 2022

    Awesome! You're welcome!

    John T Smith
    Community Expert
    Community Expert
    July 20, 2022

    When you post a question you always need to tell the Adobe program you are using
    There are MANY programs in a full subscription, plus other non-subscription programs
    Please post the exact name of the Adobe program you use so a Moderator may move this message to that forum

    Participating Frequently
    July 20, 2022

    Hi John,

    Adobe Animate 2021 is the software I'm using.

    Donna