home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 157
/
MOBICLIC157.ISO
/
pc
/
DATA
/
ANI157
/
ANI157_00
/
ANI157_00.swf
/
scripts
/
ani_00
/
CapsuleAlgo.as
next >
Wrap
Text File
|
2013-09-17
|
22KB
|
643 lines
package ani_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.medias.MediaVideo;
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.display.Sprite;
import flash.events.MouseEvent;
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;
public var _console_:Console;
public var OUTIL_02:Outil_02;
public var OUTIL_04_01:Outil_04_01;
public var OUTIL_09_02:Outil_09_02;
public var OUTIL_10:Outil_10;
private var gListeMasc:Array;
private var BUG_NEUTRE:MediaSwf;
private var WIKI_NEUTRE:MediaSwf;
private var BUG_LOUPGAROU:MediaSwf;
public var gDrag:MovieClip;
private var gTypeRessource:String;
private var cadreWidth:Number;
private var cadreHeight:Number;
public var gTimerOn:Boolean = false;
public var videoPlaying:MediaVideo = null;
private var VIDEO_04_02_01:MediaVideo;
private var gFinVideo_04_02_01:Boolean;
private var gFinComment_04_02_01:Boolean;
private var cz:Sprite;
public function CapsuleAlgo(engine:Engine)
{
var item:XML = null;
var myMc:InteractiveMovie = null;
var nbEtat:String = null;
var etatActif:String = null;
this.labelsCallback = {
"_01_02":this._label01_02,
"FIN_01":this.retourATTENTE,
"_02_01":this._label02_01,
"FIN_02":this.retourATTENTE,
"INIT_03_01_02":this.init_03_01_02,
"FIN_03_01":this.retourATTENTE,
"INIT_03_02_02":this.init_03_02_02,
"FIN_03_02":this.retourATTENTE,
"FIN_03_03":this.retourATTENTE,
"FIN_04_01":this.retourATTENTE,
"INIT_04_02":this.init_04_02,
"FIN_04_02":this.retourATTENTE,
"_05_01_CRI":this.labelCRI,
"FIN_05_01":this.retourATTENTE,
"FIN_05_02":this.retourATTENTE,
"FIN_06":this.retourATTENTE,
"FIN_07":this.retourATTENTE,
"FIN_08":this.retourATTENTE,
"FIN_09_01":this.retourATTENTE,
"FIN_09_02":this.retourATTENTE,
"affichage":this.labelAffichage,
"FIN_10":this.retourATTENTE
};
super();
this._engine = engine;
this._engine.playMusic({"code":"MU_01"});
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"];
var myNode:XMLList = this._engine.config.XmlConfig.Module.Config.Outils.ou;
for each(item in myNode)
{
nbEtat = item.@nbEtats.toString();
etatActif = "";
etatActif = item.@etatActif.toString();
myMc = new InteractiveMovie(this.mainTimeline["OUTIL_" + item.@idOutil.toString()],this._timelineManager);
myMc.mc.pNbCran = Number(nbEtat);
if(etatActif != "")
{
if(myMc.mc.pNbCran == 1 && Number(etatActif) == 2)
{
myMc.gotoAndStop("E" + nbEtat + "_1_1-0");
}
else
{
myMc.gotoAndStop("E" + nbEtat);
}
myMc.mc.etatActif = Number(etatActif);
}
else
{
myMc.gotoAndStop("E" + nbEtat);
}
}
this.gListeMasc = [];
this._console_ = new Console(this.mainTimeline,this._engine,this,this._timelineManager,this._timeline_);
this.firstLabel = this.mainTimeline.currentLabels[0].name;
this._timeline_.GotoAndPlayUntil({
"labelPlay":this.firstLabel,
"labelStop":this.mainTimeline.currentLabels[1].frame - 1,
"callback":this._timeline_.nextLabel
});
}
public function labelPLAY_00() : void
{
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.sol,this._timelineManager);
myMc.gotoAndStop(1);
}
public function label00_01_BG() : void
{
this.BUG_LOUPGAROU = this._engine.showSwf({
"code":"BUG_LOUPGAROU",
"parent":this._engine.config.layers["content"]
});
}
public function label00_02() : void
{
this._engine.changeMusic({"code":"MU_02"});
this._engine.hideSwf({
"code":"BUG_LOUPGAROU",
"parent":this._engine.config.layers["content"]
});
}
public function labelATTENTE() : void
{
trace("labelATTENTE");
this._console_.initOutils();
}
public function retourATTENTE() : void
{
trace("retourATTENTE");
this._timeline_.GotoAndPlayUntil({"labelStop":"ATTENTE"});
}
public function labelATTENTE_01() : void
{
trace("labelATTENTE_01");
var outil01:Outil_01 = new Outil_01(this.mainTimeline,this._engine,this,this._timelineManager,this._timeline_);
}
public function _label01_02() : void
{
trace("_label01_02");
this._engine.playComment(new CommentObject({
"code":"01_02",
"callback":this.fin01
}));
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.COMPART_A,this._timelineManager);
myMc.gotoAndPlayUntil({
"labelPlay":1,
"labelStop":"ATTENTE"
});
myMc = new InteractiveMovie(this.mainTimeline.COMPART_A.BT_CROIX,this._timelineManager);
myMc.gotoAndStop(1);
}
public function fin01() : void
{
trace("labelPLAY_01_FIN");
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.COMPART_A,this._timelineManager);
myMc.gotoAndPlayUntilTheEnd("FERMER",this._timeline_.nextLabel);
}
public function labelPLAY_02_DEBUT() : void
{
trace("labelPLAY_02_DEBUT");
var myMc2:InteractiveMovie = new InteractiveMovie(this.mainTimeline.ANIM_POIDS,this._timelineManager);
myMc2.gotoAndPlayUntil({
"labelPlay":1,
"beforeLabelStop":"DEPART"
});
this.OUTIL_02 = new Outil_02(this.mainTimeline,this._engine,this,this._timelineManager,this._timeline_);
}
public function labelATTENTE_02() : void
{
trace("labelATTENTE_02");
this.OUTIL_02.active();
}
public function _label02_01() : void
{
trace("_label02_01");
this._engine.playComment(new CommentObject({
"code":"02_01",
"callback":this.fin02
}));
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.COMPART_B,this._timelineManager);
myMc.gotoAndPlayUntil({
"labelPlay":1,
"labelStop":"ATTENTE"
});
myMc = new InteractiveMovie(this.mainTimeline.COMPART_B.BT_CROIX,this._timelineManager);
myMc.gotoAndStop(1);
}
public function fin02() : void
{
trace("labelPLAY_02_FIN");
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.COMPART_B,this._timelineManager);
myMc.gotoAndPlayUntilTheEnd("FERMER",this._timeline_.nextLabel);
}
public function init_03_01_02() : void
{
this._timeline_.GotoAndPlayUntil({
"labelPlay":this.mainTimeline.currentFrame,
"labelStop":"ATTENTE_03_01_02"
});
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.ANIM_03_01,this._timelineManager);
myMc.gotoAndPlayUntil({
"labelPlay":1,
"labelStop":"PH01",
"callback":this.init_03_01_02_PH01
});
}
public function init_03_01_02_PH01() : void
{
var nom_du_son:String = "03_01_02";
this._engine.playComment(new CommentObject({
"code":nom_du_son,
"callback":this.finComment_03_01_02
}));
this.afficheDiapo("PH" + nom_du_son,this.mainTimeline.ANIM_03_01.PH01);
}
public function finComment_03_01_02() : void
{
var myMc:InteractiveMovie = null;
trace("fin son 03_01_02");
var myMedia:MediaImage = this._engine.getMediaImage("03_01_03");
if(myMedia === null)
{
myMc = new InteractiveMovie(this.mainTimeline.ANIM_03_01,this._timelineManager);
myMc.gotoAndPlayUntilTheEnd("FIN",this._timeline_.nextLabel);
}
}
public function init_03_02_02() : void
{
this._timeline_.GotoAndPlayUntil({
"labelPlay":this.mainTimeline.currentFrame,
"labelStop":"ATTENTE_03_02_02"
});
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.ANIM_03_02,this._timelineManager);
myMc.gotoAndPlayUntil({
"labelPlay":1,
"labelStop":"PH01",
"callback":this.init_03_02_02_PH01
});
}
public function init_03_02_02_PH01() : void
{
var nom_du_son:String = "03_02_02";
this._engine.playComment(new CommentObject({
"code":nom_du_son,
"callback":this.finComment_03_02_02
}));
this.afficheDiapo("PH" + nom_du_son,this.mainTimeline.ANIM_03_02.PH01);
}
public function finComment_03_02_02() : void
{
var myMc:InteractiveMovie = null;
trace("fin son 03_02_02");
var myMedia:MediaImage = this._engine.getMediaImage("03_02_03");
if(myMedia === null)
{
myMc = new InteractiveMovie(this.mainTimeline.ANIM_03_02,this._timelineManager);
myMc.gotoAndPlayUntilTheEnd("FIN",this._timeline_.nextLabel);
}
}
public function labelPLAY_04_01_DEBUT() : void
{
trace("labelPLAY_04_01_DEBUT");
this.OUTIL_04_01 = new Outil_04_01(this.mainTimeline,this._engine,this,this._timelineManager,this._timeline_);
}
public function label04_01_01() : void
{
this.OUTIL_04_01.afficheFirstLM();
}
public function labelATTENTE_04_01() : void
{
trace("labelATTENTE_04_01");
this.OUTIL_04_01.active();
}
public function init_04_02() : void
{
this._timeline_.GotoAndPlayUntil({
"labelPlay":this.mainTimeline.currentFrame,
"labelStop":"ATTENTE_04_02"
});
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.ANIM_04_02,this._timelineManager);
myMc.gotoAndPlayUntil({
"labelPlay":1,
"labelStop":"ATTENTE",
"callback":this.initVideo_04_02
});
}
public function initVideo_04_02() : void
{
this.cz = GlobalesFunctions.createRectangle({
"color":65280,
"alpha":0
});
this.cz.addEventListener(MouseEvent.CLICK,function():void
{
trace("clic zap video");
finVideo04_02_01(true);
});
this.mainTimeline.ANIM_04_02.addChild(this.cz);
this.cz.x = -400;
this.cz.y = -300;
this.cz.visible = true;
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.ANIM_04_02.video,this._timelineManager);
myMc.gotoAndStop(this.mainTimeline.ANIM_04_02.video.totalFrames);
var nom_du_son:String = "04_02_01";
this.gFinVideo_04_02_01 = false;
this.gFinComment_04_02_01 = false;
this._engine.playComment(new CommentObject({
"code":nom_du_son,
"callback":this.finComment_04_02_01
}));
trace("mainTimeline.ANIM_04_02.video.videoBox",this.mainTimeline.ANIM_04_02.video.videoBox);
this.VIDEO_04_02_01 = this._engine.showVideo({
"parent":this.mainTimeline.ANIM_04_02.video.videoBox,
"code":"VID04_02_01"
});
this.videoPlaying = this.VIDEO_04_02_01;
this.VIDEO_04_02_01.play(0,this.finVideo04_02_01);
}
public function finComment_04_02_01() : void
{
this.gFinComment_04_02_01 = true;
if(this.gFinVideo_04_02_01)
{
this.suite_04_02_01();
}
}
public function finVideo04_02_01(zap:Boolean = false) : void
{
if(!zap)
{
this.videoPlaying = null;
}
this.mainTimeline.ANIM_04_02.removeChild(this.cz);
this.gFinVideo_04_02_01 = true;
if(this.gFinComment_04_02_01)
{
this.suite_04_02_01(zap);
}
}
public function suite_04_02_01(zap:Boolean = false) : void
{
var myMc:InteractiveMovie = null;
if(this.mainTimeline.ANIM_04_02 !== null)
{
myMc = new InteractiveMovie(this.mainTimeline.ANIM_04_02,this._timelineManager);
if(!zap)
{
myMc.gotoAndPlayUntilTheEnd("FERMER",this._timeline_.nextLabel);
}
else
{
myMc.gotoAndPlayUntilTheEnd("FERMER",this.finVideoZap);
}
}
}
public function finVideoZap() : void
{
this.videoPlaying = null;
this._timeline_.nextLabel();
}
public function labelCRI() : void
{
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.ANIM_CRI,this._timelineManager);
myMc.gotoAndPlayUntilTheEnd(1,this.finANIM_CRI);
}
public function finANIM_CRI() : void
{
this._timeline_.nextLabel();
}
public function label07_02_BG() : void
{
this.BUG_NEUTRE = this._engine.showSwf({
"code":"BUG_NEUTRE",
"parent":this._engine.config.layers["content"]
});
var bugBouche:InteractiveMovie = new InteractiveMovie(this.BUG_NEUTRE.swfContent.BUG.BUG.BOUCHE,this._timelineManager);
bugBouche.gotoAndPlay(1);
}
public function label07_03() : void
{
this._engine.hideSwf({
"code":"BUG_NEUTRE",
"parent":this._engine.config.layers["content"]
});
}
public function labelPLAY_09_02_DEBUT() : void
{
trace("labelPLAY_09_02_DEBUT");
this.OUTIL_09_02 = new Outil_09_02(this.mainTimeline,this._engine,this,this._timelineManager,this._timeline_);
}
public function label09_02() : void
{
this.OUTIL_09_02.active();
}
public function labelATTENTE_09_02() : void
{
}
public function labelPLAY_10_DEBUT() : void
{
trace("labelPLAY_10_DEBUT");
this.OUTIL_10 = new Outil_10(this.mainTimeline,this._engine,this,this._timelineManager,this._timeline_);
}
public function labelAffichage() : void
{
this.OUTIL_10.active();
}
public function labelATTENTE_10() : void
{
trace("labelATTENTE_10");
var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.FICHE["BT_PRINT"],this._timelineManager);
myMc.mc.mcI = myMc;
myMc.mc.onRollOver = function(p:Object):void
{
if(gDrag == null)
{
_engine.playNoise(new NoiseObject({"code":"B_PRINT"}));
this.mcI.gotoAndPlayUntilTheEnd("E2");
}
};
myMc.mc.onRollOut = function(p:Object):void
{
if(gDrag == null)
{
_engine.stopNoise(new NoiseObject({"code":"B_PRINT"}));
this.mcI.gotoAndStop("E1");
}
};
myMc.mc.onPress = function(p:Object):void
{
_engine.stopNoise(new NoiseObject({"code":"B_PRINT"}));
new PrintableSprite(mainTimeline.FICHE.FICHE,_engine.config.ROOT_APP).print();
};
myMc.activeMC();
}
public function afficheDiapo(pCode:String, mc:MovieClip) : void
{
var mc2:Sprite = null;
var myMedia2:MediaVideo = null;
var myMedia:MediaImage = this._engine.getMediaImage(pCode);
if(myMedia !== null)
{
this.gTypeRessource = "jpg";
this.cadreWidth = mc.width;
this.cadreHeight = mc.height;
mc2 = new Sprite();
mc.addChild(mc2);
mc2.addChild(myMedia.image);
this.adapteImage(mc2);
}
else
{
myMedia2 = this._engine.getMediaVideo(pCode);
if(myMedia2 !== null)
{
if(this.gTypeRessource == "jpg")
{
}
this.gTypeRessource = "flv";
}
}
}
private function adapteImage(myC:Sprite, pFin:Number = 0) : void
{
var pCent:Number = NaN;
trace("cadrewidth + cadreHeight --> " + this.cadreWidth + " _ " + this.cadreHeight);
this.cadreWidth += 2;
this.cadreHeight += 2;
var general_width:Number = myC.width;
var general_height:Number = myC.height;
var pCentW:Number = this.cadreWidth * 100 / general_width;
var pCentH:Number = this.cadreHeight * 100 / general_height;
var myMc:Sprite = myC;
if(myMc.width > myMc.height)
{
pCent = this.cadreWidth * 100 / myMc.width;
if(myMc.height * pCent / 100 > this.cadreHeight)
{
pCent = this.cadreHeight * 100 / myMc.height;
}
}
else
{
pCent = this.cadreHeight * 100 / myMc.height;
if(myMc.width * pCent / 100 > this.cadreWidth)
{
pCent = this.cadreWidth * 100 / myMc.width;
}
}
myC.width = myC.width * pCentW / 100;
myC.height = myC.height * pCentH / 100;
myC.x = 0;
myC.y = 0;
myC.visible = true;
}
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);
if(this.gTimerOn == true)
{
this.OUTIL_10.timerBloc.pause();
}
if(this.videoPlaying !== null)
{
this.videoPlaying.pause();
}
}
public function wake() : void
{
this._pauseManager.wakeMovie(this.mainTimeline);
if(this.gTimerOn == true)
{
this.OUTIL_10.timerBloc.resume();
}
if(this.videoPlaying !== null)
{
this.videoPlaying.resume();
}
}
public function destroy() : void
{
if(this._engine.cursor !== null)
{
this._engine.cursor.destroy();
}
this._engine.stopAllSounds();
this._timeline_.kilListeners();
}
}
}