random - Flash actionscript 2 remove linkage MovieClip -


i'm making banner , in banner have movie-clip link library in action script , call "mchelmet". need appear in randomly position on x axis , move top bottom (like rain).

the problem after 25 sec' want go frame (10) , "mchelmet" disappear. works fine except "mchelmet" refuses disappear no matter code use; delete , remocemovieclip, using function nothing works.

i need help.

this code use:

onenterframe = function (){ url_btn.onrollover = btn.ondragover = function (){         startdrag(mc_girl,true,10,186,270,131);         mc_girl._x = _xmouse;          if(_xmouse < mc_girl.width /2){             mc_girl._x = 0;         }          if(_xmouse > stage.width - mc_girl.width /2){             mc_girl._x =stage.width - mc_girl._width;         }         if(mc_girl._x <= 0){             mc_girl._x += mainspeed;         }         if(mc_girl._x >= stage.width - mc_girl._width){             mc_girl._x -= mainspeed;         }          stoptimer();     }  //this function run every frame (needed moving character helmettime++; //incrementing time enemy if (helmettime == helmetlimit) {     //if enough time has elapsed     _root.attachmovie('mchelmet','en' + helmettotal,_root.getnexthighestdepth());     //then add enemy     //setting it's coordinates     _root['en' + helmettotal]._x = int(math.random() * stage.width);     //randomly within boundaries     _root['en' + helmettotal]._y = -50;     //sets offstage @ first     _root['en' + helmettotal].onenterframe = function()     {         //then give functions         this._y += 4;     }     helmettime = 0;     //reset time     helmettotal++;     //add 1 more amount of enemies total  } }    

to remove last mc haved put on stage, suggest variable or array;array efficient enough :

            var mymovieclips_holder:array = new array();             //everytime add mc stage ,also add here              addchild(mymovieclip)             mymovieclips.push(mymovieclip); 

now movieclips stored in array();

             trace( mymovieclips_holder) // array[0] movie clip , array[1] etc 

lets remove last clip :

              var  = mymovieclips_holder.length - 1               mymovieclips_holder[i].parent.removechild(mymovieclips_holder[i]);   

this should delete last item array nomatter have nested worked me.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -