Thanks, Jan and Glen :-)
Even embedding each symbol separately is great.

Yesterday I've just (mistakenly) supposed to access "internal" clips by
their names, as we did in AS2...
Obviously it's not possible.
Just out of curiosity:
if we access them via getChildAt() , do you think there's some relation
between clip's position/layer/name/etc in "container mc" (in Flash 8 IDE)
and the position in "child list" (idx variable in Glen's code below)?

Glen Pike wrote:
>
>    I have managed to access movie clips inside an embedded symbol, but
> purely to manipulate them as movieclips.
>
>    To avoid confusion - I have no code inside the SWF file I am
> embedding, I am merely using Flash 8 IDE to author graphical symbols &
> animations which I embed individually.  Some of these clips have nested
> clips too.
>
>    Here is an example:
>
>    //Embed the symbol Block, which has a number of clips inside it.
>    [Embed (source = "../resources/graphics.swf", symbol="Block")]
>    private var Block:Class;
>
>    //...
>
>    //Create an instance of a Block
>    _block:MovieClip = new Block() as MovieClip;
>    //Loop through and "stop" all the child clips using the child access
> methods of AS3
>    var children:int = _block.numChildren;
>    for (var idx:int = 0; idx < children;idx++ ) {
>          var child:MovieClip = _block.getChildAt(idx) as MovieClip;
>          child.stop();
>    }
>
>
>
>    //Later in the code, do collision detection on each child clip in
> the Block and manipulate it as a movieclip.
>    function hitTestBlock(block:MovieClip, ball:Sprite) {
>        var children:int = block.numChildren;
>        for (var idx:int = 0; idx < children;idx++ ) {
>              var child:MovieClip = block.getChildAt(idx) as MovieClip;
>              if(child.hitTestObject(ball)) {
>                  child.nextFrame();
>                  //optimise for speed by removing clips that are "dead".
>                  if(child.totalFrames == child.currentFrame) {
>                      block.removeChild(child);
>                  }
>                  return true;
>              }
>       }
>       return false;
>    }
>
>
>
>    HTH
>
>    Glen
>
>
> Ian Thomas wrote:
> >> I can just embed one "container" mc symbol ?
>

> > In short, I don't know - never tried using the container mc idea.
> >
> > Thinking about it, though, I suspect that you won't be able to access
> the
> > subclips via new MySubClipSymbolID(); however, if you instantiate the
> > containing clip (new MyTopLevelSymbolID() or whatever) you may be able
> to
> > access the children via getChildAt() etc.
> >
> > That's probably not a hugely useful thing to be able to do, though.
> >
> > I'm guessing it's most useful to embed each symbol.
> >
>



-- 
-- 
Best regards,
GregoryN
================================
http://GOusable.com
Flash components development.
Usability services.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to