home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 136
/
MOBICLIC136.ISO
/
pc
/
DATA
/
HOTE
/
prod_gen_JLM
/
moteur.swf
/
scripts
/
__Packages
/
prod
/
moteur
/
V014_GereTextes.as
< prev
Wrap
Text File
|
2011-07-20
|
22KB
|
673 lines
class prod.moteur.V014_GereTextes
{
function V014_GereTextes(movieRoot, moduleInfo)
{
this.movieRoot = movieRoot;
this.moduleInfo = moduleInfo;
this.policeBase = "";
this.positionIB = 0;
this.gFmtBase = new TextFormat();
this.gListeLMTemp = new Array();
}
function getTextById(myXML, attributeValue)
{
this.myStyle = undefined;
this.myText = undefined;
this.myText = this.recusiveGetTextByAttribute(myXML,"id",attributeValue);
if(this.myText == undefined)
{
trace(attributeValue + " n\'existe pas dans XML");
}
return this.myText;
}
function recusiveGetTextByAttribute(node, attribute, attributeValue)
{
var _loc2_ = 0;
while(_loc2_ < node.childNodes.length)
{
if(node.childNodes[_loc2_].attributes[attribute] == attributeValue)
{
this.myText = node.childNodes[_loc2_].firstChild.nodeValue;
if(node.childNodes[_loc2_].attributes.style !== undefined)
{
this.myStyle = node.childNodes[_loc2_].attributes.style;
}
break;
}
if(node.childNodes[_loc2_].hasChildNodes())
{
this.recusiveGetTextByAttribute(node.childNodes[_loc2_],attribute,attributeValue);
}
_loc2_ = _loc2_ + 1;
}
return this.myText;
}
function appliqueStyle(myNodeName, myValue, lBoldItalic, myClipText, myClipFond)
{
switch(myNodeName)
{
case "police":
this.policeBase = String(myValue);
break;
case "bold":
lBoldItalic = String(myValue) + lBoldItalic.charAt(1);
break;
case "italic":
lBoldItalic = lBoldItalic.charAt(0) + String(myValue);
break;
case "corps":
this.gFmtBase.size = Number(myValue);
break;
case "justify":
this.gFmtBase.align = String(myValue);
myClipText.autoSize = String(myValue);
break;
case "underline":
if(Number(myValue) == 1)
{
this.gFmtBase.underline = true;
}
else
{
this.gFmtBase.underline = false;
}
break;
case "couleurT":
myClipText.textColor = String(myValue);
break;
case "couleurF":
var _loc6_ = new Color(myClipFond);
_loc6_.setRGB(Number(myValue));
break;
case "couleurRollT":
myClipText._parent._parent.couleurRollT = String(myValue);
break;
case "couleurRollF":
myClipText._parent._parent.couleurRollF = String(myValue);
break;
case "opaciteF":
myClipFond._alpha = Number(myValue);
break;
case "position":
this.positionIB = Number(myValue);
break;
case "action":
var _loc7_ = myClipText._parent._parent;
this.movieRoot.myValue(_loc7_);
break;
case "lien":
if(Number(myValue) !== 0)
{
myClipFond.onRollOver = function()
{
myClipText.textColor = String("0x6633FF");
_global.gereCursor(2);
};
myClipFond.onRollOut = function()
{
myClipText.textColor = String("0x0000FF");
_global.gereCursor(1);
};
myClipFond.onPress = function()
{
_global.gereCursor(1);
};
break;
}
}
return lBoldItalic;
}
function attribueStyle(myXmlStyle, myID, myClipText, myClipFond, myType, myTextRepere)
{
var _loc19_ = 0;
this.gFmtBase = new TextFormat();
var _loc8_ = new XML();
var _loc6_ = "00";
var _loc2_ = 0;
while(_loc2_ < myXmlStyle.childNodes.length)
{
if(myXmlStyle.childNodes[_loc2_].attributes.id == myType)
{
var _loc7_ = 0;
while(_loc7_ < myXmlStyle.childNodes[_loc2_].childNodes.length)
{
var _loc5_ = myXmlStyle.childNodes[_loc2_].childNodes[_loc7_].nodeName;
var _loc4_ = myXmlStyle.childNodes[_loc2_].childNodes[_loc7_].firstChild.nodeValue;
_loc6_ = this.appliqueStyle(_loc5_,_loc4_,_loc6_,myClipText,myClipFond);
_loc7_ = _loc7_ + 1;
}
}
else
{
if(myXmlStyle.childNodes[_loc2_].attributes.id == myID)
{
_loc8_ = myXmlStyle.childNodes[_loc2_];
break;
}
if(myXmlStyle.childNodes[_loc2_].attributes.id == this.myStyle)
{
_loc8_ = myXmlStyle.childNodes[_loc2_];
break;
}
}
_loc2_ = _loc2_ + 1;
}
if(_loc8_.childNodes.length !== 0)
{
_loc7_ = 0;
while(_loc7_ < _loc8_.childNodes.length)
{
_loc5_ = _loc8_.childNodes[_loc7_].nodeName;
_loc4_ = _loc8_.childNodes[_loc7_].firstChild.nodeValue;
_loc6_ = this.appliqueStyle(_loc5_,_loc4_,_loc6_,myClipText,myClipFond);
_loc7_ = _loc7_ + 1;
}
}
switch(_loc6_)
{
case "00":
this.policeBase += "_p";
break;
case "10":
this.policeBase += "_b";
break;
case "11":
this.policeBase += "_bi";
break;
case "01":
this.policeBase += "_i";
}
if(myClipFond !== undefined)
{
this.gFmtBase.font = this.policeBase;
myClipText.embedFonts = 1;
}
var _loc12_ = "";
var _loc9_ = this.myText.split("§")[0];
if(_loc9_ == this.myText)
{
myClipText.text = this.myText;
}
else
{
_loc2_ = 0;
while(_loc9_ != undefined)
{
_loc9_ = this.myText.split("§")[_loc2_];
if(_loc9_ != undefined)
{
_loc12_ = _loc12_ + _loc9_ + "\n";
}
_loc2_ = _loc2_ + 1;
}
myClipText.text = _loc12_;
if(myTextRepere !== undefined)
{
var _loc17_ = myTextRepere.getTextFormat();
this.gFmtBase.leading = _loc17_.leading;
}
}
if(myClipText.Leading != undefined)
{
this.gFmtBase.leading = myClipText.Leading;
}
myClipText.setTextFormat(this.gFmtBase);
var _loc16_ = myClipText._parent._parent._parent;
_loc16_.createTextField("texte_test_" + myID,this.movieRoot.chercheDepthPlus(_loc16_,0),0,0,50,30);
var _loc14_ = _loc16_["texte_test_" + myID];
_loc14_.text = "fog";
_loc14_.setTextFormat(this.gFmtBase);
myClipText._parent.lH = _loc14_._height;
_loc14_.removeTextField();
}
function recupFormatTextFla(mcText, mcTextRepere, mcFond)
{
var _loc2_ = mcTextRepere.getTextFormat();
this.gFmtBase = new TextFormat();
this.gFmtBase.size = _loc2_.size;
this.gFmtBase.align = _loc2_.align;
this.gFmtBase.underline = _loc2_.underline;
this.policeBase = _loc2_.font;
if(_loc2_.bold == true && _loc2_.italic == true)
{
this.policeBase += "_bi";
}
else if(_loc2_.bold == false && _loc2_.italic == false)
{
this.policeBase += "_p";
}
else if(_loc2_.bold == true && _loc2_.italic == false)
{
this.policeBase += "_b";
}
else
{
this.policeBase += "_i";
}
this.gFmtBase.font = this.policeBase;
mcText.embedFonts = true;
mcText.autoSize = mcTextRepere.autoSize;
mcText.textColor = mcTextRepere.textColor;
mcText.setTextFormat(this.gFmtBase);
mcFond._alpha = 0;
}
function afficheST(myST)
{
var _loc6_ = this.moduleInfo.returnNodeByPath("Module.StylesTextes.StylesST");
var _loc7_ = this.moduleInfo.returnNodeByPath("Module." + this.movieRoot.gLangue + ".Sous-Titres");
this.movieRoot.createEmptyMovieClip("STitres",15900);
this.movieRoot.STitres.attachMovie("ST","STT_",2);
var _loc2_ = this.movieRoot.STitres;
var _loc3_ = _loc2_.STT_.texte;
var _loc4_ = _loc2_.STT_.fond;
var _loc5_ = String(myST.split("_").splice(2).join("_"));
this.myText = "";
this.myText = this.getTextById(_loc7_,_loc5_);
this.attribueStyle(_loc6_,_loc5_,_loc3_,_loc4_,"ST");
_loc2_._x = 140;
_loc2_._y = 600 - _loc3_.textHeight - 3;
_loc4_._height = _loc3_.textHeight + 10;
this.movieRoot.gSousTitre = 1;
}
function masqueST()
{
removeMovieClip(this.movieRoot.STitres);
this.movieRoot.gSousTitre = 0;
}
function afficheTE(myTE)
{
var _loc7_ = this.moduleInfo.returnNodeByPath("Module.StylesTextes.StylesTE");
var _loc6_ = this.moduleInfo.returnNodeByPath("Module." + this.movieRoot.gLangue + ".Titres");
this.movieRoot.createEmptyMovieClip("Titres",15050);
this.movieRoot.Titres.attachMovie("TE","TE",2);
var _loc3_ = this.movieRoot.Titres;
var _loc5_ = _loc3_.TE.texte;
var _loc4_ = _loc3_.TE.fond;
this.myText = "";
this.myText = this.getTextById(_loc6_,myTE);
this.attribueStyle(_loc7_,myTE,_loc5_,_loc4_,"TE");
_loc3_.TE._x = 400;
_loc4_._x = 400 - _loc5_.textWidth - 30;
if(this.movieRoot.substr(0,3) == "TCH")
{
this.movieRoot.Titres.onRollOver = function()
{
if(this.movieRoot.vocabJeu == 1)
{
if(this.movieRoot.dialogue == 0)
{
this.useHandCursor = 1;
this.movieRoot.joueSon(_root,"TE",0);
}
else
{
this.useHandCursor = 0;
}
}
else
{
this.useHandCursor = 0;
}
};
this.movieRoot.Titres.onRollOut = function()
{
if(this.movieRoot.vocabJeu == 1)
{
if(this.movieRoot.gCommentOn == 1)
{
this.movieRoot.stopSon(this.movieRoot);
}
}
};
}
}
function masqueTE()
{
removeMovieClip(this.movieRoot.Titres);
}
function afficheLM(p)
{
var _loc2_ = p.codeLM;
if(p.mc == undefined)
{
var _loc3_ = this.movieRoot;
}
else
{
_loc3_ = p.mc;
}
if(p.numR !== undefined)
{
var _loc15_ = p.numR;
}
if(p.X !== undefined)
{
var _loc11_ = p.X;
var _loc10_ = p.Y;
var _loc8_ = p.width;
var _loc9_ = p.height;
var _loc12_ = 1;
}
var _loc13_ = this.moduleInfo.returnNodeByPath("Module.StylesTextes.StylesLM");
var _loc16_ = this.moduleInfo.returnNodeByPath("Module." + this.movieRoot.gLangue + ".LegendesMedias");
if(_loc3_[_loc2_] == undefined)
{
_loc3_.createEmptyMovieClip(_loc2_,this.movieRoot.chercheDepthPlus(_loc3_,0));
_loc3_[_loc2_].attachMovie("LM","LM",_loc3_[_loc2_].getNextHighestDepth());
var _loc14_ = _loc3_[_loc2_].LM;
var _loc6_ = _loc14_.texte;
var _loc7_ = _loc14_.fond;
this.myText = "";
this.myText = this.getTextById(_loc16_,_loc2_);
if(p.texte_LM != undefined)
{
var _loc5_ = _loc3_[p.texte_LM];
}
else if(_loc3_["texte_" + _loc2_] == undefined)
{
if(_loc2_.split("")[3] == "Q")
{
if(_loc2_.split("")[4] !== "I")
{
this.gListeLMTemp.push(_loc3_[_loc2_]);
_loc5_ = _loc3_.texte_LMQ;
}
}
if(_loc2_.split("")[3] == "R")
{
if(_loc2_.split("")[4] !== "I")
{
this.gListeLMTemp.push(_loc3_[_loc2_]);
_loc5_ = _loc3_["texte_LMR" + _loc15_];
}
}
if(_loc2_.split("")[3] == "T")
{
this.gListeLMTemp.push(_loc3_[_loc2_]);
_loc5_ = _loc3_.texte_LMT;
}
if(_loc2_.split("")[3] == "C")
{
this.gListeLMTemp.push(_loc3_[_loc2_]);
_loc5_ = _loc3_.texte_LMC;
}
if(_loc5_ == undefined)
{
trace("la LM " + _loc2_ + " est envoyée de director ou de flash avec des coordonnees et dimensions");
_loc3_.createTextField("texte_" + _loc2_,this.movieRoot.chercheDepthPlus(_loc3_,0),_loc11_,_loc10_,_loc8_,_loc9_);
_loc5_ = _loc3_["texte_" + _loc2_];
_loc5_.text = this.myText;
this.attribueStyle(_loc13_,_loc2_,_loc5_,undefined,"LM",undefined);
_loc5_._x = _loc11_;
_loc5_._y = _loc10_;
_loc5_._width = _loc8_;
}
}
else
{
_loc5_ = _loc3_["texte_" + _loc2_];
}
_loc6_.Leading = p.leading;
if(p.use_TXT_FLA == undefined)
{
this.attribueStyle(_loc13_,_loc2_,_loc6_,_loc7_,"LM",_loc5_);
}
else
{
this.recupFormatTextFla(_loc6_,_loc5_,_loc7_);
}
if(_loc12_ == undefined)
{
_loc3_[_loc2_]._x = _loc5_._x;
_loc3_[_loc2_]._y = _loc5_._y;
_loc6_._width = _loc5_._width;
_loc6_._height = _loc5_._height;
_loc7_._width = _loc5_._width;
_loc7_._height = _loc5_._height;
}
else
{
_loc3_[_loc2_]._x = _loc11_;
_loc3_[_loc2_]._y = _loc10_;
_loc6_._width = _loc8_;
_loc7_._width = _loc8_;
if(_loc6_._height > _loc9_)
{
_loc7_._height = _loc6_._height;
}
else
{
_loc7_._height = _loc9_;
}
}
_loc5_._visible = 0;
_loc12_ = undefined;
}
}
function masqueLM(p)
{
var _loc3_ = p.codeLM;
if(p.mc == undefined)
{
var _loc2_ = this.movieRoot;
}
else
{
_loc2_ = p.mc;
}
removeMovieClip(_loc2_[_loc3_]);
}
function videLM()
{
if(this.gListeLMTemp.length !== 0)
{
var _loc2_ = 0;
while(_loc2_ < this.gListeLMTemp.length)
{
removeMovieClip(this.gListeLMTemp[_loc2_]);
_loc2_ = _loc2_ + 1;
}
}
this.gListeLMTemp = new Array();
}
function init_gListeLM(my_array)
{
this.gListeLMTemp = my_array;
}
function afficheIB(p)
{
var _loc5_ = p.codeIB;
if(p.mc !== undefined)
{
var _loc8_ = p.mc;
}
else if(p.X !== undefined)
{
var _loc7_ = p.X;
var _loc11_ = p.Y;
}
else
{
trace("le positionnement de l\'IB " + _loc5_ + " necessite soit un clip de reference, soit une position x et y");
}
var _loc10_ = this.moduleInfo.returnNodeByPath("Module.StylesTextes.StylesIB");
var _loc9_ = this.moduleInfo.returnNodeByPath("Module." + this.movieRoot.gLangue + ".InfoBulles");
this.movieRoot.createEmptyMovieClip("IB",this.movieRoot.getNextHighestDepth());
this.movieRoot.IB.attachMovie("IB","IB",4);
var _loc3_ = this.movieRoot.IB;
var _loc6_ = _loc3_.IB.texte;
var _loc2_ = _loc3_.IB.fond;
this.myText = "";
this.myText = this.getTextById(_loc9_,_loc5_);
this.attribueStyle(_loc10_,_loc5_,_loc6_,_loc2_,"IB");
_loc2_._width = _loc6_.textWidth + 10;
_loc2_._height = _loc6_.textHeight + 10;
_loc2_._x = -2.5;
_loc2_._y = -2.5;
if(_loc7_ == undefined)
{
this.placeIB(_loc8_,_loc3_,_loc2_);
}
else
{
_loc3_._x = _loc7_;
_loc3_._y = _loc11_;
}
}
function masqueIB()
{
removeMovieClip(this.movieRoot.IB);
}
function placeIB(mcReference, myClip, myClipFond)
{
var _loc13_ = mcReference.getBounds(mcReference);
var _loc5_ = mcReference._width;
var _loc8_ = mcReference._height;
var _loc12_ = {x:0,y:0};
_loc12_ = this.movieRoot.ConvertCoord(mcReference,this.movieRoot);
var _loc6_ = _loc12_.x;
var _loc9_ = _loc12_.x + mcReference._width;
var _loc7_ = _loc12_.y;
var _loc11_ = _loc12_.y + mcReference._height;
var _loc4_ = (_loc5_ / 2 + _loc8_ / 2) / 3;
switch(this.positionIB)
{
case 0:
myClip._x = _loc5_ / 2 + _loc6_ - myClipFond._width / 2;
myClip._y = _loc8_ / 2 + _loc7_ - myClipFond._height / 2;
break;
case 1:
if(_loc4_ >= _loc5_ / 2)
{
myClip._x = _loc9_;
myClip._y = _loc8_ / 2 + _loc7_ - _loc4_ * 2 - myClipFond._height / 2;
}
else
{
myClip._x = _loc5_ / 2 + _loc6_ + _loc4_;
myClip._y = _loc7_ - myClipFond._height / 2;
}
break;
case 2:
if(_loc4_ * 2 >= _loc5_ / 2)
{
myClip._x = _loc9_;
myClip._y = _loc8_ / 2 + _loc7_ - _loc4_ - myClipFond._height / 2;
}
else
{
myClip._x = _loc5_ / 2 + _loc6_ + _loc4_ * 2;
myClip._y = _loc7_ - myClipFond._height / 2;
}
break;
case 3:
myClip._x = _loc9_;
myClip._y = _loc8_ / 2 + _loc7_ - myClipFond._height / 2;
break;
case 4:
if(_loc4_ * 2 >= _loc5_ / 2)
{
myClip._x = _loc9_;
myClip._y = _loc8_ / 2 + _loc7_ + _loc4_ - myClipFond._height / 2;
}
else
{
myClip._x = _loc5_ / 2 + _loc6_ + _loc4_ * 2;
myClip._y = _loc11_;
}
break;
case 5:
if(_loc4_ >= _loc5_ / 2)
{
myClip._x = _loc9_;
myClip._y = _loc8_ / 2 + _loc7_ + _loc4_ * 2 - myClipFond._height / 2;
}
else
{
myClip._x = _loc5_ / 2 + _loc6_ + _loc4_;
myClip._y = _loc11_;
}
break;
case 6:
myClip._x = _loc5_ / 2 + _loc6_ - myClipFond._width / 2;
myClip._y = _loc11_;
break;
case 7:
if(_loc4_ >= _loc5_ / 2)
{
myClip._x = _loc6_ - myClipFond._width;
myClip._y = _loc8_ / 2 + _loc7_ + _loc4_ * 2 - myClipFond._height / 2;
}
else
{
myClip._x = _loc5_ / 2 + _loc6_ - _loc4_ - myClipFond._width;
myClip._y = _loc11_;
}
break;
case 8:
if(_loc4_ * 2 >= _loc5_ / 2)
{
myClip._x = _loc6_ - myClipFond._width;
myClip._y = _loc8_ / 2 + _loc7_ + _loc4_ - myClipFond._height / 2;
}
else
{
myClip._x = _loc5_ / 2 + _loc6_ - _loc4_ * 2 - myClipFond._width;
myClip._y = _loc11_;
}
break;
case 9:
myClip._x = _loc6_ - myClipFond._width;
myClip._y = _loc8_ / 2 + _loc7_ - myClipFond._height / 2;
break;
case 10:
if(_loc4_ * 2 >= _loc5_ / 2)
{
myClip._x = _loc6_ - myClipFond._width;
myClip._y = _loc8_ / 2 + _loc7_ - _loc4_ - myClipFond._height / 2;
}
else
{
myClip._x = _loc5_ / 2 + _loc6_ - _loc4_ * 2 - myClipFond._width;
myClip._y = _loc7_ - myClipFond._height / 2;
}
break;
case 11:
if(_loc4_ >= _loc5_ / 2)
{
myClip._x = _loc6_ - myClipFond._width;
myClip._y = _loc8_ / 2 + _loc7_ - _loc4_ * 2 - myClipFond._height;
}
else
{
myClip._x = _loc5_ / 2 + _loc6_ - _loc4_;
myClip._y = _loc7_ - myClipFond._height / 2;
}
break;
case 12:
myClip._x = _loc5_ / 2 + _loc6_ - myClipFond._width / 2;
myClip._y = _loc7_ - myClipFond._height;
break;
case 13:
myClip._x = _xmouse;
myClip._y = _ymouse;
}
if(myClip._x < 10)
{
myClip._x = 10;
}
else if(myClip._x > 800 - myClipFond._width)
{
myClip._x = 800 - myClipFond._width;
}
if(myClip._y < 10)
{
myClip._y = 10;
}
else if(myClip._y > 600 - myClipFond._height)
{
myClip._y = 600 - myClipFond._height;
}
}
}