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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:13:57+00:00 2026-06-11T23:13:57+00:00

When we click on an image it should come in front as the selected

  • 0

When we click on an image it should come in front as the selected image, but I dont want to change the index value of that image

canvas1.setChilIndex(Image(event.target), numChildern-1) 

The above line is changing the index value of the selected image and setting it to maximum-1 (for ex: 5-1 = 4 as index value). I Need alternate for above line that keeps the same index for the image.

Any help is appreciated.

  • 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-11T23:13:58+00:00Added an answer on June 11, 2026 at 11:13 pm

    What you can do, is in your click handler store the index of the item clicked, then on the next click (or whenever you want), send the item back to its previous index:

    var previousImg:Image;
    var previousIndex:int;
    
    function selectImage(img:Image):void {
        deselectImage(); //if there is already a selected image, put it back before moving this new one to the top
    
        previousImg = img;    
        previousIndex = canvas1.getChildIndex(img);
        canvas1.addChild(img); //brings it to the front
    }
    
    function deselectImage():void {
        if(previousImg){
            canvas1.setChildIndex(previousImage, previousIndex);
            previousImg = null;  //null the var in case you call this method manually
        }
    }
    

    so in your click handler, do this instead of the line you have in your question:

    selectImage(Image(event.target));
    

    With this method, anytime you call selectImage, it will put the last click one back where it belongs. You could also call deselectImage manually if you so desired.

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

Sidebar

Related Questions

i want that when LightFace will be shown then a busy image should come
When I click on an image, I want to store that particular images src
i have garage gate image. i want when click on button image should move
I have graph image i want that when i click on image the image
I had image for Products and i want user when click on image appear
Right now the problem is that the first time when I click the image,
Is it possible to click on an image, that is not located in a
How to change cell background image on click on cell in iphone????I have tried
I am trying to click on an image and change it to another image
I have a canvas which loads in a selected image. The canvas should display

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.