home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 145
/
MOBICLIC145.ISO
/
pc
/
DATA
/
BLA145
/
BLA145_00
/
BLA145_00.swf
/
scripts
/
bla145_00
/
CapsuleAlgo.as
Wrap
Text File
|
2012-07-18
|
7KB
|
215 lines
package bla145_00
{
import com.milanpresse.engine.Engine;
import com.milanpresse.engine.initmovieclip.InteractiveMovie;
import com.milanpresse.engine.managers.KeyManager;
import com.milanpresse.engine.managers.PauseManager;
import com.milanpresse.engine.managers.TimelineManager;
import com.milanpresse.engine.medias.MediaSwf;
import com.milanpresse.engine.text.TextBloc;
import com.milanpresse.engine.timelines.Timeline;
import com.milanpresse.engine.timelines.TimelineLinear;
import com.milanpresse.engine.timers.ExtendedTimer;
import com.milanpresse.engine.typeargument.NoiseObject;
import com.milanpresse.tools.GlobalesFunctions;
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.ui.Keyboard;
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 = "ATTENTE";
private var gListeOrdreBLA:Array;
private var gListeOrdreTOTO:Array;
private var gBlague:int = 1;
private var TOTO:InteractiveMovie;
private var TOTO_BLA:InteractiveMovie;
private var timerTOTO:ExtendedTimer;
private var textBloc1:TextBloc;
private var textBloc2:TextBloc;
private var textBloc3:TextBloc;
private var _keyManager:KeyManager;
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.gListeOrdreBLA = this._engine.config.XmlConfig.Module.Config.ordreBureauBLA.toString().split(",");
this.gListeOrdreTOTO = this._engine.config.XmlConfig.Module.Config.ordreBureauTOTO.toString().split(",");
this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
}
public function labelATTENTE() : void
{
trace("labelATTENTE");
this.TOTO = new InteractiveMovie(this.mainTimeline["TOTO"],this._timelineManager);
this.TOTO.gotoAndStop(1);
this.timerTOTO = new ExtendedTimer(3000);
this.timerTOTO.addEventListener(TimerEvent.TIMER,this.desinitToto);
this.mainTimeline.LM_XX.LM_01.visible = false;
this.mainTimeline.LM_XX.LM_02.visible = false;
this.mainTimeline.LM_XX.LM_03.visible = false;
this.initToto();
this.initTriche();
this._keyManager = new KeyManager(this.mainTimeline,this.testeKeyDown,this.testeKeyUp);
}
public function testeKeyDown(e:*) : void
{
}
public function testeKeyUp(e:*) : void
{
}
public function initToto() : void
{
trace("initToto",this.gBlague);
this.mainTimeline.LM_XX["LM_" + this.G2D(this.gListeOrdreBLA[this.gBlague - 1])].visible = true;
this.TOTO_BLA = new InteractiveMovie(this.mainTimeline.TOTO.TOTO_BLA,this._timelineManager);
this.TOTO_BLA.mc.rollOutFrame = "E" + this.gListeOrdreTOTO[this.gBlague - 1];
this.TOTO_BLA.mc.rollOverFrame = "E5";
this.TOTO_BLA.mc.onRollOver = function():void
{
this.timeline.kilListeners();
_engine.playNoise(new NoiseObject({"code":"B_MOI"}));
this.timeline.GotoAndStop("E5");
timerTOTO.stop();
};
this.TOTO_BLA.mc.onRollOut = function():void
{
desinitToto();
};
this.TOTO_BLA.mc.onPress = function():void
{
this.kill();
timerTOTO.removeEventListener(TimerEvent.TIMER,desinitToto);
_engine.host.changeModule({"numMod":gListeOrdreBLA[gBlague - 1]});
};
this.TOTO_BLA.activeMC();
this.timerTOTO.start();
}
public function desinitToto(e:TimerEvent = null) : void
{
var pLabelStop:String = null;
trace("desinitToto",this.gBlague);
this.mainTimeline.LM_XX["LM_" + this.G2D(this.gListeOrdreBLA[this.gBlague - 1])].visible = false;
this._engine.stopNoise(new NoiseObject({"code":"B_MOI"}));
this.timerTOTO.stop();
this.TOTO_BLA.mc.timeline.GotoAndStop("E6");
this.TOTO_BLA.kill();
var pLabelPlay:String = "E" + this.gBlague;
if(this.gBlague < 3)
{
pLabelStop = "E" + (this.gBlague + 1);
this.gBlague += 1;
}
else
{
pLabelStop = "E1";
this.gBlague = 1;
}
this.TOTO.gotoAndPlayUntil({
"labelPlay":pLabelPlay,
"beforeLabelStop":pLabelStop,
"callback":this.initToto
});
}
public function initTriche() : void
{
var myMc:InteractiveMovie = null;
for(var i:int = 1; i <= 3; i++)
{
myMc = new InteractiveMovie(this.mainTimeline["triche_" + i],this._timelineManager);
myMc.mc.useHandCursor = false;
myMc.mc.pNum = i;
myMc.mc.onPress = function():void
{
if(_keyManager.isKeyPressed(Keyboard.SPACE) == true)
{
_engine.host.changeModule({"numMod":this.pNum});
}
};
}
}
public function G2D(value:int) : String
{
return GlobalesFunctions.gimme2digits(value);
}
public function endMODULE() : void
{
trace("fin du module");
}
public function sleep() : void
{
this.timerTOTO.pause();
this._pauseManager = new PauseManager(this._engine,this._timelineManager);
this._pauseManager.sleepMovie(this.mainTimeline);
}
public function wake() : void
{
this.timerTOTO.resume();
this._pauseManager.wakeMovie(this.mainTimeline);
}
public function destroy() : void
{
this.timerTOTO.removeEventListener(TimerEvent.TIMER,this.desinitToto);
this._engine.stopAllSounds();
this._timeline_.kilListeners();
}
}
}