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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:59:56+00:00 2026-05-16T11:59:56+00:00

I have multiple toggle buttons on my flash stage. These toggle buttons are MovieClips.

  • 0

I have multiple toggle buttons on my flash stage. These toggle buttons are MovieClips. If a user clicks on one of the MovieClips, I want to be able to find a way to go through the Object below–get the appropriate value based on what the User clicked–and store that value in a new value called var powerData which will then be passed to a function to perform calculations.

           var houseArray:Object = {lightA:"1", 
                                    lightB:"1", 
                                    lightC: "1"
                                    lightD: "1"
                                    lightE: "1"
                                    comp: "2"
                                    tv: "3"
                                    stove: "4"
                                    laundry: "5"};

For example:
If the user clicked on “Comp” MovieClip
then–> var powerData = 2; (because in houseArray:Object–> comp: “2”)

  • 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-16T11:59:57+00:00Added an answer on May 16, 2026 at 11:59 am

    You will need to name your MovieClips instances after the properties of the houseArray object. In your example, the Comp instance should be named “comp” , the TV “tv” and so on…

      //Could also be , private var comp:Comp;
      private var comp:MovieClip;
    
      private function init():void
      {
          comp = new Comp();
          comp.name = "comp";
       }
    
      private function mouseClickHandler(event:MouseEvent):void
      {
          var buttonName:String = event.currentTarget.name;
    
          //since the houseArray property value is a String, the result needs 
          //to be typed as int( or Number, depending on context )
          var powerData:int = int( houseArray[buttonName] );
    
          performCalculations(powerData);
      }
    
      private function performCalculations(value:int):void
      {
          //your code here
      }
    

    I assume you have good reasons to have the properties in houseArray as Strings…

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

Sidebar

Related Questions

I have MovieClips on my Flash Stage that when clicked on--they toggle ON/OFF. My
I have multiple divs like setted up below. I want 1 (one) JQuery function
ok, So I have multiple divs(7) which I want to toggle for show hide.
I have a show/hide toggle working well in multiple instances (thanks to help here
I have multiple UpdatePanels on a webpage, one inside UserControl (Purple ColorBox as show
I have multiple forms for lots of products on my page and want to
I have multiple calls to methods in a 3rd party library. These methods have
I have multiple domains on my server. I want to redirect all of them
I have multiple table rows that has a set of radio buttons on each
Not sure how to word this algorithm question, actually. I have toggle buttons in

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.