Advertisement
Markete7

Untitled

Jul 29th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import flash.display.MovieClip;
  2.  
  3. var Bolhinha:MovieClip = Object(root).Bolha;/*declare uma variável chamada bolha e instancie o movieClip Bolha atribuindo a variavel declarada*/
  4.  
  5.  
  6. addChild(Bolha);
  7.  
  8. function criaBolha()/*Declare uma função chamada criaBolha*/
  9.  
  10. {
  11. Bolhinha.x = Math.random()* 545;
  12. Bolhinha.y = Math.random()* 395;
  13. }
  14.  
  15. Bolhinha.addEventListener(Event.ENTER_FRAME, loopBolha)/*adicione a bolha o ouvinte de eventos do tipo Event.ENTER_FRAME de forma que o handler seja uma função chamada loopBolha*/
  16. function loopBolha(e:Event) /*Declare uma função chamada loopBolha*/
  17.  
  18. {
  19. /*subtrair 2 pixels do y atual*/
  20. e.currentTarget.y -=2
  21. if(Bolhinha.y < -20){
  22. criaBolha();
  23. }
  24.  
  25. }
  26.  
  27. Bolhinha.addEventListener(MouseEvent.MOUSE_DOWN, cliqueBolha)
  28. function cliqueBolha(e:MouseEvent)
  29.  
  30. {
  31. criaBolha();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement