jan_flanders

Untitled

Aug 15th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Managers {
  2.  
  3.     import flash.display.*;
  4.     import flash.events.*;
  5.     import flash.media.*;
  6.     import flash.net.*;
  7.  
  8.     public class GameFourMachine extends MovieClip  {      
  9.  
  10.         private var state:int;
  11.  
  12.         public function GameFourMachine() {
  13.  
  14.             state = 0;
  15.            
  16.             addEventListener( Event.ADDED_TO_STAGE, onAddedToStage );
  17.         }
  18.        
  19.        
  20.         private function onAddedToStage( e:Event ):void {
  21.            
  22.             removeEventListener( Event.ADDED_TO_STAGE, onAddedToStage );
  23.  
  24.             mc_intro.stop();
  25.             mc_intro.addEventListener( "startsound", nextStep );
  26.            
  27.             mc_rodada1.visible = false;
  28.             mc_rodada1.addEventListener( "startsound", nextStep );
  29.            
  30.             mc_rodada2.visible = false;
  31.             mc_rodada3.visible = false;
  32.  
  33.             nextStep();
  34.         }
  35.         public function nextStep(event:Event=null):void
  36.         {
  37.             switch(state)
  38.             {
  39.                 case 0: mc_intro.gotoAndPlay(1);
  40.                 case 1: playSound("teste1.mp3");
  41.                 case 2: mc_intro.gotoAndPlay(45);
  42.                 case 3: playSound("teste2.mp3");
  43.                 case 4: mc_intro.gotoAndPlay(81);
  44.                 case 5: mc_intro.visible = false;
  45.                         mc_rodada1.visible = true;
  46.                         mc_rodada1.mapa.gotoAndPlay(2);
  47.                 case 6: playSound("teste3.mp3");
  48.                 case 7: mc_rodada1.mapa.gotoAndPlay(46);
  49.                 case 8: playSound("teste4.mp3");
  50.             }
  51.            
  52.             state++;
  53.         }
  54.         private function playsound( url )
  55.         {
  56.             var sound:Sound = new Sound();
  57.             sound.load( new URLRequest( url ) );
  58.             var channel:SoundChannel = sound.play();
  59.             channel.addEventListener( Event.SOUND_COMPLETE, nextStep );
  60.         }      
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment