home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 151
/
MOBICLIC151.ISO
/
mac
/
DATA
/
BLA151
/
BLA151_02
/
BLA151_02.swf
/
scripts
/
bla_02
/
CapsuleAlgo.as
Wrap
Text File
|
2013-01-17
|
5KB
|
138 lines
package bla_02
{
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.tools.GlobalesFunctions;
import flash.display.MovieClip;
import flash.events.Event;
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_:Timeline;
private var _timelineManager:TimelineManager;
private var _pauseManager:PauseManager;
private var firstLabel:String = "_01";
private var gSon:int = 1;
public function CapsuleAlgo(engine:Engine)
{
super();
this._engine = engine;
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 Timeline(this.mainTimeline,this._timelineManager);
this._engine.levelCZ = this._engine.config.layers["content"];
this._timeline_.GotoAndPlay(2);
this.mainTimeline.addEventListener(Event.FRAME_CONSTRUCTED,this.frameContructedListener);
var BT_FERMER:InteractiveMovie = new InteractiveMovie(this.mainTimeline.BT_FERMER,this._timelineManager);
BT_FERMER.mc.onPress = function():void
{
endMODULE();
this.kill();
};
BT_FERMER.activeMC();
}
public function frameContructedListener(evt:Event) : void
{
if(this.mainTimeline.currentFrameLabel !== null)
{
if(this.mainTimeline.currentFrameLabel.substr(3,3) == "fin")
{
this.masqueST();
}
else
{
this.afficheST();
}
}
}
public function afficheST() : void
{
this._engine.config.subtitlesBloc.showByCommentID(this._engine.config.commentName + this.mainTimeline.currentFrameLabel.substr(1,2));
this.gSon += 1;
}
public function masqueST() : void
{
this._engine.config.subtitlesBloc.hide();
var pNextLabel:int = this.getNextLabel();
if(pNextLabel == -1)
{
this.mainTimeline.removeEventListener(Event.FRAME_CONSTRUCTED,this.frameContructedListener);
this._timeline_.GotoAndPlayUntilTheEnd(this.mainTimeline.currentFrame + 1,this.endMODULE);
}
}
public function getNextLabel() : int
{
var pos:int = this._timeline_.getPosFrameLabelByName(this.mainTimeline,this.mainTimeline.currentLabel);
if(pos < this.mainTimeline.currentLabels.length - 1)
{
return this.mainTimeline.currentLabels[pos + 1].frame;
}
return -1;
}
public function G2D(value:int) : String
{
return GlobalesFunctions.gimme2digits(value);
}
public function endMODULE() : void
{
trace("fin du module");
this._engine.host.changeModule({"numMod":0});
}
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.mainTimeline.removeEventListener(Event.FRAME_CONSTRUCTED,this.frameContructedListener);
this._engine.stopAllSounds();
this._timeline_.kilListeners();
}
}
}