home *** CD-ROM | disk | FTP | other *** search
- package dss160_02
- {
- import com.milanpresse.engine.*;
- import com.milanpresse.engine.initmovieclip.*;
- import com.milanpresse.engine.managers.*;
- import com.milanpresse.engine.medias.*;
- import com.milanpresse.engine.timelines.*;
- import com.milanpresse.engine.typeargument.*;
- import com.milanpresse.tools.GlobalesFunctions;
- import flash.display.*;
- import flash.geom.Point;
- import flash.geom.Rectangle;
- import flash.net.*;
-
- public class CapsuleAlgo
- {
- private var menu:MediaSwf;
-
- private var menuTimeline:MovieClip;
-
- private var menuTL:Timeline;
-
- private var mainClip:MediaSwf;
-
- private var mainTimeline:MovieClip;
-
- private var _engine:Engine;
-
- private var labelList:Array;
-
- private var _timeline_:TimelineLinear;
-
- private var _timelineManager:TimelineManager;
-
- private var _pauseManager:PauseManager;
-
- private var labelsCallback:Object;
-
- private var firstLabel:String;
-
- private var so:SharedObject;
-
- private var myMc:MovieClip;
-
- private var myIm:InteractiveMovie;
-
- private var recipientMc:MovieClip;
-
- private var recipientIm:InteractiveMovie;
-
- private var btHelpMc:MovieClip;
-
- private var btHelpIm:InteractiveMovie;
-
- private var echecIdrassMc:MovieClip;
-
- private var echecIdrassIm:InteractiveMovie;
-
- private var help1Mc:MovieClip;
-
- private var help1Im:InteractiveMovie;
-
- private var help2Mc:MovieClip;
-
- private var help2Im:InteractiveMovie;
-
- private var trappeFermeeMc:MovieClip;
-
- private var trappeFermeeIm:InteractiveMovie;
-
- private var succesMc:MovieClip;
-
- private var succesIm:InteractiveMovie;
-
- private var bloqueMc:MovieClip;
-
- private var activeFiole:MovieClip;
-
- private var countBon:int;
-
- private var countHelp:int;
-
- private var gDrag:MovieClip = null;
-
- public function CapsuleAlgo(engine:Engine)
- {
- this.labelsCallback = {};
- super();
- this._engine = engine;
- this._engine.playMusic({"code":"MU"});
- this._engine.setSubtitles(this._engine.host.subtitlesOn);
- this._engine.setFrameRate(12);
- this.mainClip = this._engine.showSwf({
- "code":"A_" + this._engine.config.moduleName,
- "parent":this._engine.config.layers["content"]
- });
- this.mainTimeline = this.mainClip.swfContent;
- this._timelineManager = new TimelineManager();
- this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
- this._engine.levelCZ = this._engine.config.layers["content"];
- this.so = SharedObject.getLocal(this._engine.config.rubriqueName,"/");
- this.firstLabel = "WAIT_zanim00";
- if(this.so.size !== 0)
- {
- switch(this.so.data.etatJeux[2])
- {
- case 0:
- this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
- break;
- case 1:
- this._timeline_.GotoAndPlayUntil({"labelStop":"ATTENTE_JEU_INTRO_1"});
- break;
- case 2:
- this._timeline_.GotoAndPlayUntil({"labelStop":"_23"});
- }
- }
- else
- {
- this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
- }
- }
-
- public function labelATTENTE_JEU_INTRO_1() : void
- {
- this.so.data.etatJeux[2] = 1;
- this.so.flush();
- this._engine.showLM({
- "id":"LM_TITRE",
- "findModelIn":this.mainTimeline
- });
- this.initBTZap();
- this._engine.playComment(new CommentObject({
- "code":"JEU_INTRO_1",
- "callback":this._timeline_.nextLabel
- }));
- }
-
- public function labelATTENTE_16() : void
- {
- this._engine.playComment(new CommentObject({
- "code":"16",
- "callback":this.stopCleo
- }));
- this.myMc = this.mainTimeline.anim;
- this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
- this.myIm.gotoAndPlayUntilTheEnd(1,this._timeline_.nextLabel);
- }
-
- private function stopCleo() : void
- {
- this.myMc = this.mainTimeline.anim.TETE.BOUCHE;
- this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
- this.myIm.gotoAndStop(1);
- }
-
- public function labelATTENTE() : void
- {
- var i:int;
- this.countBon = 0;
- this.bloqueMc = this.mainTimeline.BLOQUE_FIOLES;
- this.bloqueMc.visible = false;
- this.countHelp = 1;
- for(i = 1; i <= 10; i++)
- {
- this.myMc = this.mainTimeline.DRAGNDROP["FIOLE_" + this.G2D(i)];
- this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
- this.myIm.gotoAndStop(1);
- this.myIm.mc.fiole = i;
- this.myIm.mc.onRollOver = function(p:Object):void
- {
- if(gDrag == null)
- {
- _engine.changeCursor("mainO");
- _engine.showIB({
- "id":"IB_FIOLE_" + G2D(this.fiole),
- "x":this.x + 115,
- "y":this.y + 160 + 40
- });
- _engine.playNoise(new NoiseObject({"code":"B_FIOLE_ROLL"}));
- }
- else
- {
- this.gotoAndStop("E1");
- }
- };
- this.myIm.mc.onRollOut = function(p:Object):void
- {
- if(gDrag == null)
- {
- _engine.changeCursor("auto");
- _engine.hideIB();
- _engine.stopNoise(new NoiseObject({"code":"B_FIOLE_ROLL"}));
- }
- };
- this.myIm.mc.onMouseDown = function(p:Object):void
- {
- if(gDrag == null)
- {
- gDrag = this;
- this.onCible = undefined;
- this.diffX = this.stage.mouseX - this.x;
- this.diffY = this.stage.mouseY - this.y;
- _engine.hideIB();
- _engine.stopNoise(new NoiseObject({"code":"B_FIOLE_ROLL"}));
- _engine.playNoise(new NoiseObject({"code":"B_FIOLE_CLIC"}));
- _engine.changeCursor("mainF");
- }
- };
- this.myIm.mc.onMouseUp = function(p:Object):void
- {
- if(gDrag == this)
- {
- bloqueMc.visible = true;
- if(Boolean(this.hitTestPoint(this.stage.mouseX,this.stage.mouseY,false)))
- {
- _engine.changeCursor("mainO");
- }
- else
- {
- _engine.changeCursor("auto");
- }
- if(this.onCible == undefined)
- {
- this.returnOrigPoint();
- _engine.playNoise(new NoiseObject({"code":"B_BACK"}));
- bloqueMc.visible = false;
- gDrag = null;
- }
- else
- {
- _engine.changeCursor("auto");
- activeFiole = this;
- this.enabled = false;
- this.BTN.visible = false;
- this.returnOrigPoint();
- this.gotoAndStop("E3");
- myMc = this.anim;
- myIm = new InteractiveMovie(myMc,_timelineManager);
- myIm.gotoAndPlayUntilTheEnd(1,suiteFiole);
- }
- }
- };
- this.myIm.mc.onEnterFrame = function(p:Object):void
- {
- var tpoint:Point = null;
- var myRect:Rectangle = null;
- var diff:Number = NaN;
- if(gDrag == this)
- {
- tpoint = new Point(this.stage.mouseX,this.stage.mouseY);
- this.x = this.stage.mouseX - this.diffX;
- this.y = this.stage.mouseY - this.diffY;
- myRect = this.getBounds(_engine.config.layers["content"]);
- this.onCible = undefined;
- if(myRect.x < 0)
- {
- diff = 0 - myRect.x;
- this.x += diff;
- }
- else if(myRect.x + myRect.width > 800)
- {
- diff = myRect.x + myRect.width - 800;
- this.x -= diff;
- }
- if(myRect.y < 0)
- {
- diff = 0 - myRect.y;
- this.y += diff;
- }
- else if(myRect.y + myRect.height > 600)
- {
- diff = myRect.y + myRect.height - 600;
- this.y -= diff;
- }
- if(Boolean(mainTimeline.ZONE_DROP.hitTestPoint(tpoint.x,tpoint.y,true)))
- {
- this.onCible = true;
- }
- }
- };
- this.myIm.activeDragAndDropMC();
- }
- this.recipientMc = this.mainTimeline.RECIPIENT;
- this.recipientIm = new InteractiveMovie(this.recipientMc,this._timelineManager);
- this.recipientIm.gotoAndStop(1);
- this.btHelpMc = this.mainTimeline.BT_HELP;
- this.btHelpIm = new InteractiveMovie(this.btHelpMc,this._timelineManager);
- this.btHelpIm.gotoAndStop(1);
- this.btHelpIm.mc.onRollOver = function(p:Object):void
- {
- _engine.showIB({
- "id":"IB_HELP",
- "x":this.x,
- "y":this.y + 40
- });
- _engine.playNoise(new NoiseObject({"code":"B_HELP"}));
- };
- this.btHelpIm.mc.onRollOut = function(p:Object):void
- {
- _engine.hideIB();
- _engine.stopNoise(new NoiseObject({"code":"B_HELP"}));
- };
- this.btHelpIm.mc.onPress = function(p:Object):void
- {
- _engine.hideIB();
- _engine.stopNoise(new NoiseObject({"code":"B_HELP"}));
- gereHelp();
- };
- this.btHelpIm.activeMC();
- this.echecIdrassMc = this.mainTimeline.ECHEC_IRASS;
- this.echecIdrassIm = new InteractiveMovie(this.echecIdrassMc,this._timelineManager);
- this.echecIdrassIm.gotoAndStop(1);
- this.echecIdrassMc.visible = false;
- this.trappeFermeeMc = this.mainTimeline.TRAPPE_FERMEE;
- this.trappeFermeeIm = new InteractiveMovie(this.trappeFermeeMc,this._timelineManager);
- this.trappeFermeeIm.gotoAndStop(1);
- this.help1Mc = this.mainTimeline.HELP_1;
- this.help1Im = new InteractiveMovie(this.help1Mc,this._timelineManager);
- this.help1Im.gotoAndStop(1);
- this.help1Mc.visible = false;
- this.help2Mc = this.mainTimeline.HELP_2;
- this.help2Im = new InteractiveMovie(this.help2Mc,this._timelineManager);
- this.help2Im.gotoAndStop(1);
- this.help2Mc.visible = false;
- this.succesMc = this.mainTimeline.SUCCES_JEU;
- this.succesIm = new InteractiveMovie(this.succesMc,this._timelineManager);
- this.succesIm.gotoAndStop(1);
- this.succesMc.visible = false;
- }
-
- private function suiteFiole() : void
- {
- this.gDrag = null;
- this.activeFiole.visible = false;
- if(this.activeFiole.fiole <= 3)
- {
- this.countBon += 1;
- this.recipientIm.gotoAndStop("E2");
- this._engine.playNoise(new NoiseObject({
- "code":"B_RECIPIENT_E2",
- "callback":this.suiteBon
- }));
- }
- else
- {
- this.recipientIm.gotoAndStop("E3");
- this._engine.playNoise(new NoiseObject({
- "code":"B_RECIPIENT_E3",
- "callback":this.suitePasBon
- }));
- }
- }
-
- private function suiteBon() : void
- {
- if(this.countBon == 3)
- {
- this.so.data.etatJeux[2] = 2;
- this.so.flush();
- this._engine.playNoise(new NoiseObject({"code":"B_SUCCES_JEU"}));
- this.trappeFermeeMc.visible = false;
- this.succesMc.visible = true;
- this.succesIm.gotoAndPlayUntilTheEnd(1);
- this._engine.playComment(new CommentObject({
- "code":"JEU_SUCCESS_IRASS",
- "callback":this.suiteSucces
- }));
- }
- else
- {
- this.bloqueMc.visible = false;
- }
- this.recipientIm.gotoAndStop("E1");
- }
-
- private function suitePasBon() : void
- {
- this._timeline_.GotoAndPlayUntil({"labelStop":"_JEU_ECHEC_JEU_1"});
- }
-
- private function suiteSucces() : void
- {
- this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_transition_ouvre"});
- }
-
- private function gereHelp() : void
- {
- this.trappeFermeeMc.visible = false;
- switch(this.countHelp)
- {
- case 1:
- this.help1Mc.visible = true;
- this.help1Im.gotoAndPlayUntilTheEnd(1);
- this._engine.playComment(new CommentObject({
- "code":"JEU_HELP_1",
- "callback":this.suiteHelp
- }));
- break;
- case 2:
- this.help2Mc.visible = true;
- this.help2Im.gotoAndPlayUntilTheEnd(1);
- this._engine.playComment(new CommentObject({
- "code":"JEU_HELP_2",
- "callback":this.suiteHelp
- }));
- break;
- case 3:
- this.echecIdrassMc.visible = true;
- this.echecIdrassIm.gotoAndPlayUntilTheEnd(1);
- this._engine.playComment(new CommentObject({
- "code":"JEU_ECHEC_IRASS",
- "callback":this.suiteHelp
- }));
- }
- }
-
- private function suiteHelp() : void
- {
- switch(this.countHelp)
- {
- case 1:
- this.help1Mc.visible = false;
- this.trappeFermeeMc.visible = true;
- this.countHelp += 1;
- break;
- case 2:
- this.help2Mc.visible = false;
- this.trappeFermeeMc.visible = true;
- this.countHelp += 1;
- break;
- case 3:
- this.echecIdrassMc.visible = false;
- this.trappeFermeeMc.visible = true;
- this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_transition_ouvre"});
- }
- }
-
- private function initBTZap() : void
- {
- this.myMc = this.mainTimeline.BT_ZAP;
- this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
- this.myIm.gotoAndStop(1);
- this.myIm.mc.onRollOver = function(p:Object):void
- {
- _engine.playNoise(new NoiseObject({"code":"B_ZAP"}));
- _engine.showIB({
- "id":"IB_ZAP",
- "x":this.x,
- "y":this.y + 25
- });
- };
- this.myIm.mc.onRollOut = function(p:Object):void
- {
- _engine.stopNoise(new NoiseObject({"code":"B_ZAP"}));
- _engine.hideIB();
- };
- this.myIm.mc.onPress = function(p:Object):void
- {
- so.data.etatJeux[2] = 2;
- so.flush();
- _engine.hideIB();
- _engine.stopNoise(new NoiseObject({"code":"B_ZAP"}));
- trappeFermeeMc.visible = false;
- echecIdrassMc.visible = true;
- echecIdrassIm.gotoAndPlayUntilTheEnd(1);
- _engine.playComment(new CommentObject({
- "code":"JEU_ECHEC_IRASS",
- "callback":suiteZap
- }));
- };
- this.myIm.activeMC();
- }
-
- public function suiteZap() : void
- {
- this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_transition_ouvre"});
- }
-
- public function G2D(value:int) : String
- {
- return GlobalesFunctions.gimme2digits(value);
- }
-
- private function goNextModule() : void
- {
- }
-
- public function endMODULE() : void
- {
- trace("fin du module");
- this.so.data.ecranEnCours = 3;
- this._engine.host.changeModule({"numMod":this.so.data.ecranEnCours});
- }
-
- public function sleep() : void
- {
- this._pauseManager = new PauseManager(this._engine,this._timelineManager);
- this._pauseManager.sleepMovie(this.mainTimeline);
- }
-
- public function wake() : void
- {
- if(this._pauseManager != null)
- {
- this._pauseManager.wakeMovie(this.mainTimeline);
- }
- }
-
- public function destroy() : void
- {
- this._engine.stopAllSounds();
- this._timeline_.kilListeners();
- }
- }
- }
-
-