Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 630431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:51:15+00:00 2026-05-13T19:51:15+00:00

I have an object (button) on frame 2 of my timeline, with the name

  • 0

I have an object (button) on frame 2 of my timeline, with the name btnMenu. When clicked, i want to return to frame 1 in the timeline. Actionscript 3 does not allow me to bind the eventlistener to the button from my code on frame 1.

Layout:

layer 1: Actions, only on frame 1
layer 2: btnMenu, only on frame 2 (with an empty frame in front)

Code:

stop(); // don't automatically go to frame 2

btnMenu.addEventListener(MouseEvent.CLICK, function() { gotoAndStop(1); }

(and other code to go to frame 2 obviously)

The error i get is “can’t find method/property of object that is null” (roughly translated).

Please help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:51:16+00:00Added an answer on May 13, 2026 at 7:51 pm

    You can only access objects that are on the same frame where your code lives. You have several ways to get around this. Depends how you want to structure you application.

    1. You can move all your buttons to the frame where you have the code, toggle their visibility to false and once you reach the frame where the button should be visible just set it to true.

    2. Other way is to move the addEventListener code to the same frame of your button. You can still access your code in the first frame, and call function if you need so.

    Consider the following:

    // code in first frame
    stop();
    
    function goto(evt:MouseEvent):void {
        gotoAndStop(1);
    }
    
    // code in button frame
    stop();
    btnMenu.addEventListener(MouseEvent.CLICK, goto);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an event fired when some button is being clicked private void set_Opacity(object
I have a main frame where i want to display object of my NewUser
I have to pass an object to an button's action... something like [myButton addTarget:self
I have a an object view with data and a button on that view.
I have a simple Button control that contains an Image object as its content.
I have a menu with button objects in As3. I want to display the
I have three HTML objects and want to arrange Previous button at the left
If I have a button on the timeline for the first few frames, but
I have a button and a tapped event: private void btnSetLocationName_Click_1(object sender, RoutedEventArgs e)
I have crystal reports that keeps saying this error: {Object reference not set to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.