Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Flash actionscript "collections"

Posted on 2003-02-24
2
Medium Priority
?
197 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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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 shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

581 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