Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Finding index of array item

Guest
Dec 01, 2008 Dec 01, 2008
I'm working in AS2 and have created an array of movie clips (symbol_box) with n ranging from 0 to 24. I want to be able to return the index of a movie clip (symbol_box) when it is clicked so I can use it to access another movie clip in a second array. I need to be able to get the value of n... i.e. the index of the clicked clip. Any ideas? I'm sure it is simple!
TOPICS
ActionScript
413
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 01, 2008 Dec 01, 2008
What exactly does the array contain... what are the values?

I'm thinking that you need to assign the index value to the movieclip somehow/sometime, so that it has an immediate answer when clicked on, but there may be another option depending on what you use store in the array.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 02, 2008 Dec 02, 2008
Hi Ned
The array is simply an array of boxes (movie clips as rectangles). They are indexed from 0 to 25. I want to able to get Flash to return the index to me as an integer when the movie clip is clicked so I can then use it to refer to other resources (parallel arrays of other objects) in the project. I've done it once before in Flash 8 successfully but I'm blowed if I can find the project I did it in! Hope this makes sense. Rick
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 02, 2008 Dec 02, 2008
LATEST
I'm still back at my question... what is being stored? Is it the instance names or just mc objects that have nothing uniquely identifiable between them? Describe a little about the mc's themselves as far as how they are created and how they are added into the array... I'm just trying to find (or define) some handle for being able to grab a hold of a specific one, which is what you may need to be able to identify which is which.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines