home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 149
/
MOBICLIC149.ISO
/
pc
/
DATA
/
DSS149
/
DSS149_01
/
DSS149_01.swf
/
scripts
/
dss149_01
/
CapsuleAlgo.as
< prev
Wrap
Text File
|
2012-11-21
|
28KB
|
745 lines
package dss149_01
{
import com.milanpresse.engine.Engine;
import com.milanpresse.engine.initmovieclip.InteractiveMovie;
import com.milanpresse.engine.managers.PauseManager;
import com.milanpresse.engine.managers.TimelineManager;
import com.milanpresse.engine.medias.MediaSwf;
import com.milanpresse.engine.timelines.Timeline;
import com.milanpresse.engine.timelines.TimelineLinear;
import com.milanpresse.engine.typeargument.CommentObject;
import com.milanpresse.engine.typeargument.NoiseObject;
import com.milanpresse.tools.GlobalesFunctions;
import flash.display.MovieClip;
import flash.geom.Point;
import flash.net.SharedObject;
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 animMc:MovieClip;
private var animTl:Timeline;
private var doneZones:Array;
private var chandaMc:InteractiveMovie;
private var BT_OK:InteractiveMovie;
private var vigOrder:Array;
private var listCibles:Array;
private var gDrag:MovieClip = null;
private var cibleFound:int;
private var animEtape:int;
private var gLastVIG:MovieClip;
private var portrait:MovieClip;
private var countGardes:int;
private var listeRolledVIG:Array;
public function CapsuleAlgo(engine:Engine)
{
this.labelsCallback = {
"ATTENTE_01":this.attente01,
"ATTENTE_02":this.attente02,
"_03":this.anim03,
"ATTENTE_03":this.attente03,
"_JEU01_01":this.initJeu01,
"ATTENTE_04":this.attente04,
"ANIM_GAGNE":this.suiteAnimGagne
};
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"]
});
trace("mainClip",this.mainClip);
this.mainTimeline = this.mainClip.swfContent;
trace("mainTimeline",this.mainTimeline);
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,"/");
trace("so.data.etatJeux",this.so.data.etatJeux);
this.so.data.ecranEnCours = 1;
this.so.flush();
switch(this.so.data.etatJeux[this._engine.config.moduleNum - 1])
{
case 0:
this.firstLabel = this.mainTimeline.currentLabels[0].name;
break;
case 1:
this.firstLabel = "_24";
}
this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
}
private function attente01() : void
{
trace("MALLE MALLE");
this.mainTimeline.INTER_MALLE.TROUSSEAU.visible = false;
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.INTER_MALLE.MALLE,this._timelineManager);
myMc.gotoAndStop(1);
myMc.mc.mcI = myMc;
myMc.mc.onRollOver = function(p:Object):void
{
this.mcI.gotoAndStop("E2");
};
myMc.mc.onRollOut = function(p:Object):void
{
this.mcI.gotoAndStop(1);
};
myMc.mc.onPress = function(p:Object):void
{
this.mcI.gotoAndStop("E3");
_engine.playNoise(new NoiseObject({"code":"B_MALLE"}));
this.enabled = false;
this.buttonMode = false;
mainTimeline.INTER_MALLE.TROUSSEAU.visible = true;
_engine.playComment(new CommentObject({
"code":"INT_01_02",
"callback":activateKeys
}));
};
myMc.activeMC();
}
private function activateKeys() : void
{
var countTries:int = 0;
var myMc:InteractiveMovie = null;
countTries = 0;
for(var i:int = 1; i <= 10; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.INTER_MALLE.TROUSSEAU["CLE_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
myMc.mc.cle = i;
myMc.mc.onPress = function(p:Object):void
{
if(this.cle == 1)
{
_timeline_.nextLabel();
}
else
{
_engine.playNoise(new NoiseObject({"code":"B_NO"}));
countTries += 1;
if(countTries == 3)
{
_engine.playComment(new CommentObject({"code":"INT_01_03"}));
}
}
};
myMc.activeMC();
}
}
private function attente02() : void
{
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.DANSEUSE,this._timelineManager);
myMc.gotoAndStop(1);
myMc.mc.rollOverFrame = "E1";
myMc.mc.mcI = myMc;
myMc.mc.onRollOver = function(p:Object):void
{
_engine.playNoise(new NoiseObject({"code":"B_FILLE"}));
};
myMc.mc.onRollOut = function(p:Object):void
{
_engine.stopNoise(new NoiseObject({"code":"B_FILLE"}));
};
myMc.mc.onPress = function(p:Object):void
{
_engine.stopNoise(new NoiseObject({"code":"B_FILLE"}));
this.mcI.gotoAndStop("E2");
animMc = this.ANIM;
animTl = new Timeline(animMc,_timelineManager);
animTl.GotoAndPlayUntilTheEnd(1,_timeline_.nextLabel);
this.enabled = false;
this.buttonMode = false;
};
myMc.activeMC();
}
private function anim03() : void
{
this._engine.playComment(new CommentObject({
"code":"03",
"zapBlock":"NOZAP_NOBLOCK"
}));
this.animMc = this.mainTimeline.ANIM_03.CHARETTE;
this.animTl = new Timeline(this.animMc,this._timelineManager);
this.animTl.GotoAndPlayUntilTheEnd(1,this._timeline_.nextLabel);
}
public function label_15() : void
{
var anim15_Tl:Timeline = new Timeline(this.mainTimeline.anim.PRIEUR.TETE,this._timelineManager);
anim15_Tl.GotoAndStop(1);
}
private function attente03() : void
{
var myMc:InteractiveMovie = null;
if(this.doneZones == null)
{
this.doneZones = new Array(0,0,0,0,0);
}
for(var i:int = 1; i <= 5; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.ZONES["ZONE_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
myMc.mc.zone = i;
if(this.doneZones[i - 1] !== 0)
{
myMc.gotoAndStop("E3");
}
else
{
myMc.mc.onRollOver = function(p:Object):void
{
_engine.playNoise(new NoiseObject({"code":"B_" + GlobalesFunctions.gimme2digits(this.zone)}));
_engine.showIB({
"id":"IB_" + GlobalesFunctions.gimme2digits(this.zone),
"x":this.stage.mouseX,
"y":this.stage.mouseY - 30
});
};
myMc.mc.onRollOut = function(p:Object):void
{
_engine.stopNoise(new NoiseObject({"code":"B_" + GlobalesFunctions.gimme2digits(this.zone)}));
_engine.hideIB();
};
myMc.mc.onPress = function(p:Object):void
{
_engine.hideIB();
_timeline_.GotoAndStop("_" + GlobalesFunctions.gimme2digits(this.zone) + "_01");
_engine.playComment(new CommentObject({
"code":GlobalesFunctions.gimme2digits(this.zone) + "_01",
"callback":testFin03
}));
doneZones[this.zone - 1] = 1;
};
myMc.activeMC();
}
}
}
private function testFin03() : void
{
if(this.doneZones.indexOf(0) != -1)
{
this._timeline_.GotoAndPlayUntil({"labelStop":"ATTENTE_03"});
}
else
{
this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_zanim19"});
}
}
private function initJeu01() : void
{
var myMc:InteractiveMovie = null;
this._engine.playComment(new CommentObject({
"code":"JEU01_01",
"callback":this._timeline_.nextLabel
}));
this.animMc = this.mainTimeline.ANIM;
this.animTl = new Timeline(this.animMc,this._timelineManager);
this.animTl.GotoAndPlayUntilTheEnd(1);
this.chandaMc = new InteractiveMovie(this.mainTimeline.CHANDRA,this._timelineManager);
this.chandaMc.gotoAndStop(1);
this.chandaMc.mc.mcI = this.chandaMc;
this.vigOrder = GlobalesFunctions.randomArray([1,2,3,4,5,6]);
trace("vigOrder",this.vigOrder);
for(var i:int = 1; i <= 6; i++)
{
myMc = new InteractiveMovie(this.mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(this.vigOrder[i - 1]);
myMc.mc.vig = i;
this.animMc = myMc.mc.VIG;
this.animTl = new Timeline(this.animMc,this._timelineManager);
this.animTl.GotoAndStop(1);
}
}
public function label_JEU01_03() : void
{
this.chandaMc.gotoAndPlayUntil({
"labelPlay":"E2",
"beforeLabelStop":"E3"
});
}
private function attente04() : void
{
var myMc:InteractiveMovie = null;
this.chandaMc.gotoAndStop("E1");
this.chandaMc.mc.onRollOver = function(p:Object):void
{
_engine.playNoise(new NoiseObject({"code":"B_CHANDA"}));
this.mcI.gotoAndPlayUntil({
"labelPlay":"E2",
"beforeLabelStop":"E3"
});
};
this.chandaMc.mc.onRollOut = function(p:Object):void
{
_engine.stopNoise(new NoiseObject({"code":"B_CHANDA"}));
};
this.chandaMc.mc.onPress = function(p:Object):void
{
this.mcI.gotoAndStop("E3");
_engine.playComment(new CommentObject({
"code":"JEU01_AIDE",
"callback":stopChanda
}));
this.enabled = false;
};
this.chandaMc.activeMC();
myMc = new InteractiveMovie(this.mainTimeline["BT_OK"],this._timelineManager);
myMc.gotoAndStop(1);
myMc.mc.mcI = myMc;
myMc.mc.onRollOver = function(p:Object):void
{
_engine.playNoise(new NoiseObject({"code":"B_OK"}));
this.mcI.gotoAndPlayUntilTheEnd("E2");
};
myMc.mc.onRollOut = function(p:Object):void
{
_engine.stopNoise(new NoiseObject({"code":"B_OK"}));
};
myMc.mc.onPress = function(p:Object):void
{
var i:int = 0;
trace(vigOrder);
if(vigOrder.toString() == "1,2,3,4,5,6")
{
_engine.stopNoise(new NoiseObject({"code":"B_OK"}));
_engine.playNoise(new NoiseObject({"code":"B_GAGNE"}));
_timeline_.GotoAndPlayUntil({"labelStop":"WAIT_zanimGAGNE"});
animMc = mainTimeline.zanimGAGNE;
animTl = new Timeline(animMc,_timelineManager);
animTl.GotoAndPlayUntilTheEnd(1,initAnimGagne);
for(i = 1; i <= 6; i++)
{
myMc = new InteractiveMovie(mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)],_timelineManager);
myMc.mc.enabled = false;
myMc.mc.buttonMode = false;
}
so.data.etatJeux[0] = 1;
so.flush();
}
else
{
_engine.stopNoise(new NoiseObject({"code":"B_OK"}));
_engine.playNoise(new NoiseObject({"code":"B_PERDU"}));
}
};
myMc.activeMC();
this.BT_OK = myMc;
this.listeRolledVIG = [];
for(var i:int = 1; i <= 6; i++)
{
myMc = new InteractiveMovie(this.mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(this.vigOrder[i - 1]);
myMc.mc.vig = i;
myMc.mc.mcI = myMc;
myMc.mc.onRollOver = function(p:Object):void
{
var VIG_tl:Timeline = null;
if(gDrag == null)
{
if(this.rolled == null)
{
testeRolledVIG();
this.rolled = 1;
VIG_tl = new Timeline(this.VIG,_timelineManager);
VIG_tl.GotoAndStop("E2");
_engine.playNoise(new NoiseObject({"code":"B_ROLL"}));
}
}
};
myMc.mc.onRollOut = function(p:Object):void
{
var VIG_tl:Timeline = null;
if(gDrag == null)
{
this.rolled = null;
testeRolledVIG();
VIG_tl = new Timeline(this.VIG,_timelineManager);
VIG_tl.GotoAndStop("E1");
_engine.stopNoise(new NoiseObject({"code":"B_ROLL"}));
}
};
myMc.mc.onMouseDown = function(p:Object):void
{
var VIG_tl:Timeline = null;
if(gDrag == null)
{
if(_engine.pad !== null)
{
_engine.pad.activated = false;
}
BT_OK.desactive();
gDrag = this;
this.pCible = undefined;
VIG_tl = new Timeline(this.VIG,_timelineManager);
VIG_tl.GotoAndStop("E1");
_engine.playNoise(new NoiseObject({"code":"B_CLIC"}));
this.diffX = this.stage.mouseX - this.x;
this.diffY = this.stage.mouseY - this.y;
}
};
myMc.mc.onMouseUp = function(p:Object):void
{
var cibleMc:MovieClip = null;
var cibleImage:int = 0;
var dragImage:int = 0;
var VIG_tl:Timeline = null;
var cible_tl:Timeline = null;
var cibleVIG_tl:Timeline = null;
if(gDrag == this)
{
if(_engine.pad !== null)
{
_engine.pad.activated = true;
}
this.returnOrigPoint();
if(cibleFound == 0)
{
_engine.playNoise(new NoiseObject({"code":"B_NO"}));
}
else
{
cibleMc = mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(cibleFound)];
cibleImage = cibleMc.currentFrame;
dragImage = this.currentFrame;
_engine.playNoise(new NoiseObject({"code":"B_DEPOT"}));
this.mcI.gotoAndStop(cibleImage);
VIG_tl = new Timeline(this.VIG,_timelineManager);
VIG_tl.GotoAndStop("E1");
cible_tl = new Timeline(cibleMc,_timelineManager);
cible_tl.GotoAndStop(dragImage);
cibleVIG_tl = new Timeline(cibleMc.VIG,_timelineManager);
cibleVIG_tl.GotoAndStop("E1");
vigOrder[cibleFound - 1] = dragImage;
vigOrder[this.vig - 1] = cibleImage;
cibleFound = 0;
gLastVIG = this;
trace("vigOrder",vigOrder);
}
gDrag = null;
this.rolled = null;
BT_OK.active();
}
};
myMc.mc.onEnterFrame = function(p:Object):void
{
var VIG_tl:Timeline = null;
var generalMc:MovieClip = null;
this.x = this.stage.mouseX - this.diffX;
this.y = this.stage.mouseY - this.diffY;
var tpoint:Point = new Point(this.stage.mouseX,this.stage.mouseY);
cibleFound = 0;
for(var i:int = 1; i <= 6; i++)
{
if(this.vig !== i)
{
generalMc = mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)];
if(generalMc.hitTestPoint(tpoint.x,tpoint.y,true))
{
cibleFound = i;
break;
}
}
}
if(cibleFound !== 0)
{
if(this.pCible == undefined)
{
this.pCible = generalMc;
VIG_tl = new Timeline(this.VIG,_timelineManager);
VIG_tl.GotoAndStop("E3");
}
}
else if(this.pCible !== undefined)
{
this.pCible = undefined;
VIG_tl = new Timeline(this.VIG,_timelineManager);
VIG_tl.GotoAndStop("E1");
}
};
myMc.activeDragAndDropMC();
}
myMc = new InteractiveMovie(this.mainTimeline["FOND"],this._timelineManager);
myMc.onRollOver = function(p:Object):void
{
testeRolledVIG();
};
myMc.activeMC();
myMc.mc.useHandCursor = false;
myMc.mc.buttonMode = false;
}
private function testeRolledVIG() : void
{
var myMc:MovieClip = null;
for(var i:int = 1; i <= 6; i++)
{
myMc = this.mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)];
if(myMc.rolled == 1)
{
myMc.onRollOut({});
}
}
}
private function stopChanda() : void
{
this.chandaMc.mc.enabled = true;
this.chandaMc.gotoAndStop("E1");
}
private function initAnimGagne() : void
{
var bt:BtSuite = new BtSuite(this._engine,this._timelineManager,this._timeline_);
this.animEtape = 0;
this._timeline_.GotoAndPlayUntil({"labelStop":"ANIM_GAGNE"});
}
public function suiteAnimGagne() : void
{
var myMc:InteractiveMovie = null;
if(this.animEtape == 6)
{
this._engine.hideSwf({"code":"BT_SUITE"});
this._timeline_.GotoAndPlayUntil({"labelStop":"_21"});
}
else
{
this.animEtape += 1;
this._engine.playComment(new CommentObject({
"code":"J01_" + GlobalesFunctions.gimme2digits(this.animEtape),
"callback":this.suiteAnimGagne
}));
myMc = new InteractiveMovie(this.mainTimeline.VIG,this._timelineManager);
myMc.gotoAndStop(this.animEtape);
myMc = new InteractiveMovie(this.mainTimeline.VIG.VIG,this._timelineManager);
myMc.gotoAndStop("E2");
this.animMc = this.mainTimeline.VIG.VIG.ANIM;
this.animTl = new Timeline(this.animMc,this._timelineManager);
this.animTl.GotoAndPlayUntilTheEnd(1);
}
}
private function adapteVIG() : void
{
this.gLastVIG.height = 600;
this.gLastVIG.width = 800;
}
public function label_JEU02_01() : void
{
var i:int = 0;
var myMc:InteractiveMovie = null;
for(i = 1; i <= 3; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
}
for(i = 1; i <= 3; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.JEU_02["GARDE_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
}
for(i = 1; i <= 8; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.JEU_02["C" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
}
for(i = 1; i <= 6; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.JEU_02["D" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
}
}
public function labelATTENTE_05() : void
{
var i:int = 0;
var myMc:InteractiveMovie = null;
this.countGardes = 0;
for(i = 1; i <= 3; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
myMc.mc.zone = i;
myMc.mc.mcI = myMc;
myMc.mc.onRollOver = function(p:Object):void
{
this.mcI.gotoAndStop("E2");
animMc = this.ANIM;
animTl = new Timeline(animMc,_timelineManager);
animTl.GotoAndPlayUntilTheEnd(1);
_engine.playNoise(new NoiseObject({"code":"B_P_" + GlobalesFunctions.gimme2digits(this.zone)}));
_engine.showIB({
"id":"IB_P_" + GlobalesFunctions.gimme2digits(this.zone),
"x":this.stage.mouseX,
"y":120
});
};
myMc.mc.onRollOut = function(p:Object):void
{
this.mcI.gotoAndStop("E1");
_engine.stopNoise(new NoiseObject({"code":"B_P_" + GlobalesFunctions.gimme2digits(this.zone)}));
_engine.hideIB();
};
myMc.mc.onPress = function(p:Object):void
{
this.mcI.gotoAndStop("E3");
portrait = this;
_engine.hideIB();
_engine.playComment(new CommentObject({
"code":"JEU02_P" + GlobalesFunctions.gimme2digits(this.zone),
"callback":stopPortrait
}));
};
myMc.activeMC();
}
for(i = 1; i <= 3; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.JEU_02["GARDE_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
myMc.mc.zone = i;
myMc.mc.mcI = myMc;
myMc.mc.onRollOver = function(p:Object):void
{
this.mcI.gotoAndStop("E1");
};
myMc.mc.onRollOut = function(p:Object):void
{
this.mcI.gotoAndStop("E1");
};
myMc.mc.onPress = function(p:Object):void
{
_engine.playNoise(new NoiseObject({"code":"B_GOOD"}));
this.mcI.gotoAndStop("E2");
animMc = this.ANIM;
animTl = new Timeline(animMc,_timelineManager);
animTl.GotoAndPlayUntilTheEnd(1,testGardes);
this.enabled = false;
this.buttonMode = false;
mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(this.zone)].gotoAndStop("E4");
mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(this.zone)].enabled = false;
mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(this.zone)].buttonMode = false;
};
myMc.activeMC();
}
for(i = 1; i <= 8; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.JEU_02["C" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
myMc.mc.zone = i;
myMc.mc.onPress = function(p:Object):void
{
_engine.playNoise(new NoiseObject({"code":"B_BAD"}));
};
myMc.activeMC();
}
for(i = 1; i <= 6; i++)
{
myMc = new InteractiveMovie(this.mainTimeline.JEU_02["D" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
myMc.gotoAndStop(1);
myMc.mc.zone = i;
myMc.mc.onPress = function(p:Object):void
{
_engine.playNoise(new NoiseObject({"code":"B_BAD"}));
};
myMc.activeMC();
}
}
private function stopPortrait() : void
{
this.portrait.gotoAndStop("E1");
}
private function testGardes() : void
{
this.countGardes += 1;
if(this.countGardes == 3)
{
this.so.data.ecranEnCours = 2;
this.so.flush();
this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_zanimGAGNE05"});
}
}
public function endMODULE() : void
{
trace("fin du module");
this._engine.host.changeModule({"numMod":2});
}
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();
}
}
}