home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 161
/
MOBICLIC161.ISO
/
pc
/
DATA
/
DSS161
/
DSS161_00
/
DSS161_00.swf
/
scripts
/
dss161
/
engineaddons
/
timelines
/
TimelineLinear.as
< prev
Wrap
Text File
|
2014-01-15
|
23KB
|
615 lines
package dss161.engineaddons.timelines
{
import com.milanpresse.engine.Engine;
import com.milanpresse.engine.managers.TimelineManager;
import com.milanpresse.engine.medias.MediaSon;
import com.milanpresse.engine.typeargument.CommentObject;
import com.milanpresse.tools.GlobalesFunctions;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public class TimelineLinear extends Timeline
{
private var _listeMovieBeforeGTAPU:Vector.<DisplayObject>;
private var labelsCallback:Object;
private var _levelFunction;
private var clipZap:Sprite = null;
private var GotoAndPlayUntilParams:Object;
public var isPlayingGPUntil:Boolean = false;
private var animIntern:Timeline = null;
private var commentGPUntil:MediaSon = null;
public var onLabelEnd:Function = null;
public function TimelineLinear(param1:MovieClip, param2:Engine, param3:*, param4:TimelineManager, param5:Object = null)
{
this._listeMovieBeforeGTAPU = new Vector.<DisplayObject>();
super(param1,param4,param2);
this.labelsCallback = param5;
_engine = param2;
this._levelFunction = param3;
}
private function clipZapShow() : void
{
this.clipZap = GlobalesFunctions.createRectangle({
"color":65280,
"alpha":0
});
this.clipZap.addEventListener(MouseEvent.CLICK,function():void
{
nextLabel();
});
_engine.config.layers["content"].addChild(this.clipZap);
this.clipZap.visible = true;
}
private function clipZapHide() : void
{
if(this.clipZap != null)
{
this.clipZap.parent.removeChild(this.clipZap);
this.clipZap = null;
}
}
override public function Stop() : void
{
super.Stop();
if(this.animIntern != null)
{
this.animIntern.destroy();
this.animIntern = null;
}
if(this.commentGPUntil != null)
{
this.commentGPUntil = null;
_engine.stopComment();
}
if(this.animIntern != null)
{
this.animIntern.Stop();
this.animIntern = null;
}
this.isPlayingGPUntil = false;
}
override public function GotoAndPlayUntil(param1:Object) : void
{
var theMovie:MovieClip = null;
var framePlay:int = 0;
var frameStop:int = 0;
var isOK:Boolean = false;
var frameContructedListener:Function = null;
var enterFrameListener:Function = null;
var p:Object = param1;
this.Stop();
this.isPlayingGPUntil = true;
this.GotoAndPlayUntilParams = p;
this._listeMovieBeforeGTAPU = this.initListeMovie();
legendesMediasHide();
if(p.mc == undefined)
{
theMovie = _movie;
removeListeners(_movie);
}
else
{
theMovie = p.mc;
}
var pPlay:Boolean = false;
p.callback = p.callback == undefined ? null : p.callback;
if(this._levelFunction.hasOwnProperty(["onLabelExit"]) && this._levelFunction.onLabelExit != null)
{
this._levelFunction["onLabelExit"]({"label":_movie.currentLabel});
}
if(typeof p.labelPlay == "string")
{
framePlay = turnLabelIntoFrame(theMovie,p.labelPlay);
}
else
{
framePlay = p.labelPlay;
}
if(p.labelStop !== undefined)
{
if(typeof p.labelStop == "string")
{
if(p.labelPlay == undefined)
{
if(this._levelFunction.hasOwnProperty(["beforeLabel" + p.labelStop]) == true)
{
this._levelFunction["beforeLabel" + p.labelStop]();
}
}
frameStop = turnLabelIntoFrame(theMovie,p.labelStop);
}
else
{
frameStop = p.labelStop;
}
}
else if(p.beforeLabelStop !== undefined)
{
frameStop = turnLabelIntoFrame(theMovie,p.beforeLabelStop);
}
else
{
frameStop = theMovie.totalFrames;
}
isOK = false;
frameContructedListener = function():void
{
var _loc1_:String = null;
var _loc2_:String = null;
var _loc3_:Array = null;
var _loc4_:int = 0;
var _loc5_:* = null;
var _loc6_:String = null;
var _loc7_:MovieClip = null;
var _loc8_:MovieClip = null;
var _loc9_:String = null;
var _loc10_:int = 0;
if(isPlayingGPUntil == false)
{
return;
}
isOK = false;
if(p.labelStop !== undefined || p.beforeLabelStop !== undefined)
{
if(theMovie.currentFrame == frameStop)
{
isOK = true;
}
}
else
{
isOK = true;
}
if(isOK)
{
if(p.labelPlay == undefined)
{
legendesMediasShow();
}
theMovie.functionListener = undefined;
theMovie.removeEventListener(Event.FRAME_CONSTRUCTED,frameContructedListener);
theMovie.stop();
_timelineManager.addMovie(theMovie);
if(typeof p.callback == "function")
{
p.callback();
}
else
{
_loc1_ = p.labelStop;
if(labelsCallback !== null)
{
_loc2_ = "";
if(labelsCallback[_loc1_] !== null && labelsCallback[_loc1_] is String)
{
_loc2_ = labelsCallback[_loc1_];
}
if(isPlayingGPUntil == false)
{
return;
}
if(labelsCallback[_loc1_] !== undefined && _loc2_ == "")
{
labelsCallback[_loc1_]();
}
else
{
if(isPlayingGPUntil == false)
{
return;
}
if(_levelFunction.hasOwnProperty(["onLabelEnter"]) && _levelFunction.onLabelEnter != null)
{
_levelFunction["onLabelEnter"]({"label":_movie.currentLabel});
}
if(isPlayingGPUntil == false)
{
return;
}
if(_levelFunction.hasOwnProperty(["label" + _loc1_]) == true)
{
_levelFunction["label" + _loc1_]();
}
if(isPlayingGPUntil == false)
{
return;
}
switch(_loc1_.split("_")[0])
{
case "WAIT":
_loc3_ = _loc1_.split("_");
_loc4_ = _loc3_.length;
_loc5_ = "";
_loc10_ = 1;
while(_loc10_ < _loc4_)
{
_loc5_ += _loc3_[_loc10_];
if(_loc10_ < _loc4_ - 1)
{
_loc5_ += "_";
}
_loc10_++;
}
_loc6_ = GlobalesFunctions.deleteSpaceAtStringEnd(_loc5_);
_loc7_ = theMovie[_loc6_];
if(_loc7_ !== null)
{
animIntern = new Timeline(_loc7_,_timelineManager);
animIntern.GotoAndPlayUntil({
"labelPlay":1,
"labelStop":_loc7_.totalFrames,
"callback":nextLabel
});
clipZapShow();
}
else
{
nextLabel();
}
break;
case "PLAY":
break;
case "ATTENTE":
break;
default:
_loc8_ = theMovie["anim"];
if(_loc8_ == null)
{
_loc8_ = theMovie["anim_"];
}
if(_loc1_.substr(0,1) == "_")
{
_loc9_ = GlobalesFunctions.deleteSpaceAtStringEnd(_loc1_.slice(1,_loc1_.length));
}
else
{
_loc9_ = GlobalesFunctions.deleteSpaceAtStringEnd(_loc1_);
}
if(_loc2_ !== "prioAnim")
{
if(_loc1_.search(/^_/) != -1)
{
if(_loc8_ !== null)
{
animIntern = new Timeline(_loc8_,_timelineManager);
animIntern.GotoAndPlayUntil({
"labelPlay":1,
"labelStop":_loc8_.totalFrames,
"callback":animFinished
});
commentGPUntil = _engine.playComment(new CommentObject({
"code":_loc9_,
"callback":commentFinished,
"zapBlock":"NOZAP_NOBLOCK"
}));
clipZapShow();
}
else
{
commentGPUntil = _engine.playComment(new CommentObject({
"code":_loc9_,
"callback":nextLabel
}));
}
}
else if(_loc8_ !== null)
{
animIntern = new Timeline(_loc8_,_timelineManager);
Performer.dico[this] = this.toString() + ", " + _movie.name;
animIntern.GotoAndPlayUntil({
"labelPlay":1,
"labelStop":_loc8_.totalFrames,
"callback":nextLabel
});
}
else
{
nextLabel();
}
}
else if(_loc8_ !== null)
{
animIntern = new Timeline(_loc8_,_timelineManager);
animIntern.GotoAndPlayUntil({
"labelPlay":1,
"labelStop":_loc8_.totalFrames,
"callback":nextLabel
});
commentGPUntil = _engine.playComment(new CommentObject({"code":_loc9_}));
}
}
}
}
}
}
};
enterFrameListener = function():void
{
var _loc1_:String = null;
if(p.labelPlay !== undefined)
{
if(theMovie.currentFrame == framePlay)
{
isOK = true;
}
}
else
{
isOK = true;
}
if(isOK)
{
testeListeMovie();
_loc1_ = p.labelPlay;
legendesMediasShow();
_movie.removeEventListener(Event.FRAME_CONSTRUCTED,enterFrameListener);
theMovie.functionListener = frameContructedListener;
if(_levelFunction.hasOwnProperty(["label" + _loc1_]) == true)
{
_levelFunction["label" + _loc1_]();
}
_movie.addEventListener(Event.FRAME_CONSTRUCTED,frameContructedListener);
}
};
theMovie.removeListeners = function():void
{
this.removeEventListener(Event.FRAME_CONSTRUCTED,enterFrameListener);
this.removeEventListener(Event.FRAME_CONSTRUCTED,frameContructedListener);
this.functionListener = undefined;
};
if(p.labelPlay == undefined)
{
theMovie.functionListener = frameContructedListener;
theMovie.addEventListener(Event.FRAME_CONSTRUCTED,frameContructedListener);
theMovie.gotoAndStop(frameStop);
this.testeListeMovie();
_timelineManager.addMovie(theMovie);
}
else
{
theMovie.functionListener = enterFrameListener;
theMovie.addEventListener(Event.FRAME_CONSTRUCTED,enterFrameListener);
theMovie.gotoAndPlay(framePlay);
_timelineManager.removeMovie(theMovie);
}
}
private function animFinished() : void
{
if(this.isPlayingGPUntil == false)
{
return;
}
this.animIntern = null;
if(this.animIntern == null && this.commentGPUntil == null)
{
this.nextLabel();
}
}
private function commentFinished() : void
{
if(this.isPlayingGPUntil == false)
{
return;
}
if(this.commentGPUntil != null)
{
this.commentGPUntil.stop();
this.commentGPUntil.destroy();
}
this.commentGPUntil = null;
if(this.animIntern == null && this.commentGPUntil == null)
{
this.nextLabel();
}
}
public function nextLabel() : void
{
var _loc2_:int = 0;
var _loc3_:Timeline = null;
var _loc4_:MovieClip = null;
var _loc5_:int = 0;
var _loc6_:String = null;
this.clipZapHide();
if(this.isPlayingGPUntil == false)
{
return;
}
kilListeners();
if(this.animIntern != null)
{
this.animIntern.destroy();
this.animIntern = null;
}
var _loc1_:int = getPosFrameLabelByName(_movie,_movie.currentLabel);
if(this.onLabelEnd != null)
{
this.onLabelEnd({"label":_movie.currentLabel});
}
if(this.GotoAndPlayUntilParams.labelLastCallback != undefined)
{
if(this.GotoAndPlayUntilParams.labelLast == undefined)
{
this.GotoAndPlayUntilParams.labelLast = this.GotoAndPlayUntilParams.labelStop;
}
_loc2_ = this.GotoAndPlayUntilParams.labelLast is String ? int(turnLabelIntoFrame(_movie,this.GotoAndPlayUntilParams.labelLast)) : int(this.GotoAndPlayUntilParams.labelLast);
if(_loc2_ == _movie.currentFrame)
{
this.GotoAndPlayUntilParams.labelLastCallback();
return;
}
}
this._listeMovieBeforeGTAPU = this.initListeMovie();
if(_loc1_ < _movie.currentLabels.length - 1)
{
_loc4_ = _movie["anim"];
if(_loc4_ == null)
{
_loc4_ = _movie["_anim"];
}
if(_loc4_ !== null)
{
_loc3_ = new Timeline(_loc4_,_timelineManager);
_loc3_.Stop();
}
_loc5_ = 1;
while(_loc5_ < 10)
{
_loc4_ = _movie["bruit_" + GlobalesFunctions.gimme2digits(_loc5_)];
if(_loc4_ === null)
{
break;
}
_loc3_ = new Timeline(_loc4_,_timelineManager);
_loc3_.Stop();
_loc5_++;
}
_loc6_ = _movie.currentLabels[_loc1_ + 1].name;
if(_loc6_.split("_")[0] == "PLAY")
{
_movie.timeline.GotoAndPlayUntil({
"labelPlay":_loc6_,
"labelStop":_movie.currentLabels[_loc1_ + 2].frame - 1,
"callback":this.nextLabel
});
}
else if(this.GotoAndPlayUntilParams.labelLastCallback != undefined)
{
this.GotoAndPlayUntilParams.labelStop = _loc6_;
_movie.timeline.GotoAndPlayUntil(this.GotoAndPlayUntilParams);
}
else
{
_movie.timeline.GotoAndPlayUntil({"labelStop":_loc6_});
}
}
else
{
this._levelFunction.endMODULE();
}
}
public function initListeMovie() : Vector.<DisplayObject>
{
var _loc4_:MovieClip = null;
var _loc1_:Vector.<DisplayObject> = GlobalesFunctions.getChildrenByTypeRecursive(_movie,MovieClip);
var _loc2_:int = _loc1_.length;
var _loc3_:int = 0;
while(_loc3_ < _loc2_)
{
if((_loc1_[_loc3_] as MovieClip).totalFrames > 1 && _loc1_[_loc3_] !== _movie)
{
_loc4_ = _loc1_[_loc3_] as MovieClip;
}
_loc3_++;
}
return _loc1_;
}
public function testeListeMovie() : void
{
var _loc5_:MovieClip = null;
var _loc1_:Vector.<DisplayObject> = GlobalesFunctions.getChildrenByTypeRecursive(_movie,MovieClip);
var _loc2_:int = _loc1_.length;
var _loc3_:int = this._listeMovieBeforeGTAPU.length;
var _loc4_:int = 0;
while(_loc4_ < _loc3_)
{
if(_loc1_.indexOf(this._listeMovieBeforeGTAPU[_loc4_]) == -1)
{
_loc5_ = this._listeMovieBeforeGTAPU[_loc4_] as MovieClip;
if(_loc5_.totalFrames > 1 && _loc5_ !== _movie)
{
if(_timelineManager.isStoppedMovie(_loc5_) == false)
{
_loc5_.stop();
}
}
}
_loc4_++;
}
}
public function initListeMovie_old() : Vector.<DisplayObject>
{
var _loc1_:Vector.<DisplayObject> = GlobalesFunctions.getChildrenByTypeRecursive(_movie,MovieClip,false);
var _loc2_:int = _loc1_.length;
var _loc3_:int = 0;
while(_loc3_ < _loc2_)
{
if((_loc1_[_loc3_] as MovieClip).totalFrames > 1 && _loc1_[_loc3_] !== _movie)
{
(_loc1_[_loc3_] as MovieClip).stop();
}
_loc3_++;
}
return _loc1_;
}
public function testeListeMovie_old() : void
{
var _loc5_:MovieClip = null;
var _loc1_:Vector.<DisplayObject> = GlobalesFunctions.getChildrenByTypeRecursive(_movie,MovieClip);
var _loc2_:int = _loc1_.length;
var _loc3_:int = this._listeMovieBeforeGTAPU.length;
var _loc4_:int = 0;
while(_loc4_ < _loc3_)
{
if(_loc1_.indexOf(this._listeMovieBeforeGTAPU[_loc4_]) != -1)
{
_loc5_ = _loc1_[_loc1_.indexOf(this._listeMovieBeforeGTAPU[_loc4_])] as MovieClip;
if(_loc5_.totalFrames > 1 && _loc5_ !== _movie)
{
_loc5_.play();
}
}
_loc4_++;
}
}
override public function destroy() : void
{
this.Stop();
this.clipZapHide();
this.clipZap = null;
this.labelsCallback = null;
this._levelFunction = null;
this._listeMovieBeforeGTAPU.length = 0;
this.GotoAndPlayUntilParams = null;
if(this.commentGPUntil != null)
{
this.commentGPUntil.destroy();
this.commentGPUntil.stop();
}
this.commentGPUntil = null;
this.onLabelEnd = null;
if(this.animIntern != null)
{
this.animIntern.destroy();
}
this.animIntern = null;
super.destroy();
}
}
}