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 7067543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:12:53+00:00 2026-05-28T05:12:53+00:00

I’m new to ActionScript 3.0 and I am trying to work my way around

  • 0

I’m new to ActionScript 3.0 and I am trying to work my way around Object Orientated Programming.

I’ve designed an application where there are 3 buttons on the stage and a logo. What I want to happen is when a button is clicked, the logo will fade out. Now I understand I need to manipulate the alpha properties of the logo but not sure how I would run the code once the button is clicked. I have my Main.as file loading the properties of the application. So once the FLA file runs, Main.as sets up the buttons and the logo. Now the buttons are put into a display holder and run from menuHolder.as which in turn gets the design of the buttons from button.as – so far with me?

To keep my code clean I have seperated my code into their own files (the design of the buttons into its own .as file, the arrangement of the menu buttons into its own .as file, the logo creation into its own .as file) so that the Main.as file just acts as a loader for placing everything into location on the stage.

So my question is that I want to create an animation for the logo (a fade out animation) where the code would be stored in say animationFade.as for example. Then when a button is clicked, the animation plays and the corresponding page is navigated to.

Here is my code for the setup of the menuBottons.as:

package 
{
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.events.MouseEvent;
    import flash.text.TextFormat;

    public class menuButtons extends Sprite
    {
        private var aboutMeBtn:button;
        private var galleryBtn:button;
        private var contactMeBtn:button;

        public function menuButtons()
        {
            aboutMeBtn = new button();
            aboutMeBtn.y = 0;
            aboutMeBtn.label = "About Me";
            addChild(aboutMeBtn);
            aboutMeBtn.addEventListener(MouseEvent.CLICK, onButtonClick);

            galleryBtn = new button();
            galleryBtn.y = 75;
            galleryBtn.label = "Gallery";
            addChild(galleryBtn);
            galleryBtn.addEventListener(MouseEvent.CLICK, onButtonClick);

            contactMeBtn = new button();
            contactMeBtn.y = 150;
            contactMeBtn.label = "Contact Me";
            addChild(contactMeBtn);
            contactMeBtn.addEventListener(MouseEvent.CLICK, onButtonClick);
        }
        public function onButtonClick(event:MouseEvent):void
        {
            //code to initiate the animationFade.as file
        }

    }
}

it’s this //code to initiate the animationFade.as file that i cannot grasp. It may be something very simple but my head seems to be spinning!

Hopefully I have provided enough information. Like I say I am just learning at the minute and trying to build up slowly.

Thank you

  • 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-28T05:12:54+00:00Added an answer on May 28, 2026 at 5:12 am

    The best way to do this would be to dispatch an event from your button click function. Then, create a listener in your Main.as file that handles the event and tells the logo to fade out.
    Maybe something like:

    From menuButtons.as

    public function onButtonClick(event:MouseEvent):void
    {
        dispatchEvent(new Event("hide_logo", true));
    }
    

    You can read up on the Event Class documentation to learn more about the parameters.

    From Main.as (after you create your menuButtons instance)

    menuButtonsInstance.addEventListener("hide_logo", hideLogoHandler);
    
    function hideLogoHandler(e:Event):void {
        // Fade out logo
        TweenLite.to(logo, 1, {alpha:0}); // requires TweenLite
    }
    

    This example requires TweenLite from Greensock.

    On a side note, for best practice your class names should start with an uppercase character. So “menuButtons” class would be “MenuButtons”. Then, instance names would start with a lowercase character. Makes it easier to read if you do something like:

    var menuButtons:MenuButtons = new MenuButtons();

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
i got an object with contents of html markup in it, for example: string
Thanks in advance for your help. I have a need within an application 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.