home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 145
/
MOBICLIC145.ISO
/
pc
/
DATA
/
DCV145
/
DCV145_00
/
DCV145_00.swf
/
scripts
/
dcv145_00
/
CapsuleAlgo.as
Wrap
Text File
|
2012-07-18
|
20KB
|
564 lines
package dcv145_00
{
import com.milanpresse.engine.Engine;
import com.milanpresse.engine.initmovieclip.InitMovieclip;
import com.milanpresse.engine.managers.PauseManager;
import com.milanpresse.engine.managers.PrintManager;
import com.milanpresse.engine.managers.TimelineManager;
import com.milanpresse.engine.medias.MediaImage;
import com.milanpresse.engine.medias.MediaImageBatch;
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 flash.display.MovieClip;
import flash.display.Sprite;
import flash.net.SharedObject;
public class CapsuleAlgo
{
private var mainClip:MediaSwf;
private var mainTimeline:MovieClip;
private var _engine:Engine;
private var labelList:Array;
private var labelsCallback:Object;
private var _timeline_:TimelineLinear;
private var _timelineManager:TimelineManager;
private var _pauseManager:PauseManager;
private var so:SharedObject;
private var _pauseOn:Boolean = false;
private var ciel:String;
private var constellations:Object;
private var constellationsDone:Object;
private var countDone:int;
private var doneSucces:Boolean = false;
private var actualConstel:MovieClip;
public function CapsuleAlgo(param1:Engine)
{
this.constellations = {
"CIEL_NORD":["00","01","02","03","04"],
"CIEL_SUD":["05","06","07"],
"CIEL_EST":["03_B","08","09","10"],
"CIEL_OUEST":["01_B","11","12"]
};
super();
this._engine = param1;
this._engine.playMusic({"code":"MU"});
this._engine.setSubtitles(this._engine.host.subtitlesOn);
this._engine.setFrameRate(12);
this.so = SharedObject.getLocal(this._engine.config.rubriqueName,"/");
var _loc2_:* = this._engine.config.callerParameters.fromCodeRub == "MOB";
if(_loc2_ == true)
{
this.so.clear();
this.constellationsDone = {
"CIEL_NORD":[0,0,0,0,0],
"CIEL_SUD":[0,0,0],
"CIEL_EST":[0,0,0,0],
"CIEL_OUEST":[0,0,0]
};
this.countDone = 0;
this.saveConstellations();
}
else if(this.so.size == 0)
{
this.constellationsDone = {
"CIEL_NORD":[0,0,0,0,0],
"CIEL_SUD":[0,0,0],
"CIEL_EST":[0,0,0,0],
"CIEL_OUEST":[0,0,0]
};
this.countDone = 0;
}
else
{
this.constellationsDone = this.so.data.constellationsDone;
this.countDone = this.so.data.countDone;
}
this.mainClip = this._engine.showSwf({
"code":"A_" + this._engine.config.moduleName,
"parent":this._engine.config.layers["content"]
});
this.mainTimeline = this.mainClip.swfContent;
this.labelList = [];
var _loc3_:int = 0;
while(_loc3_ < this.mainTimeline.currentLabels.length)
{
this.labelList.push(this.mainTimeline.currentLabels[_loc3_].name);
_loc3_++;
}
this.labelsCallback = {
"CIEL_NORD":this.initConstellations,
"CIEL_SUD":this.initConstellations,
"CIEL_EST":this.initConstellations,
"CIEL_OUEST":this.initConstellations,
"_C00_04":this.manageFrame_RETURN,
"_C01_02":this.manageFrame_RETURN,
"_C02_02":this.manageFrame_RETURN,
"_C03_02":this.manageFrame_RETURN,
"_C04_02":this.manageFrame_RETURN,
"_C05_02":this.manageFrame_RETURN,
"_C06_02":this.manageFrame_RETURN,
"_C07_02":this.manageFrame_RETURN,
"_C08_02":this.manageFrame_C08_02,
"_C09_02":this.manageFrame_RETURN,
"_C10_02":this.manageFrame_RETURN,
"_C11_02":this.manageFrame_RETURN,
"_C01_B_01":this.manageFrame_C01_B_01,
"_C01_B_02":this.manageFrame_C01_B_02,
"_C03_B_01":this.manageFrame_C03_B_01,
"_C03_B_02":this.manageFrame_C03_B_02,
"_C08_03":this.manageFrame_C08_03,
"_C08_04":this.manageFrame_C08_04,
"_C12_02":this.manageFrame_C12_02
};
this._timelineManager = new TimelineManager();
this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
if(this._engine.config.musicOn == true)
{
this._engine.playMusic({"code":"MU"});
}
this.ciel = "NORD";
this.initBTS();
if(_loc2_ == true)
{
this._timeline_.GotoAndPlayUntil({"labelStop":"_00_00"});
}
else
{
this._timeline_.GotoAndStop("CIEL_NORD");
this.initConstellations();
}
}
private function saveConstellations() : void
{
this.so.data.constellationsDone = this.constellationsDone;
this.so.data.countDone = this.countDone;
this.so.flush();
}
public function sleep() : void
{
this._pauseManager = new PauseManager(this._engine,this._timelineManager);
this._pauseManager.sleepMovie(this.mainTimeline);
}
public function wake() : void
{
this._pauseManager.wakeMovie(this.mainTimeline);
}
public function destroy() : void
{
this._engine.stopAllSounds();
}
private function initBTS() : void
{
var myMc:MovieClip = this.mainTimeline.BT_IMPRIM;
var _timeline:Timeline = new Timeline(myMc,this._timelineManager);
InitMovieclip.InitMc({"mc":myMc});
_timeline.GotoAndStop(1);
myMc.pBruitRoll = "B_IMPRIM";
myMc.onPress = function(param1:Object):void
{
_engine.stopNoise({"code":param1.mc.pBruitRoll});
initPrint();
};
myMc.onRollOver = function(param1:Object):void
{
_engine.playNoise(new NoiseObject({"code":param1.mc.pBruitRoll}));
};
myMc.onRollOut = function(param1:Object):void
{
_engine.stopNoise({"code":param1.mc.pBruitRoll});
};
myMc = this.mainTimeline.BT_ASTRES;
_timeline = new Timeline(myMc,this._timelineManager);
InitMovieclip.InitMc({"mc":myMc});
_timeline.GotoAndStop(1);
myMc.pBruitRoll = "B_ASTRES";
myMc.onPress = function():void
{
_engine.host.changeModule({
"codeRub":_engine.config.rubriqueCode,
"numMod":1
});
};
myMc.onRollOver = function(param1:Object):void
{
_engine.playNoise(new NoiseObject({"code":param1.mc.pBruitRoll}));
};
myMc.onRollOut = function(param1:Object):void
{
_engine.stopNoise({"code":param1.mc.pBruitRoll});
};
var cardinalPoints:Array = new Array("BT_NORD","BT_SUD","BT_EST","BT_OUEST");
var i:int = 0;
while(i < cardinalPoints.length)
{
myMc = this.mainTimeline[cardinalPoints[i]];
myMc.ciel = myMc.name.split("_")[1];
_timeline = new Timeline(myMc,this._timelineManager);
InitMovieclip.InitMc({"mc":myMc});
if(myMc.ciel == this.ciel)
{
myMc.desactive();
myMc.mouseEnabled = false;
myMc.mouseChildren = false;
_timeline.GotoAndStop("E2");
}
else
{
_timeline.GotoAndStop(1);
myMc.mouseEnabled = true;
myMc.mouseChildren = true;
}
myMc.pBruitRoll = "B_ROLL";
myMc.onPress = function(param1:Object):void
{
_engine.stopNoise({"code":param1.mc.pBruitRoll});
changeCiel(param1.mc.name.split("_")[1]);
};
myMc.onRollOver = function(param1:Object):void
{
_engine.playNoise(new NoiseObject({"code":param1.mc.pBruitRoll}));
};
myMc.onRollOut = function(param1:Object):void
{
_engine.stopNoise({"code":param1.mc.pBruitRoll});
};
i++;
}
}
private function changeCiel(param1:String) : void
{
this.mainTimeline["BT_" + this.ciel].active();
this.mainTimeline["BT_" + this.ciel].timeline.GotoAndStop("E1");
this.mainTimeline["BT_" + this.ciel].mouseEnabled = true;
this.mainTimeline["BT_" + this.ciel].mouseChildren = true;
this._timeline_.GotoAndStop("CIEL_" + param1);
this.ciel = param1;
this.mainTimeline["BT_" + this.ciel].desactive();
this.mainTimeline["BT_" + this.ciel].timeline.GotoAndStop("E2");
this.mainTimeline["BT_" + this.ciel].mouseEnabled = false;
this.mainTimeline["BT_" + this.ciel].mouseChildren = false;
var _loc2_:Boolean = false;
var _loc3_:int = 0;
while(_loc3_ < this.constellationsDone["CIEL_" + this.ciel].length)
{
if(this.constellationsDone["CIEL_" + this.ciel][_loc3_] == 0)
{
_loc2_ = true;
}
_loc3_++;
}
if(_loc2_ == true)
{
this._engine.playComment(new CommentObject({"code":this.ciel}));
}
this.initConstellations();
}
private function initConstellations() : void
{
var myCiel:String = null;
var myMc:MovieClip = null;
var _timeline:Timeline = null;
var lm:String = null;
myCiel = "CIEL_" + this.ciel;
var i:int = 0;
while(i < this.constellations[myCiel].length)
{
myMc = this.mainTimeline["CONSTEL_" + this.constellations[myCiel][i]];
myMc.index = i;
_timeline = new Timeline(myMc,this._timelineManager);
InitMovieclip.InitMc({
"mc":myMc,
"rollOverFrame":"E1",
"rollOutFrame":"E0"
});
lm = this.constellations[myCiel][i];
if(this.constellationsDone[myCiel][i])
{
_timeline.GotoAndStop("E2");
this.mainTimeline["LM_" + lm].visible = true;
}
else
{
_timeline.GotoAndStop(1);
this.mainTimeline["LM_" + lm].visible = false;
}
myMc.pBruitRoll = "B_CONSTEL";
myMc.onPress = function(param1:Object):void
{
_engine.stopNoise({"code":param1.mc.pBruitRoll});
mDownConstellation(this);
if(!constellationsDone[myCiel][this.index])
{
if(ciel == "NORD")
{
if(this.index !== 0)
{
countDone += 1;
}
}
else
{
countDone += 1;
}
constellationsDone[myCiel][this.index] = 1;
if(ciel == "NORD" && this.index == 1)
{
constellationsDone["CIEL_OUEST"][0] = 1;
}
if(ciel == "OUEST" && this.index == 0)
{
constellationsDone["CIEL_NORD"][1] = 1;
}
if(ciel == "NORD" && this.index == 3)
{
constellationsDone["CIEL_EST"][0] = 1;
}
if(ciel == "EST" && this.index == 0)
{
constellationsDone["CIEL_NORD"][3] = 1;
}
saveConstellations();
}
};
myMc.onRollOver = function(param1:Object):void
{
var _loc2_:Timeline = null;
_engine.playNoise(new NoiseObject({"code":param1.mc.pBruitRoll}));
if(this.name !== "CONSTEL_00")
{
_loc2_ = new Timeline(this.ANIM,_timelineManager);
_loc2_.GotoAndPlayUntil({
"labelPlay":1,
"labelStop":this.ANIM.totalFrames
});
}
};
myMc.onRollOut = function(param1:Object):void
{
_engine.stopNoise({"code":param1.mc.pBruitRoll});
if(constellationsDone[myCiel][this.index])
{
param1.mc.timeline.GotoAndStop("E2");
}
};
i++;
}
}
private function mDownConstellation(param1:MovieClip) : void
{
this.actualConstel = param1;
var _loc2_:String = param1.name.substring(8);
this._timeline_.GotoAndPlayUntil({"labelStop":"_C" + _loc2_ + "_01"});
}
private function manageFrame_RETURN() : void
{
var _loc4_:Timeline = null;
this.actualConstel.gotoAndStop("E0");
var _loc1_:String = this.mainTimeline.currentFrameLabel;
var _loc2_:MovieClip = this.mainTimeline["anim"];
if(_loc2_ !== null)
{
(_loc4_ = new Timeline(_loc2_,this._timelineManager)).GotoAndPlayUntil({
"labelPlay":1,
"labelStop":_loc2_.totalFrames
});
}
var _loc3_:String = _loc1_.substring(1);
this._engine.playComment(new CommentObject({
"code":_loc3_,
"callback":this.goCiel
}));
}
private function goCiel() : void
{
var _loc3_:MovieClip = null;
var _loc4_:Timeline = null;
var _loc5_:String = null;
if(this.countDone == 12 && !this.doneSucces)
{
this.doneSucces = true;
this._engine.playComment(new CommentObject({"code":"SUCCES"}));
}
this._timeline_.GotoAndStop("CIEL_" + this.ciel);
var _loc1_:String = "CIEL_" + this.ciel;
var _loc2_:int = 0;
while(_loc2_ < this.constellations[_loc1_].length)
{
_loc3_ = this.mainTimeline["CONSTEL_" + this.constellations[_loc1_][_loc2_]];
_loc3_.index = _loc2_;
_loc4_ = new Timeline(_loc3_,this._timelineManager);
InitMovieclip.InitMc({
"mc":_loc3_,
"rollOverFrame":"E1",
"rollOutFrame":"E0"
});
_loc5_ = this.constellations[_loc1_][_loc2_];
if(this.constellationsDone[_loc1_][_loc2_])
{
_loc4_.GotoAndStop("E2");
this.mainTimeline["LM_" + _loc5_].visible = true;
}
else
{
_loc4_.GotoAndStop(1);
this.mainTimeline["LM_" + _loc5_].visible = false;
}
_loc2_++;
}
}
private function manageFrame_C01_B_01() : void
{
var _loc3_:Timeline = null;
var _loc1_:String = this.mainTimeline.currentFrameLabel;
var _loc2_:MovieClip = this.mainTimeline["anim"];
if(_loc2_ !== null)
{
_loc3_ = new Timeline(_loc2_,this._timelineManager);
_loc3_.GotoAndPlayUntil({
"labelPlay":1,
"labelStop":_loc2_.totalFrames
});
}
this._engine.playComment(new CommentObject({
"code":"C01_01",
"callback":this._timeline_.nextLabel
}));
}
private function manageFrame_C01_B_02() : void
{
this.actualConstel.gotoAndStop("E0");
this._engine.playComment(new CommentObject({
"code":"C01_02",
"callback":this.goCiel
}));
}
private function manageFrame_C03_B_01() : void
{
var _loc3_:Timeline = null;
var _loc1_:String = this.mainTimeline.currentFrameLabel;
var _loc2_:MovieClip = this.mainTimeline["anim"];
if(_loc2_ !== null)
{
_loc3_ = new Timeline(_loc2_,this._timelineManager);
_loc3_.GotoAndPlayUntil({
"labelPlay":1,
"labelStop":_loc2_.totalFrames
});
}
this._engine.playComment(new CommentObject({
"code":"C03_01",
"callback":this._timeline_.nextLabel
}));
}
private function manageFrame_C03_B_02() : void
{
this.actualConstel.gotoAndStop("E0");
this._engine.playComment(new CommentObject({
"code":"C03_02",
"callback":this.goCiel
}));
}
private function manageFrame_C08_02() : void
{
this.actualConstel.gotoAndStop("E0");
this._engine.playComment(new CommentObject({
"code":"C08_02",
"callback":this._timeline_.nextLabel
}));
}
private function manageFrame_C08_03() : void
{
this.actualConstel.gotoAndStop("E2");
this._engine.playComment(new CommentObject({
"code":"C08_03",
"callback":this._timeline_.nextLabel
}));
}
private function manageFrame_C08_04() : void
{
var mc:MovieClip = null;
mc = this.mainTimeline.image_holder.image;
this._engine.showImage({
"parent":mc,
"code":"PHOTO_C8_04"
});
this._engine.playComment(new CommentObject({
"code":"C08_04",
"callback":function():void
{
_engine.hideImage({
"parent":mc,
"code":"PHOTO_C8_04"
});
goCiel();
}
}));
}
private function manageFrame_C12_02() : void
{
this.actualConstel.gotoAndStop("E0");
this._engine.playComment(new CommentObject({
"code":"C12_02",
"callback":this.goCiel
}));
}
private function initPrint() : void
{
var _loc3_:MediaImage = null;
var _loc1_:MediaImageBatch = new MediaImageBatch();
var _loc2_:Array = new Array("CARTE_CIEL","MASQUE_CARTE","MODE_EMPLOI");
var _loc4_:int = 0;
while(_loc4_ < _loc2_.length)
{
_loc3_ = this._engine.getMediaImage(_loc2_[_loc4_]);
_loc1_.addMediaImage(_loc3_);
_loc4_++;
}
var _loc5_:PrintManager = PrintManager.getInstance();
var _loc6_:Sprite = new Sprite();
_loc5_.setPrintMc(this.mainTimeline);
_loc5_.printExternalImageArray(_loc1_);
}
}
}