textField Formatting Weirdness

Hi Guys,

I’m building (see: struggling through) my first timeline-less app based on currentTarget and arrays.

I’ve run into a situation where my text fields will format text properly if called at load, but will not do it on a MOUSE DOWN; they just load plain text on the click.

Any ideas?


//Import and initialize all stuff
import flash.display.*;
import flash.net.URLRequest;
import fl.controls.ProgressBar;
import flash.events.MouseEvent;
import caurina.transitions.*;
import caurina.transitions.properties.ColorShortcuts;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();
ColorShortcuts.init();
//Text to be used in fields
var Angio_Measure:String = "Percentage of heart attack patients who receive angioplasty within 90 minutes of hospital arrival.";
var Angio_Why:String = "Time is Muscle - Opening the vessel as soon as possible restores blood flow to the heart muscle. Quickly restoring blood flow reduces the damage to the heart during a heart attack. WellStar treats the most patients emergently for heart attack of any hospital in metro Atlanta.";
//Setup Text Loaders, Graphic Loaders, and Progress Bar
var measuresTextField:TextField = new TextField(); 
addChild(measuresTextField);
//Line 20 follows formatting, but not when called on Mouse Down - WHY???
//measuresTextField.text = Angio_Why;
measuresTextField.width = 420;
measuresTextField.x = 250;
measuresTextField.y = 248;
measuresTextField.wordWrap = true;
measuresTextField.selectable = true;
measuresTextField.autoSize = TextFieldAutoSize.LEFT; 
//Begin text styling
var measuresFormat:TextFormat = new TextFormat(); 
measuresFormat.color = 0x00000; 
measuresFormat.size = 50;
measuresTextField.setTextFormat(measuresFormat);
var whyTextField:TextField = new TextField();
addChild(whyTextField);
whyTextField.width = 420;
whyTextField.x = 250;
whyTextField.y = 310;
whyTextField.wordWrap = true;
whyTextField.selectable = true;
whyTextField.autoSize = TextFieldAutoSize.LEFT;
var whyFormat:TextFormat = new TextFormat();
whyFormat.color = 0x00000;
whyFormat.size = 50;
whyTextField.setTextFormat(whyFormat);
//graphLoader
var graphLoader:Loader = new Loader();
graphLoader.x = 40;
graphLoader.y = 110;
//graphPB
var graphPB:ProgressBar = new ProgressBar();
graphPB.source = graphLoader.contentLoaderInfo;
graphPB.x = 275;
graphPB.y = 160;
//graphLoadingFunction
graphLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoadingGraph);
function finishLoadingGraph(e:Event):void
{
addChild(graphLoader);
removeChild(graphPB);
//graphPB = null;
}
//set up arrays
//buttonArray
var myBtnArray:Array = new Array(mc_Angio, mc_BetaBlocker, mc_Aspirin, mc_Ace, mc_Smoking);
//mouseEvent for loop
for (var i:Number = 0; i < myBtnArray.length; i++)
{
myBtnArray*.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
myBtnArray*.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
myBtnArray*.addEventListener(MouseEvent.MOUSE_DOWN, getStuff);
}
//set up handlers
function overHandler(e:MouseEvent)
{
Tweener.addTween(e.currentTarget, {x:253, _color:0xea0437, transition:"linear", time:.25});
}
function outHandler (e:MouseEvent)
{
Tweener.addTween(e.currentTarget, {x:250, _color:0x00000, transition:"linear", time:.25});
}
function getStuff(e:MouseEvent):void
{
trace("Please work.");
measuresTextField.text = Angio_Measure;
whyTextField.text = Angio_Why;
graphLoader.load(new URLRequest("P01.jpg"));
addChild(graphPB);
}