home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 136
/
MOBICLIC136.ISO
/
pc
/
DATA
/
BLA136
/
BLA136_00
/
BLA136_00.swf
/
scripts
/
__Packages
/
prod
/
moteur_v1_0
/
V002_ChargementMedias.as
< prev
next >
Wrap
Text File
|
2011-07-20
|
11KB
|
266 lines
class prod.moteur_v1_0.V002_ChargementMedias
{
function V002_ChargementMedias(movieRoot, moduleInfo, moduleOnline)
{
this.movieRoot = movieRoot;
this.moduleInfo = moduleInfo;
if(_global.gModulePath == undefined)
{
_global.gModulePath = "";
}
if(moduleOnline == true)
{
this.movieRoot.createEmptyMovieClip("chargement",90000);
var _loc3_ = new MovieClipLoader();
_loc3_.loadClip(_global.gModulePath + this.moduleInfo.getResourceById("C_SWF_" + this.movieRoot.gModuleName).firstChild.attributes.src,this.movieRoot.chargement);
_loc3_.onLoadInit = mx.utils.Delegate.create(this,this.initChargement);
}
else
{
this.lancerPrechargement();
}
}
function initChargement()
{
this.movieRoot.debugger.text += "initChargement";
this.movieRoot.chargement._x = 0;
Stage.width / 2 - this.movieRoot.chargement._width / 2;
this.movieRoot.chargement._y = 0;
Stage.height / 2 - this.movieRoot.chargement._height / 2;
this.lancerPrechargement();
}
function lancerPrechargement()
{
this.movieRoot.createEmptyMovieClip("photoStocker",100);
this.movieRoot.createEmptyMovieClip("swfStocker",150);
this.MediaAChargeNode = this.moduleInfo.filterNode(this.moduleInfo.returnNodeByPath("Resources.ResourcesZip"),"preload","true");
var _loc4_ = new Array();
this.photoMovies = new Array();
this.swfMovies = new Array();
this.soundObjectList = new Array();
this.soundObjects = new Object();
this.swfChargeant = false;
this.jpgChargeant = false;
this.pngChargeant = false;
this.soundChargeant = false;
this.tempBytesLoaded = 0;
this.totalBytesToLoad = 0;
this.positionChargeur = 10;
this.mediaTypes.push("Avant type test");
var _loc3_ = 0;
while(_loc3_ < this.MediaAChargeNode.childNodes.length)
{
switch(this.MediaAChargeNode.childNodes[_loc3_].attributes.type)
{
case "png":
this.pngChargeant = true;
this.photoMovies.push(this.movieRoot.photoStocker.createEmptyMovieClip(this.MediaAChargeNode.childNodes[_loc3_].attributes.id,_loc3_));
this.movieRoot.photoStocker[this.MediaAChargeNode.childNodes[_loc3_].attributes.id]._visible = false;
_loc4_[_loc3_] = new MovieClipLoader();
_loc4_[_loc3_].onLoadInit = mx.utils.Delegate.create(this,this.onPngLoaded);
this.totalBytesToLoad += 1;
break;
case "jpg":
this.jpgChargeant = true;
this.photoMovies.push(this.movieRoot.photoStocker.createEmptyMovieClip(this.MediaAChargeNode.childNodes[_loc3_].attributes.id,_loc3_));
this.movieRoot.photoStocker[this.MediaAChargeNode.childNodes[_loc3_].attributes.id]._visible = false;
_loc4_[_loc3_] = new MovieClipLoader();
_loc4_[_loc3_].onLoadInit = mx.utils.Delegate.create(this,this.onJpgLoaded);
this.totalBytesToLoad += 1;
break;
case "swf":
this.swfChargeant = true;
this.swfMovies.push(this.movieRoot.swfStocker.createEmptyMovieClip(this.MediaAChargeNode.childNodes[_loc3_].attributes.id,_loc3_));
this.movieRoot.swfStocker[this.MediaAChargeNode.childNodes[_loc3_].attributes.id]._x = 0;
_loc4_[_loc3_] = new MovieClipLoader();
_loc4_[_loc3_].onLoadInit = mx.utils.Delegate.create(this,this.onSwfLoaded);
this.totalBytesToLoad += 1;
break;
case "mp3":
this.soundChargeant = true;
this.soundObjects[this.MediaAChargeNode.childNodes[_loc3_].attributes.id] = new Sound();
this.soundObjectList.push(this.soundObjects[this.MediaAChargeNode.childNodes[_loc3_].attributes.id]);
_global.GERETEXTE = this;
this.soundObjects[this.MediaAChargeNode.childNodes[_loc3_].attributes.id].NOM = this.MediaAChargeNode.childNodes[_loc3_].attributes.id;
this.soundObjects[this.MediaAChargeNode.childNodes[_loc3_].attributes.id].onLoad = function(success)
{
_global.GERETEXTE.onSoundLoaded(this,success);
};
this.totalBytesToLoad += 1;
break;
case "interface":
this.swfChargeant = true;
this.movieRoot.createEmptyMovieClip("Interface",15600);
this.swfMovies.push(this.movieRoot.Interface.createEmptyMovieClip(this.MediaAChargeNode.childNodes[_loc3_].attributes.id,_loc3_));
this.movieRoot.Interface[this.MediaAChargeNode.childNodes[_loc3_].attributes.id]._x = 0;
_loc4_[_loc3_] = new MovieClipLoader();
_loc4_[_loc3_].onLoadInit = mx.utils.Delegate.create(this,this.onSwfLoaded);
this.totalBytesToLoad += 1;
}
_loc3_ = _loc3_ + 1;
}
this.mediaTypes = new Array();
if(this.swfChargeant)
{
this.mediaTypes.push("swfChargeant");
}
if(this.soundChargeant)
{
this.mediaTypes.push("soundChargeant");
}
if(this.jpgChargeant)
{
this.mediaTypes.push("jpgChargeant");
}
if(this.pngChargeant)
{
this.mediaTypes.push("pngChargeant");
}
_loc3_ = 0;
while(_loc3_ < this.MediaAChargeNode.childNodes.length)
{
switch(this.MediaAChargeNode.childNodes[_loc3_].attributes.type)
{
case "png":
_loc4_[_loc3_].loadClip(_global.gModulePath + this.MediaAChargeNode.childNodes[_loc3_].attributes.src,this.movieRoot.photoStocker[this.MediaAChargeNode.childNodes[_loc3_].attributes.id]);
break;
case "jpg":
_loc4_[_loc3_].loadClip(_global.gModulePath + this.MediaAChargeNode.childNodes[_loc3_].attributes.src,this.movieRoot.photoStocker[this.MediaAChargeNode.childNodes[_loc3_].attributes.id]);
break;
case "swf":
_loc4_[_loc3_].loadClip(_global.gModulePath + this.MediaAChargeNode.childNodes[_loc3_].attributes.src,this.movieRoot.swfStocker[this.MediaAChargeNode.childNodes[_loc3_].attributes.id]);
break;
case "mp3":
this.soundObjects[this.MediaAChargeNode.childNodes[_loc3_].attributes.id].loadSound(_global.gModulePath + this.MediaAChargeNode.childNodes[_loc3_].attributes.src,false);
this.movieRoot.debugger.text += "mp3 deuxieme boucle : " + this.MediaAChargeNode.childNodes[_loc3_].attributes.src + "\n";
break;
case "interface":
_loc4_[_loc3_].loadClip(_global.gModulePath + this.MediaAChargeNode.childNodes[_loc3_].attributes.src,this.movieRoot.Interface[this.MediaAChargeNode.childNodes[_loc3_].attributes.id]);
break;
default:
_global.xtrace("ChargementMedias.lancerPrechargement : " + this.MediaAChargeNode.childNodes[_loc3_].attributes.type + " invalide!!!");
}
_loc3_ = _loc3_ + 1;
}
}
function onPngLoaded(mc)
{
mc._visible = false;
this.tempBytesLoaded += 1;
var _loc4_ = Math.floor(10 - this.tempBytesLoaded / this.totalBytesToLoad * 100 / 10);
if(_loc4_ > 0 && _loc4_ !== this.positionChargeur)
{
this.positionChargeur = _loc4_;
this.movieRoot.chargement.gotoAndPlay("pCent" + _loc4_);
}
var _loc2_ = 0;
while(_loc2_ < this.photoMovies.length)
{
this.movieRoot.debugger.text += this.photoMovies[_loc2_] + "\n";
if(this.photoMovies[_loc2_] == mc)
{
this.photoMovies.splice(_loc2_,1);
}
_loc2_ = _loc2_ + 1;
}
if(this.photoMovies.length == 0)
{
this.movieRoot.debugger.text += "allphotos png Loaded\n";
this.onAllLoaded("allphotos png have been Loaded");
}
}
function onJpgLoaded(mc)
{
mc._visible = false;
this.tempBytesLoaded += 1;
var _loc4_ = Math.floor(10 - this.tempBytesLoaded / this.totalBytesToLoad * 100 / 10);
if(_loc4_ > 0 && _loc4_ !== this.positionChargeur)
{
this.positionChargeur = _loc4_;
this.movieRoot.chargement.gotoAndPlay("pCent" + _loc4_);
}
var _loc2_ = 0;
while(_loc2_ < this.photoMovies.length)
{
this.movieRoot.debugger.text += this.photoMovies[_loc2_] + "\n";
if(this.photoMovies[_loc2_] == mc)
{
this.photoMovies.splice(_loc2_,1);
}
_loc2_ = _loc2_ + 1;
}
if(this.photoMovies.length == 0)
{
this.movieRoot.debugger.text += "allphotos jpg Loaded\n";
this.onAllLoaded("allphotos jpg have been Loaded");
}
}
function onSwfLoaded(mc)
{
mc._visible = false;
_global.stopIt(mc);
this.tempBytesLoaded += 1;
var _loc5_ = Math.floor(10 - this.tempBytesLoaded / this.totalBytesToLoad * 100 / 10);
if(_loc5_ > 0 && _loc5_ !== this.positionChargeur)
{
this.positionChargeur = _loc5_;
this.movieRoot.chargement.gotoAndPlay("pCent" + _loc5_);
}
this.movieRoot.text_test.text = String(_loc5_);
var _loc3_ = 0;
while(_loc3_ < this.swfMovies.length)
{
if(this.swfMovies[_loc3_] == mc)
{
this.swfMovies.splice(_loc3_,1);
}
_loc3_ = _loc3_ + 1;
}
if(this.swfMovies.length == 0)
{
this.movieRoot.debugger.text += "allSwfsLoaded\n";
this.onAllLoaded("allSwfs have been Loaded");
}
}
function onSoundLoaded(mc_son, success)
{
if(success)
{
this.tempBytesLoaded += 1;
var _loc3_ = Math.floor(10 - this.tempBytesLoaded / this.totalBytesToLoad * 100 / 10);
if(_loc3_ > 0 && _loc3_ !== this.positionChargeur)
{
this.positionChargeur = _loc3_;
this.movieRoot.chargement.gotoAndPlay("pCent" + _loc3_);
}
this.soundObjectList.splice(0,1);
}
else
{
_global.xtrace("Problem avec chargement le Son " + mc_son.NOM);
}
if(this.soundObjectList.length == 0)
{
this.movieRoot.debugger.text += "allsoundsLoaded\n";
this.onAllLoaded("allsounds have been Loaded");
}
}
function onAllLoaded(msg)
{
_global.xtrace(msg);
this.movieRoot.debugger.text += "onAllLoaded" + msg + "\n";
this.mediaTypes.splice(0,1);
if(this.mediaTypes.length == 0)
{
this.movieRoot.chargement._visible = false;
this.movieRoot.debugger.text += "allLoaded\n";
_global.xtrace("allMediaLoaded");
this.movieRoot.mediaLoaded();
}
}
function returnSoundObject()
{
return this.soundObjects;
}
}