ActionScripte, Aide pour simplifier mon code svplé.
Reacen
Messages postés282Date d'inscriptionmardi 22 août 2006StatutMembreDernière intervention21 décembre 2010
-
23 août 2008 à 11:07
Reacen
Messages postés282Date d'inscriptionmardi 22 août 2006StatutMembreDernière intervention21 décembre 2010
-
24 août 2009 à 15:43
salut, je suis sur que c'est trop demander cette fois, et que personne ne va repondre.
Mais j'essaye commem :)
Salut a tous, je suis un peu debutant en ActionScripte et tou ca, et j'ai un gros code, ou me faut tirer une simple fonction pour convertir un petit String.
Voila le code:
<hr />
(_global.ank.battlefield.utils.Compressor = function ()
{
super();
}). extractFullPath = function (mapHandler, compressedData)
{
var _loc4 = new Array();
var _loc5 = compressedData.split("");
var _loc7 = compressedData.length;
var _loc8 = mapHandler.getCellCount();
var _loc6 = 0;
while (_loc6 = _loc6 + 3, _loc6 < _loc7)
{
_loc5[_loc6] = ank.utils.Compressor.decode64(_loc5[_loc6]);
_loc5[_loc6 + 1] = ank.utils.Compressor.decode64(_loc5[_loc6 + 1]);
_loc5[_loc6 + 2] = ank.utils.Compressor.decode64(_loc5[_loc6 + 2]);
var _loc9 = (_loc5[_loc6 + 1] & 15) << 6 | _loc5[_loc6 + 2];
if (_loc9 < 0)
{
ank.utils.Logger.err("Erreur");
return (null);
} // end if
if (_loc9 > _loc8)
{
ank.utils.Logger.err("Erreur");
return (null);
} // end if
_loc4.push({num: _loc9, dir: _loc5[_loc6]});
} // end while
return (ank.battlefield.utils.Compressor.makeFullPath(mapHandler, _loc4));
};
<hr />
Comme je vois dans le code, il y a (ank.utils.Compressor.decode64) Donc voila la bilio:
<hr />
if (!ank.utils.Compressor)
{
if (!ank)
{
_global.ank = new Object();
} // end if
if (!ank.utils)
{
_global.ank.utils = new Object();
} // end if var _loc1 (_global.ank.utils.Compressor function ()
{
this.initialize();
}).prototype;
_loc1.initialize = function ()
{
var _loc2 = ank.utils.Compressor.ZKARRAY.length - 1;
this._hashCodes = new Object();
while (_loc2 >= 0)
{
this._hashCodes[ank.utils.Compressor.ZKARRAY[_loc2]] = _loc2;
--_loc2;
} // end while
};
(_global.ank.utils.Compressor = function ()
{
this.initialize();
}).decode64 = function (codedValue)
{
return (ank.utils.Compressor._self._hashCodes[codedValue]);
};
(_global.ank.utils.Compressor = function ()
{
this.initialize();
}).encode64 = function (value)
{
return (ank.utils.Compressor.ZKARRAY[value]);
};
ASSetPropFlags(_loc1, null, 1);
(_global.ank.utils.Compressor = function ()
{
this.initialize(); }).ZIPKEY new Array("_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "_r", "_s", "_t", "_u", "_v", "_w", "_x", "_y", "_z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "-", "_", _global.ank.utils.Compressor function ()
{
this.initialize(); }).ZKARRAY new Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "-", "_", _global.ank.utils.Compressor function ()
{
this.initialize();
})._self = new ank.utils.Compressor();
} // end if
<hr />
La, j'ai telecharger Flash8, et essayer de copier le tout dans l'Action Scripte, quand j'execute, non seulment je trouve plein d'erreur genre : (T'a oublier un '(' ou un ';' ect ..) mais qu'apres les avoir tous corriger, sa renvoie Undefined ..
Tout ce que je veu de ce code c'est une simple function pour fair mes petites convertions et testes comme:
Trace (extractFullPath(Data1,Data2));
Pour que sa me trace apres le resultat ...
Je sais pas comment fair pour ajouter les biblio des Decoadage (Decode64) au projet, peut etre que je doit enlever le (_global .. Et le if (Ank!) ..)
Sinon merci de me donner un code plus simple, ou juste m'expliquer comment metre tout ce code sur le flash pour qu'ille marche comme il le faut