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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:38:11+00:00 2026-06-10T03:38:11+00:00

I have created a .fla in Flash professional with several rectangles. Each rectangle is

  • 0

I have created a .fla in Flash professional with several rectangles. Each rectangle is a different color and is a separate movie clip. I then have a movie clip (RectContainer) with contains all the rectangles inside of it, and I have added ‘AS Linkage’ so I can create an instance of this container class in Flash builder (after I’ve exported as a .swc).

My question is this. What if I wanted to add a variable to each rectangle and how could I read this value from Flash builder.

For example, I want to add a string variable to the red rectangle with the word “red” , the blue rectangle with “blue” etc.

I then want to add listeners to the rectangles, so when they are clicked I can get the color string of the rectangle that was clicked.

for (var i:int = 0; i < rectContainer.numChildren; i++) {
    rectContainer.getChildAt(i).addEventListener(MouseEvent.MOUSE_DOWN, fl_Click);
}

function fl_click(event:MouseEvent):void
{
    event.currentTarget. ???
}
  • 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-06-10T03:38:11+00:00Added an answer on June 10, 2026 at 3:38 am

    You should make a custom class for your rectangles to inherit from (or draw your rectangles in the custom class and forgo the .fla altogether). You can then give a public property to hold the value you desire, create any common functions like a click handler that does something with the color label.

    public class MyRectangle extends Sprite {
        public var label:String;
    
        public function MyRectangle(){
            this.addEventListener(MouseEvent.CLICK, clickHandler,false,0,true);
        }
    
        private function clickHandler(e:MouseEvent):void {
            trace(label);
        }
    }
    

    For your rectangles, if in the flash IDE, in their symbol properties put your custom class as the base class.

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

Sidebar

Related Questions

I have a MovieClip symbol created with flash in a fla file library. There
I have a .fla on my Mac that I created in Flash cs5. I
I have created a function that shows/hides different messages according to a combination of
I have a fla I created in CS5.5, and I am trying to use
I've created a small component in Flash CS4, and I have associated my MyComp
I have some animation that was created in the main timeline in an FLA
I have a .fla file created by our designer and he has created a
I have created a small flash CS4 project that has a few custom components
I am attempting to import several different packages into a Flash Builder 4. I'm
I have created a separate project to connect my server component to clients using

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.