Actionscript 3: foreach drawing object in movieclip

Posted by Mathias on Stack Overflow See other posts from Stack Overflow or by Mathias
Published on 2010-05-26T10:37:08Z Indexed on 2010/05/26 10:41 UTC
Read the original article Hit count: 406

Filed under:
|
|
|
|

Hey,

I got a europe map designed in flash (1 movieclip, 1 frame, really simple), which contains the map as drawing objects directly inside the scene and in addition some specific countries as clickable buttons. So far it's working fine. What I need now is to make all the other drawing objects clickable without having to edit and script each object. I'm thinking about something like this (pseudo code):

foreach(obj in MovieClip) {
    if(obj !typeof(Button)) {
        obj.addEventListener(MouseEvent.MOUSE_DOWN, genericClickListener);
    }
}

I just don't know the syntax how to achieve that. Could anybody give me a hint?

Thanks, Mathias

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3