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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:56:35+00:00 2026-06-08T11:56:35+00:00

So, I made a for loop to get several buttons in my project. It’s

  • 0

So, I made a for loop to get several buttons in my project. It’s a questionary, and I need to have a button to quickly select and navigate to any question there. I could do them all manually, but not only would my code be long and confusing, but also there are problems since there isn’t always the same number of questions.

So right now I have:

function SetQuestionSquares():void{
    for(var i:Number = 1; i <= TestProperties.QuestionLimit;i++){
        var QuestionSquare:questionsquare = new questionsquare;
        QuestionSquare.buttonMode = true;
        QuestionSquare.mouseChildren = false;
        QuestionSquare.x = NavLeft.x + (20 * i);
        QuestionSquare.y = NavLeft.y;
        QuestionSquare.questionsquaretext.text = i.toString();
        addChild(QuestionSquare);
        QuestionSquare.addEventListener(MouseEvent.CLICK, GoToQuestionNumber);
    }
    addChild(NavLeft);
    addChild(NavRight);
}

function GoToQuestionNumber(e:MouseEvent):void{
    WhichQuestion = ???; //I don't know what goes here. 
    UpdateQuestions();
    trace("testing"); //Gets called correctly, so its working.
}

My problem is identifying which square was clicked. I need to have some way to grab the “e” (clicked) event, so I know which button the user clicked on.

  • 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-08T11:56:36+00:00Added an answer on June 8, 2026 at 11:56 am

    You need .target property of the Event object:

    WhichQuestion = e.target as questionsquare;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a custom loop in WordPress and for some reason, the date
I have an issue I can't get over. I made a simple jQuery album
I have made a loop in my JavaScript code and in that loop I
I have a NSArray of UIImageViews that I want to loop over and quickly
I have a servlet with several methods that get a list of objects from
So here's what I see this code doing: An array is made A loop
I made a while loop inside a program and the program reaches the while
Made this nice little loop for hiding and showing div's, works as a charm
I made an IRC bot which uses a while true loop to receive whatever
I made a dll in c# but i need to export the functions. Is

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.