Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.manuvo.soyUnRio.lectura {
- import flash.text.TextField;
- import com.greensock.TweenNano;
- import flash.display.Shape;
- import flash.display.Bitmap;
- import flash.geom.Rectangle;
- import flash.events.Event;
- import com.manuvo.soyUnRio.lectura.Escena;
- /**
- * @author Windows
- */
- public class Escena2 extends Escena {
- private var currX : Number = 0;
- [Embed(source="../assets/img/escena2/rio-mitad-5.png")]
- private var Rio : Class;
- [Embed(source="../assets/img/escena2/casa-pag-5.png")]
- private var Casa : Class;
- private var rio : Bitmap;
- private var casa : Bitmap;
- private var mascara : Shape;
- private var texto : TextField;
- public function Escena2() {
- super();
- x = 1024;
- rio = new Rio();
- rio.y = 384 - (rio.height/2);
- casa = new Casa();
- casa.y = rio.y-50;
- casa.x = 650;
- mascara = new Shape();
- mascara.graphics.beginFill(0x000000);
- mascara.graphics.drawRect(0, 0, rio.width, rio.height);
- mascara.graphics.endFill();
- mascara.scaleX = 0;
- mascara.y = rio.y;
- rio.mask = mascara;
- texto = new TextField();
- texto.text = "Soy un Rio";
- texto.y = casa.y - 10;
- texto.x = 50;
- texto.alpha = 0;
- addChild(mascara);
- addChild(casa);
- addChild(rio);
- }
- override public function entrar():void{
- addEventListener(Event.ENTER_FRAME, loop);
- }
- private function loop(event : Event) : void {
- if (currX<1020){
- currX += (1024 - currX) *.15;
- parent.scrollRect = new Rectangle(currX,0,1024,768);
- }else{
- removeEventListener(Event.ENTER_FRAME, loop);
- entrarComplete();
- TweenNano.to(texto,.5,{alpha:1});
- }
- }
- private function entrarComplete() : void {
- TweenNano.to(mascara, 2, {scaleX:1});
- }
- }
- }
Add Comment
Please, Sign In to add comment