Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Managers {
- import flash.display.*;
- import flash.events.*;
- import flash.media.*;
- import flash.net.*;
- public class GameFourMachine extends MovieClip {
- private var state:int;
- public function GameFourMachine() {
- state = 0;
- addEventListener( Event.ADDED_TO_STAGE, onAddedToStage );
- }
- private function onAddedToStage( e:Event ):void {
- removeEventListener( Event.ADDED_TO_STAGE, onAddedToStage );
- mc_intro.stop();
- mc_intro.addEventListener( "startsound", nextStep );
- mc_rodada1.visible = false;
- mc_rodada1.addEventListener( "startsound", nextStep );
- mc_rodada2.visible = false;
- mc_rodada3.visible = false;
- nextStep();
- }
- public function nextStep(event:Event=null):void
- {
- switch(state)
- {
- case 0: mc_intro.gotoAndPlay(1);
- case 1: playSound("teste1.mp3");
- case 2: mc_intro.gotoAndPlay(45);
- case 3: playSound("teste2.mp3");
- case 4: mc_intro.gotoAndPlay(81);
- case 5: mc_intro.visible = false;
- mc_rodada1.visible = true;
- mc_rodada1.mapa.gotoAndPlay(2);
- case 6: playSound("teste3.mp3");
- case 7: mc_rodada1.mapa.gotoAndPlay(46);
- case 8: playSound("teste4.mp3");
- }
- state++;
- }
- private function playsound( url )
- {
- var sound:Sound = new Sound();
- sound.load( new URLRequest( url ) );
- var channel:SoundChannel = sound.play();
- channel.addEventListener( Event.SOUND_COMPLETE, nextStep );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment