home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 145
/
MOBICLIC145.ISO
/
pc
/
DATA
/
DSS145
/
DSS145_00
/
DSS145_00.swf
/
scripts
/
dss145_00
/
CapsuleAlgo.as
Wrap
Text File
|
2012-07-18
|
22KB
|
646 lines
package dss145_00
{
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.MediaImage;
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.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 goLabelATTENTE:String;
private var BT_ZAP_INTRO:InteractiveMovie;
private var zapIntroDone:Boolean = false;
private var gClic:int;
private var gRoll:MovieClip;
private var gListDone:Array;
private var gDoneMythe:Boolean = false;
private var gFromNumMod:int;
private var TRANSITION:InteractiveMovie;
private var gImageNum:int;
private var playedDER_EPR:Boolean = false;
public function CapsuleAlgo(engine:Engine)
{
var fromSommaire:Boolean = false;
this.labelsCallback = {
"MEMORISATION":this.initMEMO,
"_01_OK":this.label_OK,
"_01_NO":this.label_NO,
"DER_EPR":this.label_DER_EPR,
"_NO":this.label_NO,
"_02_OK":this.label_OK,
"_03_OK":this.label_OK,
"_04_OK":this.label_OK,
"_05_OK":this.label_OK,
"_06_OK":this.label_OK,
"_07_OK":this.label_OK,
"_08_OK":this.label_OK,
"_09_OK":this.label_OK,
"_10_OK":this.label_OK,
"_11_OK":this.label_OK
};
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,"/");
trace("_engine.config.callerParameters",this._engine.config.callerParameters.fromCodeRub);
if(this._engine.config.callerParameters.fromCodeRub == null)
{
this.gListDone = [1,1,1,1,1,1,1,1,1,1,1,1];
this.so.data.listDone = this.gListDone;
this.so.data.doneMythe = this.gDoneMythe;
this.so.flush();
}
if(this.so.size == 0)
{
trace("premiere fois, pas d\'enregistrement");
this.gListDone = [0,0,0,0,0,0,0,0,0,0,0,0];
this.so.data.listDone = this.gListDone;
this.so.data.doneMythe = this.gDoneMythe;
this.so.flush();
this.initINTRO();
}
else
{
this.gListDone = this.so.data.listDone;
this.gDoneMythe = this.so.data.doneMythe;
trace("gListDone",this.gListDone);
trace("config.callerParameters",this._engine.config.callerParameters.fromCodeRub);
trace("_engine.config.callerParameters.fromId",this._engine.config.callerParameters.fromId);
fromSommaire = this._engine.config.callerParameters.fromCodeRub == "MOB";
if(fromSommaire == true)
{
this.firstLabel = "MEMORISATION";
}
else
{
this.gFromNumMod = this._engine.config.callerParameters.fromNumMod;
trace("so.data.lastDone",this.so.data.lastDone);
switch(this.so.data.lastDone)
{
case 0:
trace("n\'a pas fini le jeu ou le recit");
if(this.gFromNumMod == 1)
{
this.firstLabel = "_01_NO";
}
else
{
this.firstLabel = "_NO";
}
break;
case 1:
trace("a fini le jeu ou le recit");
this.firstLabel = "_" + this.G2D(this.gFromNumMod) + "_OK";
break;
case 2:
trace("avait deja fini le jeu ou le recit");
this.firstLabel = this.findLabelATTENTE();
}
}
}
this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
}
public function findLabelATTENTE() : String
{
var myLabel:String = null;
switch(this.gListDone.indexOf(0))
{
case -1:
myLabel = "ATTENTE_CLIC_12";
break;
case 0:
myLabel = "ATTENTE_CLIC_01";
break;
case 11:
if(this.playedDER_EPR == false)
{
myLabel = "DER_EPR";
}
else
{
myLabel = "ATTENTE_CLIC_12";
}
break;
default:
myLabel = "ATTENTE_CLIC";
}
return myLabel;
}
public function initINTRO() : void
{
this.goLabelATTENTE = "ATTENTE_CLIC_01";
this.firstLabel = "I_01";
var BT_ZAP_INTROswf:MediaSwf = this._engine.showSwf({
"code":"BT_ZAP_INTRO",
"parent":this._engine.config.layers["menu"]
});
this.BT_ZAP_INTRO = new InteractiveMovie(BT_ZAP_INTROswf.swfContent,this._timelineManager);
this.BT_ZAP_INTRO.gotoAndStop(1);
this.BT_ZAP_INTRO.mc.onRollOver = function(p:Object):void
{
this.gotoAndStop(2);
_engine.playNoise(new NoiseObject({"code":"B_BT_ZAP"}));
};
this.BT_ZAP_INTRO.mc.onRollOut = function(p:Object):void
{
this.gotoAndStop(1);
_engine.stopNoise(new NoiseObject({"code":"B_BT_ZAP"}));
};
this.BT_ZAP_INTRO.mc.onPress = function(p:Object):void
{
_engine.stopNoise(new NoiseObject({"code":"B_BT_ZAP"}));
this.kill();
_engine.hideSwf({"code":"BT_ZAP_INTRO"});
_timeline_.GotoAndStop(goLabelATTENTE);
zapIntroDone = true;
labelATTENTE_CLIC_01();
};
this.BT_ZAP_INTRO.activeMC();
}
public function initMEMO() : void
{
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline["BT_REPRISE"],this._timelineManager);
myMc.gotoAndStop("E1");
myMc.mc.pNoiseRoll = "B_REPRISE_ROLL";
myMc.mc.pNoiseClic = "B_REPRISE_CLIC";
myMc.mc.onRollOver = function(p:Object):void
{
this.gotoAndStop("E2");
_engine.playNoise(new NoiseObject({"code":this.pNoiseRoll}));
};
myMc.mc.onRollOut = function(p:Object):void
{
this.gotoAndStop("E1");
_engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
};
myMc.mc.onPress = function(p:Object):void
{
this.gotoAndStop("E3");
_engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
_engine.playNoise(new NoiseObject({"code":this.pNoiseClic}));
this.kill();
zapIntroDone = true;
_timeline_.GotoAndPlayUntil({"labelStop":findLabelATTENTE()});
};
myMc.activeMC();
myMc = new InteractiveMovie(this.mainTimeline["BT_NOUVELLE"],this._timelineManager);
myMc.gotoAndStop("E1");
myMc.mc.pNoiseRoll = "B_NOUVELLE_ROLL";
myMc.mc.pNoiseClic = "B_NOUVELLE_CLIC";
myMc.mc.onRollOver = function(p:Object):void
{
this.gotoAndStop("E2");
_engine.playNoise(new NoiseObject({"code":this.pNoiseRoll}));
};
myMc.mc.onRollOut = function(p:Object):void
{
this.gotoAndStop("E1");
_engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
};
myMc.mc.onPress = function(p:Object):void
{
this.gotoAndStop("E3");
_engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
_engine.playNoise(new NoiseObject({"code":this.pNoiseClic}));
this.kill();
gDoneMythe = false;
gListDone = [0,0,0,0,0,0,0,0,0,0,0,0];
so.data.listDone = gListDone;
so.data.doneMythe = gDoneMythe;
so.flush();
initINTRO();
firstLabel = "I_01";
_timeline_.GotoAndPlayUntil({"labelStop":firstLabel});
};
myMc.activeMC();
}
public function label_DER_EPR() : void
{
trace("label_DER_EPR");
this.playedDER_EPR = true;
this._engine.playComment(new CommentObject({
"code":"DER_EPR",
"callback":this.finReturnSon
}));
}
public function label_OK() : void
{
trace("label_OK");
this._engine.playComment(new CommentObject({
"code":this.G2D(this.gFromNumMod) + "_OK",
"callback":this.finReturnSon
}));
}
public function label_NO() : void
{
trace("label_NO");
this._engine.playComment(new CommentObject({
"code":this.G2D(this.gFromNumMod) + "_NO",
"callback":this.finReturnSon
}));
}
public function finReturnSon() : void
{
this.zapIntroDone = true;
this._timeline_.GotoAndPlayUntil({"labelStop":this.findLabelATTENTE()});
}
public function labelATTENTE_CLIC_01() : void
{
var myMc:InteractiveMovie = null;
if(this.zapIntroDone == false)
{
this._engine.hideSwf({"code":"BT_ZAP_INTRO"});
}
this._engine.playComment(new CommentObject({"code":"ATTENTE_CLIC_01"}));
trace("labelATTENTE_CLIC_01");
for(var i:int = 1; i < 13; i++)
{
myMc = new InteractiveMovie(this.mainTimeline["ZONE_" + this.G2D(i)],this._timelineManager);
myMc.engine = this._engine;
myMc.mc.pNum = i;
myMc.mc.pCommentRoll = "ZONE_" + this.G2D(i);
myMc.mc.pNoiseRoll = "B_ZONE_ROLL_" + this.G2D(i);
myMc.mc.pNoiseClic = "B_ZONE_CLIC";
myMc.mc.pCommentClic = "ROI_" + this.G2D(i);
if(i == 1)
{
this.initMc(myMc);
}
else
{
myMc.gotoAndStop("E0");
}
}
this.initBT_MYTHE();
}
public function labelATTENTE_CLIC() : void
{
var myMc:InteractiveMovie = null;
this._engine.playComment(new CommentObject({"code":"ATTENTE_CLIC"}));
trace("labelATTENTE_CLIC");
for(var i:int = 1; i < 13; i++)
{
myMc = new InteractiveMovie(this.mainTimeline["ZONE_" + this.G2D(i)],this._timelineManager);
myMc.engine = this._engine;
myMc.mc.pNum = i;
myMc.mc.pCommentRoll = "ZONE_" + this.G2D(i);
myMc.mc.pNoiseRoll = "B_ZONE_ROLL_" + this.G2D(i);
myMc.mc.pNoiseClic = "B_ZONE_CLIC";
myMc.mc.pCommentClic = "ROI_" + this.G2D(i);
if(i < 12)
{
if(this.gListDone[i - 1] == 1)
{
myMc.mc.rollOutFrame = "E4";
}
this.initMc(myMc);
}
else
{
myMc.gotoAndStop("E0");
}
}
this.initBT_MYTHE();
}
public function labelATTENTE_CLIC_12() : void
{
var myMc:InteractiveMovie = null;
if(this.gListDone.indexOf(0) !== -1)
{
this._engine.playComment(new CommentObject({"code":"ATTENTE_CLIC_12"}));
}
trace("labelATTENTE_CLIC_12");
for(var i:int = 1; i < 13; i++)
{
myMc = new InteractiveMovie(this.mainTimeline["ZONE_" + this.G2D(i)],this._timelineManager);
myMc.engine = this._engine;
myMc.mc.pNum = i;
myMc.mc.pCommentRoll = "ZONE_" + this.G2D(i);
myMc.mc.pNoiseRoll = "B_ZONE_ROLL_" + this.G2D(i);
myMc.mc.pNoiseClic = "B_ZONE_CLIC";
myMc.mc.pCommentClic = "ROI_" + this.G2D(i);
if(this.gListDone[i - 1] == 1)
{
myMc.mc.rollOutFrame = "E4";
}
this.initMc(myMc);
}
this.initBT_MYTHE();
}
public function initBT_MYTHE() : void
{
var myMc:MovieClip = new InteractiveMovie(this.mainTimeline["BT_MYTHE"],this._timelineManager);
if(this.gDoneMythe)
{
myMc.gotoAndStop("E4");
myMc.mc.rollOutFrame = "E4";
}
else
{
myMc.gotoAndStop("E1");
myMc.mc.rollOutFrame = "E1";
}
myMc.mc.pNoiseRoll = "B_BT_MYTHE_ROLL";
myMc.mc.pNoiseClic = "B_BT_MYTHE_ROLL";
myMc.mc.pIB = "IB_00_MYTHE";
myMc.mc.onRollOver = function(p:Object):void
{
trace("OVER");
trace("this",this);
this.gotoAndStop("E2");
_engine.playNoise(new NoiseObject({"code":this.pNoiseRoll}));
_engine.showIB({
"id":this.pIB,
"reference":this
});
};
myMc.mc.onRollOut = function(p:Object):void
{
trace("OUT");
_engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
_engine.hideIB();
};
myMc.mc.onPress = function(p:Object):void
{
trace("CLIC");
this.timeline.GotoAndPlayUntil({
"labelPlay":"E3",
"beforeLabelStop":"E4",
"callback":goMYTH
});
_engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
_engine.playNoise(new NoiseObject({"code":this.pNoiseClic}));
this.kill();
_engine.hideIB();
if(gDoneMythe == false)
{
gDoneMythe = true;
so.data.doneMythe = gDoneMythe;
so.flush();
}
};
myMc.activeMC();
}
public function goMYTH() : void
{
var myMc:InteractiveMovie = null;
this._timeline_.GotoAndStop("MYTHE_01");
for(var i:int = 1; i <= 3; i++)
{
myMc = new InteractiveMovie(this.mainTimeline["BT_MYTHE_" + this.G2D(i)],this._timelineManager);
if(i == 1)
{
myMc.gotoAndStop("E2");
}
else
{
myMc.gotoAndStop("E1");
}
}
this.TRANSITION = new InteractiveMovie(this.mainTimeline["TRANSITION"],this._timelineManager);
this.TRANSITION.mc.alpha = 0;
this.TRANSITION.gotoAndStop(1);
this.gImageNum = 1;
this.afficheImage();
this._engine.playComment(new CommentObject({
"code":"MYTHE_0" + this.gImageNum,
"callback":this.enchaineImage
}));
}
public function afficheImage() : void
{
var ACCUEILmc:MovieClip = this.mainTimeline.MYTHE_XX.PHOTO;
var ANIM:MediaImage = this._engine.showImage({
"code":"PH_0" + this.gImageNum,
"parent":ACCUEILmc
});
}
public function enchaineImage() : void
{
trace("enchaineImage");
this.TRANSITION.mc.alpha = 1;
this.TRANSITION.gotoAndPlayUntil({
"labelPlay":1,
"labelStop":"E1",
"callback":this.swapImage
});
var ACCUEILmc:MovieClip = this.mainTimeline.MYTHE_XX.PHOTO;
var ANIM:MediaImage = this._engine.showImage({
"code":"PH_0" + this.gImageNum,
"parent":ACCUEILmc
});
}
public function swapImage() : void
{
var myMc:InteractiveMovie = null;
var i:int = 0;
trace("swapImage");
this._engine.hideImage({"code":"PH_0" + this.gImageNum});
if(this.gImageNum < 3)
{
this.gImageNum += 1;
for(i = 1; i <= 3; i++)
{
myMc = new InteractiveMovie(this.mainTimeline["BT_MYTHE_" + this.G2D(i)],this._timelineManager);
if(i <= this.gImageNum)
{
myMc.gotoAndStop("E2");
}
else
{
myMc.gotoAndStop("E1");
}
}
this.afficheImage();
this.TRANSITION.gotoAndPlayUntilTheEnd("E1",this.finTransition);
}
else
{
this.finReturnSon();
}
}
public function finTransition() : void
{
this.TRANSITION.mc.alpha = 0;
this.TRANSITION.gotoAndStop(1);
this._engine.playComment(new CommentObject({
"code":"MYTHE_0" + this.gImageNum,
"callback":this.enchaineImage
}));
}
public function initMc(myMc:MovieClip) : void
{
myMc.gotoAndStop("E1");
trace("myMc.mc",myMc.mc);
myMc.mc.onRollOver = function(p:Object):void
{
trace("OVER");
this.gotoAndStop("E2");
gRoll = this;
_engine.playNoise(new NoiseObject({"code":this.pNoiseRoll}));
_engine.playComment(new CommentObject({
"code":this.pCommentRoll,
"zapBlock":"NOZAP_NOBLOCK",
"callback":finTHEAson
}));
};
myMc.mc.onRollOut = function(p:Object):void
{
trace("OUT");
this.gotoAndStop(this.rollOutFrame);
_engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
_engine.stopComment();
gRoll = undefined;
};
myMc.mc.onPress = function(p:Object):void
{
_engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
_engine.playNoise(new NoiseObject({"code":this.pNoiseClic}));
if(p.mc.pNum == 1)
{
_timeline_.GotoAndStop("ROI_PARLE_01");
}
else
{
_timeline_.GotoAndStop("ROI_PARLE");
}
gClic = this.pNum;
_engine.playComment(new CommentObject({
"code":this.pCommentClic,
"callback":finCommentRoi
}));
trace("CLIC");
killAllMc();
};
myMc.activeMC();
}
public function finTHEAson() : void
{
var myMc:InteractiveMovie = new InteractiveMovie(this.gRoll.ZONE_E2.VIGNETTE_01.THEA.BOUCHE,this._timelineManager);
myMc.gotoAndStop(myMc.mc.totalFrames);
}
public function finCommentRoi() : void
{
trace("finCommentRoi");
this._engine.host.changeModule({"numMod":this.gClic});
}
public function killAllMc() : void
{
var myMc:MovieClip = null;
for(var i:int = 1; i < 13; i++)
{
myMc = new InteractiveMovie(this.mainTimeline["ZONE_" + this.G2D(i)],this._timelineManager);
myMc.kill();
}
}
public function G2D(value:int) : String
{
return GlobalesFunctions.gimme2digits(value);
}
public function endMODULE() : void
{
trace("fin du module");
}
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();
}
}
}