04/09/2007, 17:20
|
| | Fecha de Ingreso: febrero-2005 Ubicación: MEXICO
Mensajes: 455
Antigüedad: 19 años, 9 meses Puntos: 5 | |
Por que esforzarse tanto para hacer algo tan sencillo? Westinghouse
el header, mide 27KB
indage en el swf (code)
encontre esto: http://www.westinghouse.com/xml/menu.xml (una referencia a esta ruta)
La cuestion:
POR QUE ESFORZARSE TANGO EN CARGAR LOS DATOS DE XML (imagenes posiciones, textos) y luego hacer una programacion de este calibre
Código:
// Action script...
// [Action in Frame 1]
function loadXml() {
xml = new XML();
xml.ignoreWhite = true;
xml.load("xml/menu.xml");
xml.onLoad = function (success) {
loadMenu();
};
} // End of the function
function loadMenu() {
var _loc22 = xml.childNodes[0].childNodes[0];
var _loc20 = _loc22.childNodes[0];
var _loc18 = _loc22.childNodes[1];
var _loc21 = _loc22.childNodes[2];
var _loc19 = xml.childNodes[0].childNodes[1];
config = new Object();
config.duration = Number(_loc20.attributes.duration);
config.startPause = Number(_loc20.attributes.startPause);
config.endPause = Number(_loc20.attributes.endPause);
config.type = String(_loc20.attributes.type);
config.aniSec = Number(_loc20.attributes.aniSec);
config.x = Number(_loc21.attributes.x);
config.y = Number(_loc21.attributes.y);
config.font = String(_loc21.attributes.font);
config.size = Number(_loc21.attributes.size);
config.debug = Number(_loc20.attributes.debug);
config.antialias = Number(_loc21.attributes.antialias);
logo = new Object();
logo.duration = _loc18.attributes.duration;
logo.startPause = _loc18.attributes.startPause;
logo.endPause = _loc18.attributes.endPause;
logo.type = _loc18.attributes.type;
logo.aniSec = _loc18.attributes.aniSec;
logo.aniSec2 = _loc18.attributes.aniSec2;
logo.x = _loc18.attributes.x;
logo.y = _loc18.attributes.y;
logo.blurEffect = _loc18.attributes.blur;
logo.blurX = _loc18.attributes.blurX;
logo.blurY = _loc18.attributes.blurY;
logo.blurAmount = _loc18.attributes.blurAmount;
if (!checkNull(logo.x)) {
logoMC._x = logo.x;
} // end if
if (!checkNull(logo.y)) {
logoMC._y = logo.y;
} // end if
if (config.debug == 1) {
debug._visible = true;
} // end if
menu = new Object();
menu.group = new Array();
for (var _loc4 = 0; _loc4 < _loc19.childNodes.length; ++_loc4) {
menu.group[_loc4] = new Array();
var _loc3 = _loc19.childNodes[_loc4];
for (var _loc2 = 0; _loc2 < _loc3.childNodes.length; ++_loc2) {
var _loc15 = _loc3.childNodes[_loc2].attributes.x;
var _loc14 = _loc3.childNodes[_loc2].attributes.y;
var _loc16 = _loc3.childNodes[_loc2].attributes.type;
var _loc6 = _loc3.childNodes[_loc2].attributes.duration;
var _loc12 = _loc3.childNodes[_loc2].attributes.endPause;
var _loc7 = _loc3.childNodes[_loc2].attributes.start;
var _loc8 = _loc3.childNodes[_loc2].attributes.end;
var _loc9 = _loc3.childNodes[_loc2].attributes.src;
var _loc5 = _loc3.childNodes[_loc2].childNodes[0].nodeValue;
var _loc17 = _loc3.childNodes[_loc2].attributes.aniSec;
var _loc11 = _loc3.childNodes[_loc2].attributes.startPause;
var _loc13 = _loc3.childNodes[_loc2].attributes.logoStop;
var _loc10 = _loc3.childNodes[_loc2].attributes.logoStart;
menu.group[_loc4][_loc2] = {src: _loc9, textItem: _loc5, x: _loc15, y: _loc14, type: _loc16, duration: _loc6, endPause: _loc12, startNum: _loc7, endNum: _loc8, aniSec: _loc17, startPause: _loc11, logoStop: _loc13, logoStart: _loc10};
} // end of for
} // end of for
menu.current = 0;
_root.nextFrame();
} // End of the function
function changeText(MC, text) {
var _loc4 = menu.group[menu.current][0].x;
var _loc2 = menu.group[menu.current][0].y;
if (checkNull(_loc4)) {
_loc4 = config.x;
} // end if
if (checkNull(_loc2)) {
_loc2 = config.y;
} // end if
MC._x = _loc4;
MC._y = _loc2;
MC = MC.textInfo;
MC.multiline = true;
MC.wordWrap = true;
MC.border = false;
MC.selectable = false;
MC.html = true;
MC.htmlText = text;
if (config.antialias == 1) {
MC.embedFonts = true;
MC.antiAliasType = "advanced";
} // end if
var _loc3 = new TextFormat();
_loc3.font = String(config.font);
_loc3.size = Number(config.size);
MC.setTextFormat(_loc3);
} // End of the function
function checkNull(node) {
if (node == "" || node == null || node == undefined) {
return (true);
}
else {
return (false);
} // end else if
} // End of the function
function tweenMC(sec, mc, type, startAni, endAni, end) {
stop ();
mc._alpha = 100;
clearInterval(intervalId);
if (checkNull(sec) && checkNull(startAni) && checkNull(endAni)) {
sec = 0;
}
else if (checkNull(sec)) {
sec = Number(config.aniSec);
}
else {
sec = Number(sec);
} // end else if
var type = String(type);
startAni = Number(startAni);
endAni = Number(endAni);
var ease;
if (type == "pause") {
type = "pause";
}
else if (type == "spin") {
type = "_xscale";
startAni = -100;
endAni = 100;
ease = mx.transitions.easing.Regular.easeIn;
}
else if (type == "alpha") {
type = "_alpha";
ease = mx.transitions.easing.Regular.easeIn;
}
else if (type == "y") {
type = "_y";
ease = mx.transitions.easing.Regular.easeOut;
}
else if (type == "right") {
if (mc._name == "textMC") {
msk._x = 550;
} // end if
type = "_x";
ease = mx.transitions.easing.Regular.easeOut;
}
else {
if (mc._name == "textMC") {
msk._x = 0;
} // end if
type = "_x";
ease = mx.transitions.easing.Regular.easeOut;
} // end else if
if (sec == "" || sec == 0) {
play ();
}
else {
var _loc6 = new mx.transitions.Tween(mc, type, ease, startAni, endAni, sec, true);
if (type == "_xscale" && Number(logo.blurEffect) == 1) {
var _loc5 = new flash.filters.BlurFilter(Number(logo.blurX), Number(logo.blurY), Number(logo.blurAmount));
var _loc2 = logoMC.filters;
_loc2.push(_loc5);
logoMC.filters = _loc2;
ease = mx.transitions.easing.Regular.easeOut;
} // end if
if (type == "_xscale") {
_loc6.onMotionFinished = function () {
if (Number(logo.aniSec2)) {
sec = Number(logo.aniSec2);
} // end if
var _loc1 = new mx.transitions.Tween(mc, type, ease, 100, -100, sec + 1.000000E-001, true);
_loc1.onMotionFinished = function () {
if (Number(logo.blurEffect) == 1) {
logoMC.filters = "";
} // end if
};
};
} // end if
intervalId = setInterval(_root, "nextFrame", sec * 1000);
} // end else if
} // End of the function
debug._visible = false;
stop ();
_root.onEnterFrame = function () {
if (this.getBytesLoaded >= this.getBytesTotal) {
delete this.onEnterFrame;
loadXml();
} // end if
};
// [Action in Frame 2]
textMC._alpha = 100;
var logoStop = Number(menu.group[menu.current][0].logoStop);
var logoStart = Number(menu.group[menu.current][0].logoStart);
var text = menu.group[menu.current][0].textItem;
changeText(textMC, text);
if (logoStop == 1 && checkNull(logoStart)) {
var x = menu.group[menu.current][0].x;
var y = menu.group[menu.current][0].y;
if (checkNull(x)) {
x = config.x;
} // end if
if (checkNull(y)) {
y = config.y;
} // end if
textMC._x = x;
textMC._y = y;
var type = String(menu.group[menu.current][0].type);
if (type == "right") {
msk._x = 550;
}
else {
msk._x = 0;
} // end else if
_root.nextFrame();
}
else {
var duration = logo.aniSec;
var type = logo.type;
if (logoStop != 1) {
tweenMC(duration, logoMC, type);
} // end if
var duration = menu.group[menu.current][0].aniSec;
if (checkNull(duration)) {
duration = config.aniSec;
} // end if
var type = menu.group[menu.current][0].type;
var startNum = menu.group[menu.current][0].startNum;
var endNum = menu.group[menu.current][0].endNum;
tweenMC(duration, textMC, type, startNum, endNum);
} // end else if
// [Action in Frame 3]
stop ();
MC1._alpha = 0;
MC2._alpha = 0;
MC3._alpha = 0;
src1 = menu.group[menu.current][1].src;
src2 = menu.group[menu.current][2].src;
src3 = menu.group[menu.current][3].src;
config.startTimer = getTimer();
clearInterval(intervalId);
if (!checkNull(src1)) {
var loadListener = new Object();
loadListener.onLoadError = function (target_mc, errorCode, httpStatus) {
MC1.loadMC = true;
};
loadListener.onLoadComplete = function (target_mc) {
MC1.loadMC = true;
};
var mcLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
mcLoader.loadClip(String(src1), MC1);
}
else {
MC1.loadMC = true;
} // end else if
if (!checkNull(src2)) {
var loadListener = new Object();
loadListener.onLoadError = function () {
MC2.loadMC = true;
y multipliquenlo por CUATRO O CINCO.....
para que esforzarse de esa manera, con algo tan, PERO TAN, TAN, SIMPLE....y aburrido como un header animado (que considerando ya tener los recursos [graficos, textos, idea], se puede animar en la linea de tiempo en unas horas, y si consideramos preloaders, etc..en un dia)...con que objeto????
que opinan.
PD: entiendo la optimizacion, reducir el peso al archivo, etc, etc...pero eso es una cosa, esto realmente parece obsesivo para qu todo quede a codigo...
__________________ |