1 Reply Latest reply on Jan 22, 2008 8:44 AM by Newsgroup_User

    Controling swf movie

    Ivgi
      How can i control the inner sub movies of swf movie without knowing theyr names if i add the movie to a flash project or from the html?
        • 1. Re: Controling swf movie
          Level 7
          Hi Ivgi,

          This is a somewhat complex procedure because of all of the
          possibilities, but I'll give you a quick rundown of a generic method that
          should at least get you started. You pass a parent movie clip as a parameter
          and it returns a numbered array of all child clips:

          public function returnChildren (parentClip:MovieClip):Array {
          var returnArray:Array=new Array();
          for (var item in parentClip) {
          if (typeof(parentClip[item])=="movieclip") {
          returnArray.push(parentClip[item]);
          }//if
          }//for
          return (returnArray);
          }//returnChildren

          Now to work with the children, you would do something like this (assuming
          'containerClip' is the parent container):

          var childList:Array=returnChildren(containerClip);
          for (var count:Number=0;count<childList.length;count++) {
          var currentChild:MovieClip=childList[count];
          //Here you can work with the child clip. For example:
          currentClip._x=20;
          currentClip._height=100;
          trace ("Current affecting clip: "+currentClip._name);
          //...etc.
          }//for

          That's it. Keep in mind this is ActionScript 2.0. In ActionScript 3.0 this
          would be somewhat different (similar but some things are not the same).

          Regards,
          Patrick Bay
          BAY NEW MEDIA
          "Ivgi" <webforumsuser@macromedia.com> wrote in message
          news:fn4789$f8v$1@forums.macromedia.com...
          > How can i control the inner sub movies of swf movie without knowing theyr
          > names if i add the movie to a flash project or from the html?