Guest User

Untitled

a guest
Feb 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.display.MovieClip;
  2. import flash.display.DisplayObject;
  3.  
  4. //trace (numChildren);
  5. var counterA:int = 0;
  6. var endLoopA:int = numChildren;
  7. var movie:MovieClip = null;
  8. trace (endLoopA);
  9.  
  10. while (counterA < endLoopA)
  11. {
  12.     movie = getChildAt (counterA) as MovieClip;
  13.    
  14.     if (movie != null)
  15.     {
  16.         trace (movie.width);
  17.        
  18.         movie.mouseChildren = false;
  19.         stopMovie (movie);
  20.         movie.addEventListener(MouseEvent.MOUSE_UP, playOrStopMovie);
  21.     }
  22.        
  23.     counterA = counterA + 1;
  24. }
  25.  
  26.  
  27.  
  28. function playOrStopMovie (evt:MouseEvent):void
  29. {
  30.     var movie:MovieClip = evt.target as MovieClip; //mcHealthbar;
  31.    
  32.     if (movie.animating == null)
  33.     {
  34.         movie.animating = false;
  35.     }
  36.    
  37.     if (movie.animating == false)
  38.     {
  39.         playMovie (movie);
  40.         movie.animating = true;
  41.     }
  42.     else
  43.     {
  44.         stopMovie (movie);
  45.         movie.animating = false;
  46.     }
  47. }//End of Function
  48.  
  49. function stopMovie (passedMovie:DisplayObject):void
  50. {
  51.     var movie:MovieClip = passedMovie as MovieClip;
  52.    
  53.     if (movie != null)
  54.     {
  55.         movie.stop();
  56.        
  57.         var counter:int = 0;
  58.         var endLoop:int = movie.numChildren - 1;
  59.        
  60.         while (counter < endLoop)
  61.         {
  62.             stopMovie (movie.getChildAt (counter));
  63.            
  64.             counter = counter + 1;
  65.         }
  66.     }
  67. }
  68.  
  69. function playMovie (passedMovie:DisplayObject):void
  70. {
  71.     var movie:MovieClip = passedMovie as MovieClip;
  72.     if (movie != null)
  73.     {
  74.         movie.play();
  75.        
  76.         var counter:int = 0;
  77.         var endLoop:int = movie.numChildren - 1;
  78.        
  79.         while (counter < endLoop)
  80.         {
  81.             playMovie (movie.getChildAt (counter));
  82.            
  83.             counter = counter + 1;
  84.         }
  85.     }
  86. }
Add Comment
Please, Sign In to add comment