I have this code below but it will not work unless I have my text variable hard coded in there:
addressVars = new LoadVars();
addressVars.load("ticker.txt");
addressVars.onLoad = function() {
//_root.myText = addressVars.news;
isItBold = 'true';
myFontSize = 30;
myTextHeight = myFontSize + 10;
myTextWidth = 400;
//scrollIt(_addressVars.news, 0xFFFFFF, 0, 0, myTextWidth, 3);
function scrollIt(textToWrite, theColor, x, y, width, speed)
{
//trace(addressVars.news);
//trace(textToWrite);
this.createEmptyMovieClip("marquee", 1);
marquee._x = x;
marquee._y = y;
marquee.createEmptyMovieClip("theText", 2);
marquee.theText._x = 15;
marquee.theText._y = 1;
marquee.theText.theWidth = Math.round(addressVars.news.length * 8) + 10;
marquee.theText.createTextField("theTip", 0, 0, -1, marquee.theText.theWidth, myTextHeight);
marquee.theText.formatIt = new TextFormat;
marquee.theText.formatIt.font = "Arial";
marquee.theText.formatIt.align = "left";
marquee.theText.formatIt.bold = isItBold;
//marquee.theText.formatIt.color = theColor;
marquee.theText.formatIt.size = myFontSize;
marquee.theText.formatIt.html = true;
marquee.theText.theTip.html = true;
marquee.theText.theTip.htmlText = addressVars.news;
trace(marquee.theText.theTip.htmlText);
marquee.theText.theTip.setTextFormat(marquee.theText.formatIt);
//textFieldWidth = theText._width + 10;
marquee.theTextFieldWidth = marquee.theText.theTip._width + 10;
marquee.createEmptyMovieClip("backgroundBox", 1);
//marquee.backgroundBox.lineStyle(1, 0xCCCCCC, 100);
marquee.backgroundBox.moveTo(10, 0);
marquee.backgroundBox.beginFill(0x444444, 10);
marquee.backgroundBox.moveToHere = width;
marquee.backgroundBox.lineTo(marquee.backgroundBox.moveToHere, 0);
marquee.backgroundBox.lineTo(marquee.backgroundBox.moveToHere, myTextHeight);
marquee.backgroundBox.lineTo(10, myTextHeight);
marquee.backgroundBox.lineTo(10, 0);
marquee.backgroundBox.endFill();
marquee.theText.setMask(marquee.backgroundBox);
marquee.theText._x = width;
marquee.theText.returnTo = width;
marquee.theText.onEnterFrame = function()
{
returnX = 0 - this._width;
if(this._x > returnX)
{
this._x -= speed;
} else {
this._x = this.returnTo;
}
}
}
}
{/as]
Please let me know what I am doing wrong.