A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Flash CS6 AS3 Error 1120: Access to undefined Property

  1. #1
    Junior Member
    Join Date
    Feb 2015
    Posts
    2

    Flash CS6 AS3 Error 1120: Access to undefined Property

    I am getting error 1120: Access of undefined property. I know that it means I am trying to access, exercise_button1 instance and it says it doesn't exist, but looking in my library, that is the name of these buttons. Can someone help me out?

    Here I've attached my fla so you can check it out. THanks.
    exercise6.fla

    Code:
    import flash.events.MouseEvent;
    
    exercise_button1.addEventListener(MouseEvent.CLICK, gotoStep1);
    
    function gotoStep1(evt:MouseEvent): void
    {
    	gotoAndStop("Step1");
    }
    
    exercise_button2.addEventListener(MouseEvent.CLICK, gotoStep2);
    
    function gotoStep2(evt:MouseEvent): void
    
    {
    	gotoAndStop("Step2");
    }

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You need to give your buttons instance names.
    To do this, selct a button on the stage and give each one an instance name in the properties panel.
    In this case they need to called exercise_button1 and exercise_button2 respectively.

    The name you have in the library doesnt work for the stage, thats just a library name, you can however user an AS Linkage name in the library if you were to attach/add using code.

  3. #3
    Junior Member
    Join Date
    Feb 2015
    Posts
    2

    Thumbs up

    Thanks that worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center