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

  • SEARCH
  • Home
  • 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 3999306
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:38:26+00:00 2026-05-20T07:38:26+00:00

New to CS5 and AS3 so if I am making a fundamental mistake please

  • 0

New to CS5 and AS3 so if I am making a fundamental mistake please don’t hesitate to correct me.

I am trying to build a fairly lengthy and complicated form. So this will require navigation through different pieces of it. I am new to Flash and AS3 so I started with some prototyping and got two buttons to navigate forward and backwards in the timeline. My problem is now when I am trying to bring this out of the “Code Snippet” (correct term?) area and into my main ActionScript file. The buttons appear, but pressing them does not execute the MouseEvent.

So two questions.
1. Am I doing this right?
2. Why doesn't MouseEvent work when the code is in the .as file?

Form.fla – frame 1 Code Snippet

var form:Form = new Form();
addChild(form);

Form.as

package  
{
    import flash.display.MovieClip;
    import fl.controls.Button;
    import flash.events.MouseEvent;

    public class Form extends MovieClip 
    {
        private var nextButton:Button;
        private var prevButton:Button;

        public function Form() 
        {
            setupNavigation();
        }

        private function setupNavigation():void
        {
            nextButton = new Button();
            nextButton.label = "Next";
            // ... size and position code
            nextButton.addEventListener(MouseEvent.CLICK, moveForward);

            prevButton = new Button();
            prevButton.label = "Previous";
            // ... size and position code
            prevButton.addEventListener(MouseEvent.CLICK, moveBackward);

            addChild(nextButton);
            addChild(prevButton);
        }

        // Setup Mouse events
        private function moveForward(event:MouseEvent):void
        {
            nextFrame();
        }

        private function moveBackward(event:MouseEvent):void
        {
            prevFrame();
        }
    }
}
  • 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-20T07:38:26+00:00Added an answer on May 20, 2026 at 7:38 am

    You have to pass a reference of your main timeline to your Form class, using a setter function

    var form:Form = new Form();
    form.mainTimeline = this;
    addChild(form);
    

    in your Form class (not a snippet, class is the correct term), add the following function and variable:

    private var _mainTimeline:Object;
    
    public function set mainTimeline(mtl:Object):void
    {
        _mainTimeline = mtl;
    }
    

    then in your move forward/backward functions change the prevFrame() and nextFrame() to:

    _mainTimeline.prevFrame();
    _mainTimeline.nextFrame();
    

    There are several ways to accomplish what you are trying to achieve, meaning the method of changing sections. Your way is one way to do it. There are maybe some better approaches but your approach here is not glaringly wrong or anything. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I 'm trying to build a game in flash cs5, as3. The game will
I'm new in games development, am trying to create a simple game in flash-cs5.
I am trying Flash CS5 for ios development, but TouchEvents don't works on my
This question is related to: CS5 FLASH + AS3 Hello, I am simply trying
new to c#. I'm trying to make a simple system where I can search
New to Node.js and Express, I am trying to understand the two seems overlapping
New programmer here, I am trying to understand and break down this code below
using AS3 and Flash CS5 I have a messageboard Adobe Air desktop App with
ActionScript 3 - CS5 I'm new to Flash and wondering how to change fill
I am very new to Action Script. I am using Flash Professional CS5 with

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.