Guest User

Untitled

a guest
Feb 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. package com.manuvo.soyUnRio.lectura {
  2. import flash.text.TextField;
  3. import com.greensock.TweenNano;
  4. import flash.display.Shape;
  5. import flash.display.Bitmap;
  6. import flash.geom.Rectangle;
  7. import flash.events.Event;
  8. import com.manuvo.soyUnRio.lectura.Escena;
  9.  
  10. /**
  11. * @author Windows
  12. */
  13. public class Escena2 extends Escena {
  14. private var currX : Number = 0;
  15. [Embed(source="../assets/img/escena2/rio-mitad-5.png")]
  16. private var Rio : Class;
  17. [Embed(source="../assets/img/escena2/casa-pag-5.png")]
  18. private var Casa : Class;
  19.  
  20. private var rio : Bitmap;
  21. private var casa : Bitmap;
  22. private var mascara : Shape;
  23. private var texto : TextField;
  24. public function Escena2() {
  25.  
  26. super();
  27. x = 1024;
  28. rio = new Rio();
  29. rio.y = 384 - (rio.height/2);
  30. casa = new Casa();
  31. casa.y = rio.y-50;
  32. casa.x = 650;
  33. mascara = new Shape();
  34. mascara.graphics.beginFill(0x000000);
  35. mascara.graphics.drawRect(0, 0, rio.width, rio.height);
  36. mascara.graphics.endFill();
  37. mascara.scaleX = 0;
  38. mascara.y = rio.y;
  39. rio.mask = mascara;
  40.  
  41. texto = new TextField();
  42. texto.text = "Soy un Rio";
  43. texto.y = casa.y - 10;
  44. texto.x = 50;
  45. texto.alpha = 0;
  46.  
  47. addChild(mascara);
  48. addChild(casa);
  49. addChild(rio);
  50. }
  51. override public function entrar():void{
  52. addEventListener(Event.ENTER_FRAME, loop);
  53. }
  54.  
  55. private function loop(event : Event) : void {
  56. if (currX<1020){
  57. currX += (1024 - currX) *.15;
  58. parent.scrollRect = new Rectangle(currX,0,1024,768);
  59. }else{
  60. removeEventListener(Event.ENTER_FRAME, loop);
  61. entrarComplete();
  62. TweenNano.to(texto,.5,{alpha:1});
  63. }
  64.  
  65. }
  66.  
  67. private function entrarComplete() : void {
  68. TweenNano.to(mascara, 2, {scaleX:1});
  69. }
  70. }
  71. }
Add Comment
Please, Sign In to add comment