Hi guys,
I’m using a flash news ticker that I found elsewhere and I’m not so great with actionscript.
Could anyone check the actionscript below and maybe tell me how I can change the depth on the textbox? It’s showing above all the other layers, which I don’t want, as I want to put rectangles in with gradients to make the text have the appearance of fading in from the right and out to the left.
function newsticker(content, posX, posY, depth, tempo) {
this.loadVariables(content);
this.onData = function() {
function tick() {
text1._x = text1._x-tempo;
text2._x = text2._x-tempo;
if (text1._x<=-text1._width) {
text1._x = text2._x+text2._width;
}
// end if
if (text2._x<=-text1._width) {
text2._x = text1._x+text1._width;
}
// end if
updateAfterEvent();
}
// End of the function
if (news.length<200) {
characters = news.length;
while (news.length<200) {
news = news+" "+news;
}
// end while
}
// end if
var _loc1 = new TextFormat();
createTextField("text1", depth, posX, posY, 10, 0);
createTextField("text2", depth+1, posX, posY, 10, 0);
text1.html = true;
text1.embedFonts = true;
text2.html = true;
text2.embedFonts = true;
_loc1.color = 0;
_loc1.font = "Arial";
_loc1.size = 13;
text1.htmlText = news;
text2.htmlText = news;
text1.setTextFormat(_loc1);
text2.setTextFormat(_loc1);
text1.selectable = false;
text1.autoSize = "left";
text2.selectable = false;
text2.autoSize = "left";
text2._x = text1._width+text1._x;
setInterval(tick, 5);
};
}
// End of the function
cid = "medical_records";
System.useCodepage = true;
newsticker("/flash/tickernews.php", 600, 5, 1, 1);
_global.regularEaseInOut = mx.transitions.easing.Regular.easeInOut;
_global.strongEaseOut = mx.transitions.easing.Strong.easeOut;
_global.strongEaseIn = mx.transitions.easing.Strong.easeIn;
_global.strongEaseInOut = mx.transitions.easing.Strong.easeInOut;
_global.elasticEaseIn = mx.transitions.easing.Elastic.easeIn;
_global.elasticEaseOut = mx.transitions.easing.Elastic.easeOut;
_global.elasticEaseInOut = mx.transitions.easing.Elastic.easeInOut;
_global.bounceEaseOut = mx.transitions.easing.Bounce.easeOut;
_global.bounceEaseIn = mx.transitions.easing.Bounce.easeIn;
MovieClip.prototype.animate = function(prop, easeType, startPos, endPos, time, yoyo, rew, timeout, OMFfunc) {
var _loc2 = new mx.transitions.Tween(this, prop, easeType, startPos, endPos, time, true);
var mc = this;
_loc2.onMotionFinished = function() {
if (yoyo) {
this.yoyo();
}
// end if
if (rew) {
this.rewind();
}
// end if
if (OMFfunc) {
OMFfunc(mc);
}
// end if
};
};
Thanks SO much to anyone who can help!
Ben