I am using Flash 8 and I am building a flash stock ticker. I want to change the color of the text based on change of the stock (positive or negative). I have created a text file using aspx and I am loading the variables from that file (here's the sample output):
sym_0=ABP&trade_0=4.24&sig
n_0=0&chan
ge_0=-0.16
&percent_0
=-3.64&nam
e_0=ABRAXA
S PETRO (N&sym_1=AGII&trade_1=31.8
1&sign_1=0
&change_1=
-0.12&perc
ent_1=-0.3
8&name_1=A
RGONAUT GROUP IN&sym_2=ALG&trade_2=21.27
&sign_2=0&
change_2=-
0.06&perce
nt_2=-0.28
&name_2=AL
AMO GP INC&sym_3=CFR&trade_3=56.0
0&sign_3=0
&change_3=
-0.10&perc
ent_3=-0.1
8&name_3=C
ULLEN FROST BNKR
I created a variable (sign_*) that denotes the change (0 = negative change, 1 = positive change).
Here's the code I have on my actions line of the movie, frame 1:
myData = new LoadVars();
myData.onLoad = function(){
quote__0 = this.sym_0 + ": $" + this.trade_0 + ", " + this.change_0 + ", " + this.percent_0 + "% ";
quote__1 = this.sym_1 + ": $" + this.trade_1 + ", " + this.change_1 + ", " + this.percent_1 + "% ";
quote__2 = this.sym_2 + ": $" + this.trade_2 + ", " + this.change_2 + ", " + this.percent_2 + "% ";
quote__3 = this.sym_3 + ": $" + this.trade_3 + ", " + this.change_3 + ", " + this.percent_3 + "% ";
format = new TextFormat();
format.color = 0x00FF00;
if (this.sign_0 == 1) {
tQuote_0.setTextFormat(for
mat);
};
if (this.sign_1 == 1) {
tQuote_1.setTextFormat(for
mat);
};
if (this.sign_2 == 1) {
tQuote_2.setTextFormat(for
mat);
};
if (Number(this.sign_3) == 1) {
tQuote_3.setTextFormat(for
mat);
};
};
myData.load("../stocks.txt
");
All of the dynamic text boxes individual graphics, instances are given for each text box).
Everything works except changing the color of the font.
HELP!
Start Free Trial