?
Solved

Flash actionscript "collections"

Posted on 2003-02-24
2
Medium Priority
?
196 Views
Last Modified: 2010-04-03
Is there a way of accessing all movie clips in a movie. I want to do something similar to collections in javascript. Basically, I want to be able to add a movie clip sprite e.g. a pacman to any movie and have it move around and know when it collides with any other movie clip (it's not being dragged)

so something like:?

for (Loop = 0; Loop<AllMovieClips.length; Loop++) {
     trace(AllMovieClips[Loop]._target);
}

I want to know if there is something in actionscript equivalent to AllMovieClips i.e. a collection of all the movie clip objects in a movie that i can access by an identifier number.

Thanks
0
Comment
Question by:brentcc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
henryww earned 200 total points
ID: 8008241
hi brentcc,

use for ... in to loop through all objects  (including all variables, buttons ... etc)

& typeof to see what type it is ...


eg.

assuming u have a movieclip call gameStage
and a lots of pacman in the gameStage

for (objname in gameStage) {
   if (typeof (gameStage[objname]) = "movieclip") {
     // do whatever u want here
     myPacman = gameStage[objname];
     // check myPacman's collison ... etc .. etc

   }
}

cheers
0
 

Author Comment

by:brentcc
ID: 8008302
Perfect! Thanks.

Brent
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question