Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá parceiros,
Estou com um código de um sistema de ticker, ele está 99% de acordo com o que eu preciso porém eu gostaria que ele atualizasse o xml sem carregar a pagina novamente. Vi várias dicas por ai porém nenhuma se aplica ao código que eu tenho. Alguem poderia me ajudar?
O código que estou trabalhando está abaixo:
var width = 250;
var height = 150;
var framerate = 30;
var margin_top = 16;
var margin_left = 85;
var margin_right = 5;
var margin_bottom = 5;
var scroll_speed = 100;
var delay_interval = 30;
var texts_count = 0;
objArray = new Array();
fl_loaded = false;
function isLoaded(success)
{
if (!success)
{
return (0);
} // end if
var lic_len = length(this.firstChild.attributes.license);
if (lic_len != 340)
{
getURL("[http://www.amarasoftware.com/ntlicense.html",](http://www.amarasoftware.com/ntlicense.html) "_self");
return (0);
} // end if
var fChildNodes = this.firstChild.childNodes;
i = 0;
while (i++, i < fChildNodes.length)
{
var node_ = fChildNodes[i];
obj_ = new Object();
obj_.htmlText = "<font face=\"arial\" size=\"14\">" + node_.firstChild.nodeValue + "</font>";
//obj_.higlight_color = node_.attributes["higlight-color"];
//obj_.color = node_.attributes["font-color"];
objArray.push(obj_);
} // end while
texts_count = fChildNodes.length;
fl_loaded = true;
} // End of the function
xmlDoc = new XML();
xmlDoc.ignoreWhite = true;
xmlDoc.onLoad = isLoaded;
xmlDoc.load("data1.xml");
var sleep_count = 0;
var fl_sleep = false;
var fl_last_hided = false;
var type_delay = 5;
if (type_delay < 1)
{
type_delay = 1;
} // end if
TP = TextField.prototype;
TP.hitTest = MovieClip.prototype.hitTest;
ASSetPropFlags(TP, "hitTest", 1);
if (_global.TextFlair == null)
{
_global.TextFlair = new Object();
} // end if
o = _global.TextFlair.ButtonEventFlair = {};
o.snapOn = function (_txt)
{
var flair = _txt.__buttonEventFlair = {};
flair._txt = _txt;
flair.__mouseDown = flair.__press = flair.__over = false;
flair.onMouseMove = this._onMouseMove;
Mouse.addListener(flair);
flair.onMouseMove();
};
o.snapOff = function (_txt)
{
Mouse.removeListener(_txt.__buttonEventFlair);
};
o._onMouseMove = function ()
{
if (!this._txt.hitTest(_level0._xmouse, _level0._ymouse, true))
{
if (this.__over)
{
this.__over = false;
if (this.__mouseDown)
{
if (this.__press)
{
this._txt.onDragOut();
} // end if
}
else
{
this._txt.onRollOut();
} // end if
} // end else if
}
else if (!this.__over)
{
this.__over = true;
if (this.__mouseDown)
{
if (this.__press)
{
this._txt.onDragOver();
} // end if
}
else
{
this._txt.onRollOver();
} // end else if
} // end else if
};
var current_item = 0;
var counter = 0;
var fl_started = false;
var position = 0;
var str_ = "";
var delay_count = 0;
onEnterFrame = function ()
{
if (!fl_loaded)
{
return (null);
} // end if
if (!fl_started)
{
createEmptyMovieClip("main", 1);
fl_started = true;
position = 0;
counter = 0;
main.createTextField("text", 1, margin_left, margin_top, 100, 100);
with (main.text)
{
border = false;
selectable = false;
html = true;
htmlText = objArray[current_item].htmlText;
autoSize = "left";
} // End of with
main.text.onRollOver = function ()
{
this.textColor = objArray[current_item].higlight_color;
};
main.text.onRollOut = function ()
{
this.textColor = objArray[current_item].color;
};
TextFlair.ButtonEventFlair.snapOn(main.text);
str_ = new String(main.text.text);
main.text.textColor = objArray[current_item].color;
} // end if
if (counter == 0)
{
if (position >= str_.length)
{
if (delay_count >= delay_interval)
{
main.removemovieclip();
fl_started = false;
position = 0;
counter = 0;
++current_item;
delay_count = 0;
if (current_item == texts_count)
{
current_item = 0;
} // end if
}
else
{
++delay_count;
} // end else if
}
else
{
with (main.text)
{
color_ = textColor;
htmlText = objArray[current_item].htmlText;
tf_ = getTextFormat();
strl_ = new String(text);
htmlText = strl_.substr(0, position + 1) + "_";
setTextFormat(tf_);
textColor = color_;
} // End of with
++position;
} // end if
} // end else if
++counter;
if (counter == type_delay)
{
counter = 0;
} // end if
};Carregando comentários...