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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:27:48+00:00 2026-05-11T22:27:48+00:00

I’m very new to flash. I’m trying to show a simple button for my

  • 0

I’m very new to flash. I’m trying to show a simple button for my simple flash app (with adobe flex builder 3).

The main project file, Client2.as:

package
{
    import flash.display.Sprite;

    [SWF(width="600", height="600", frameRate="31", backgroundColor="#00FFFF")] //set project properties

    public class Client2 extends Sprite
    {   
        public function Client2() {
            trace("Client launched.");
            var loginGui:LoginInterface = new LoginInterface(); //load the login interface object
            loginGui.init(); //initialize the login interface
        }
    }
}

Then the LoginInterface.as class file:

package
{
    import flash.display.Sprite;
    import flash.display.SimpleButton;

    public class LoginInterface extends Sprite
    {
        public function LoginInterface()
        {
            trace("LoginInterface object loaded.");
        }

        public function init():void
        {
            trace("LoginInterface init method was called.");

            var myButton:SimpleButton = new SimpleButton();

            //create the look of the states
            var down:Sprite = new Sprite();
            down.graphics.lineStyle(1, 0x000000);
            down.graphics.beginFill(0xFFCC00);
            down.graphics.drawRect(10, 10, 100, 30);

            var up:Sprite = new Sprite();
            up.graphics.lineStyle(1, 0x000000);
            up.graphics.beginFill(0x0099FF);
            up.graphics.drawRect(10, 10, 100, 30);

            var over:Sprite = new Sprite();
            over.graphics.lineStyle(1, 0x000000);
            over.graphics.beginFill(0x9966FF);
            over.graphics.drawRect(10, 10, 100, 30);

            // assign the sprites
            myButton.upState = up;
            myButton.overState = over;
            myButton.downState = down;
            myButton.hitTestState = up;

            addChild(myButton);



        }
    }
}

When I run it the button is not showing. What am I doing wrong?

  • 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-11T22:27:48+00:00Added an answer on May 11, 2026 at 10:27 pm

    ActionScript3 graphics are based on the Display List concept. Essentially graphical elements have to be added to the display list in order to be seen.

    The root node of the display list (it’s actually a tree) is your main class, Client2. Consequently anything you want displayed on the screen has to be added as a child of this element like so:

    addChild(loginGui);  //inside of your main class
    

    Similarly, your buttons would have to be added to your instance of LoginInterface

    addChild(myButton);  //inside of LoginInterface
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
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:
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
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.