all groups > flash actionscript > november 2004 >
You're in the

flash actionscript

group:

change transparent text to opaque


change transparent text to opaque janst
11/17/2004 6:15:58 PM
flash actionscript: Hi,
I have a script that tells the "Q" key to add 1 to a dynamic keyframe called
h_q up unitl number 4 where it resets to zero. The background to the dynamic
field is black and I want it to appear empty until the 'Q' button is pressed so
I added an additional script to change the text from alpha = 0 to alpha = 100
upon depressing the "Q" key.

My script is working for everything except the transparent to non-transparent
feature.

Is this possible to do?

Thank you!!!!!!!!!!!!!!!!!
-Janette

Re: change transparent text to opaque janst
11/17/2004 6:26:31 PM
Oh!

This is the script right now:

keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(81)) {
h_q.text = Number(h_q.text)+1;
h_q.color = "FFFFFF";
if ((Number(h_q.text)+1)>19) {
h_q.text = 0;
}
}
};
Key.addListener(keyListener);

Re: change transparent text to opaque janst
11/17/2004 6:37:04 PM
Re: change transparent text to opaque jthereliable
11/18/2004 2:02:41 AM
i would do it like this, though it may not be the best way, it may work:

keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(81)) {
h_q.text = Number(h_q.text)+1;
h_q.color = "FFFFFF";
if ((Number(h_q.text)+1)>19) {
h_q.text = 0;
h_q.alpha = 0
} else (
if(h_q.alpha<100)
{
h_q.alpha+=1 // or an amount
}
}
};
Key.addListener(keyListener);
Re: change transparent text to opaque jthereliable
11/18/2004 2:08:09 AM
another way to this is to make frames, like frame 1 to frame 20, each with a
different opacity, and then 21 to 40, the backwars of frame 1 to 20. Being 20
and 21 is the opaquest (don't know if this word exist). On Frame 20, put the
Code 1;. On Frame 1, put the Code 2 from below. This should make it so that if
the key is pressed, the frame moves from 20 to 40, then back to 1. When the key
is off, it plays from 1 to 20 and stops. I rather use this than the other code
i suggested.

// Code 1:

stop();
if(Key.isDown(81))
{
play();
}

_______________________
// Code 2

stop();
stop();
if(!(Key.isDown(81)))
{
play();
}
Re: change transparent text to opaque janst
11/18/2004 2:49:02 AM
Hi,

Thanks for responding. My brain is thoroughly fried for the evening. ...been
working on this stuff all day... I did get a laugh out of the "opaquest"...
I will try your suggestions tomorrow morning and let you know.

THANKS!
Re: change transparent text to opaque janst
11/18/2004 2:04:26 PM
Hi,

So I'm back and I tried your code and it didn't work for me. I really don't
want a fade at all. I simply want to have the text in the dynamic textfield to
be transparent upon loading and turn alpha 100% when a key is pressed. The fade
would be nice in other applications but not appropriate for this one.
I'm trying the _visible command right now. Flash seems to be ignoring the
alpha command for my dynamic textfields.
T
Thank you for your resonse!
I REALLY appreciate it!

-Janette

Re: change transparent text to opaque janst
11/18/2004 2:10:40 PM
Re: change transparent text to opaque janst
11/18/2004 2:11:54 PM
keyListener = new Object();
keyListener.onKeyDown = function() {
h_q.text.visible = false;
if (Key.isDown(81))
h_q.text = Number(h_q.text)+1;
if ((Number(h_q.text)+1)>19) {
h_q.text = 0;
if (h_q.text.visible = false) {
h_q.text.visible = true;
}
}
};
Key.addListener(keyListener);

above is the code that I used...
Re: change transparent text to opaque janst
11/18/2004 2:22:50 PM
Okay, so I realized that I need to have the field not visible upon loading the
scene as opposed to within the keypress command... so I tried putting the
h_q.text.visible = false code st the top of the actionscript frame :
onEnterframe = function() {
h_q.text.visible = false;
}

THIS DIDN'T WORK!!!!!!!!!!!!!!!!!

AUGGGGGGGGGGGGGGHHHHHHHHHH!!!!!!!!!!!!!!!!!!
Re: change transparent text to opaque jthereliable
11/18/2004 8:32:56 PM
I see the problems already, check the codes. Also, the _visible is for the
name, not the dynamic text... I don't know how to explain this... Hmm... You
know when you change it from Static to Dynamic to Input, under there (instance
name), insert the name there, not where it says Var: [ ], the Var: [
] is for changing the text. Reasons you made a mistake: Reason #1-
it is _visible, not just visible, sorry if there was a confusion in what I said
before. Reason #2- you opened the If tag but didn't close it, I found 2 of
them not closed.

keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(81))
{
h_q.text = Number(h_q.text)+1;
if ((Number(h_q.text)+1)>19) {
h_q.text = 0;
}
if (h_q.text.visible = false) {
h_q.text.visible = true;
} else {
h_q.text._visible = false;
}
}
};
Key.addListener(keyListener);
Re: change transparent text to opaque janst
11/18/2004 9:16:58 PM
I was so excited when I saw your response but, alas, when I try it... it doesn't work. The textfield is always visible...

Re: change transparent text to opaque jthereliable
11/18/2004 9:39:53 PM
I'm
sooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooo sorry for making you wait that long. This
one is gurenteed to work... I'm working on it now..
Re: change transparent text to opaque jthereliable
11/18/2004 9:43:53 PM
Here, I'm sure this works, put this code in the frame. h_q is a number right?
If not, you can work around this... When you select the h_q text, at the
'<Instance Name>', fill in h_qInstance

_root.h_q=0

keyListener = new Object();
keyListener.onKeyUp = function() {
_root.h_qInstance._visible = true;
}
keyListener.onKeyDown = function() {
if (Key.isDown(81)) {
_root.h_q += 1
if ((_root.h_q)>=20){
_root.h_q = 0;
}
_root.h_qInstance._visible = false;
}
}
Key.addListener(keyListener);
Re: change transparent text to opaque jthereliable
11/18/2004 9:44:28 PM
Re: change transparent text to opaque NSurveyor
11/18/2004 10:02:26 PM
Here is all you need:

//If you only want the textbox invisible at start and visible on keypress 'q',
then use this script:
//USE THE CODE BELOW
h_q._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(81)) {
h_q.text = Number(h_q.text)+1;
h_q._visible = true;
if ((Number(h_q.text)+1)>19) {
h_q.text = 0;
}
}
};
Key.addListener(keyListener);
//END CODE
//If you want to have the textbox become invisible at the beginning or when q
= 0:
//USE THE CODE BELOW
h_q._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(81)) {
h_q.text = Number(h_q.text)+1;
h_q._visible = true;
if ((Number(h_q.text)+1)>19) {
h_q.text = 0;
h_q._visible = false;
}
}
};
Key.addListener(keyListener);
//END CODE
Re: change transparent text to opaque janst
11/18/2004 10:11:45 PM
WWWWOWWWWWWW!!!!!!!!!!!!!

//If you only want the textbox invisible at start and visible on keypress 'q',
then use this script:
//USE THE CODE BELOW
h_q._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(81)) {
h_q.text = Number(h_q.text)+1;
h_q._visible = true;
if ((Number(h_q.text)+1)>19) {
h_q.text = 0;
}
}
};
Key.addListener(keyListener);

This did the trick!

This looks very similar to what I used earlier. I am going to see what is
different... maybe I did some basic language thingy incorrectly...

THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

:)
Re: change transparent text to opaque NSurveyor
11/18/2004 10:12:09 PM
jthereliable, I have just a few comments about the errors in your script: h_q
is the instance name of the textbox Puting _root.h_qInstance._visible = false;
after the if statement, will make the textbox not visible while the mouse is
down Your onKeyUp event handler will make the visiblity of the textbox visible,
when the 'Q' is released. Your script does not make the textbox not visible
when 'Q' is never pressed
Re: change transparent text to opaque NSurveyor
11/18/2004 10:13:46 PM
Re: change transparent text to opaque janst
11/19/2004 2:34:03 PM
Hey!

So, my baseball scoreboard has innings that start blank and are filled upon a
keypress. It works great!
However, when I try to have the sum of these dynamic textfields appear in the
total_runs field, the total_runs field gets filled with the word Nan...
I have tried integrating 'Number' with the addition but I receive errors... I
have followed what I have found in Derek Franklin's book but his addition
sample doesn't really apply verbatim...
This is the code that I used for the test of the scoreboard:

Key.addListener(keyListener);
v_1._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(81)) {
v_1.text = Number(v_1.text)+1;
v_1._visible = true;
if ((Number(v_1.text)+1)>19) {
v_1.text = 0;
}
}
};
Key.addListener(keyListener);

h_1._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(65)) {
h_1.text = Number(h_1.text)+1;
h_1._visible = true;
if ((Number(h_1.text)+1)>19) {
h_1.text = 0;
}
}
};
Key.addListener(keyListener);
v_2._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(87)) {
v_2.text = Number(v_2.text)+1;
v_2._visible = true;
if ((Number(v_2.text)+1)>19) {
v_2.text = 0;
}
}
};
Key.addListener(keyListener);
Inning_v1.text =(Number(v_1.text)+1)
Inning_v2.text =(Number(v_2.text)+1)
total_runs.text = Inning_v1.text + Inning_v2.text;


(All of the above named fields refer to corresponding dynamic textfields)
Re: change transparent text to opaque janst
11/19/2004 2:42:41 PM
sorry, I see I was being really dumb! I repeated the listener function instead of defining just a plain function...

I'm trying it again with function addScore () {

Re: change transparent text to opaque NSurveyor
11/19/2004 2:46:47 PM
total_runs.text = Number(Inning_v1.text) + Number(Inning_v2.text); And you
may want to put this in a function that is updated constantly. I also fixed
your script:

//Try this code:
Key.addListener(keyListener);
v_1._visible = false;
h_1._visible = false;
v_2._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
updateScoreBoard();
if (Key.isDown(81)) {
v_1.text = Number(v_1.text)+1;
v_1._visible = true;
if ((Number(v_1.text)+1)>19) {
v_1.text = 0;
}
} else if (Key.isDown(65)) {
h_1.text = Number(h_1.text)+1;
h_1._visible = true;
if ((Number(h_1.text)+1)>19) {
h_1.text = 0;
}
} else if (Key.isDown(87)) {
v_2.text = Number(v_2.text)+1;
v_2._visible = true;
if ((Number(v_2.text)+1)>19) {
v_2.text = 0;
}
}
};
Key.addListener(keyListener);
function updateScoreBoard() {
Inning_v1.text = (Number(v_1.text)+1);
Inning_v2.text = (Number(v_2.text)+1);
total_runs.text = Inning_v1.text+Inning_v2.text;
}
Re: change transparent text to opaque NSurveyor
11/19/2004 2:55:34 PM
Before you wrote your last post, I started writing this one. That's why I said:
And you may want to put this in a function that is updated constantly after you
had already said: I'm trying it again with function addScore () {
Re: change transparent text to opaque janst
11/19/2004 3:27:00 PM
Okay,

So I have tried a number of different approaches... I always received a 0
answer so I decided that the runs would show up upon pressing 'Enter' and I'm
now not even effecting the field at all even though I have no script errors
coming at me.

(Sample:
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.HOME)) {
k_ball.text = Number(k_ball.text)+1;
if ((Number(k_ball.text)+1)>4) {
k_ball.text = 0;
}
}
};
Key.addListener(keyListener);
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.END)) {
k_outs.text = Number(k_outs.text)+1;
if ((Number(k_outs.text)+1)>3) {
k_outs.text = 0;
}
}
};
Key.addListener(keyListener);
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.LEFT)) {
k_strike.text = Number(k_strike.text)+1;
if ((Number(k_strike.text)+1)>3) {
k_strike.text = 0;
}
}
};
Key.addListener(keyListener);
v_1._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(81)) {
v_1.text = Number(v_1.text)+1;
v_1._visible = true;
if ((Number(v_1.text)+1)>19) {
v_1.text = 0;
}
}
};
Key.addListener(keyListener);

h_1._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(65)) {
h_1.text = Number(h_1.text)+1;
h_1._visible = true;
if ((Number(h_1.text)+1)>19) {
h_1.text = 0;
}
}
};
Key.addListener(keyListener);
v_2._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(87)) {
v_2.text = Number(v_2.text)+1;
v_2._visible = true;
if ((Number(v_2.text)+1)>19) {
v_2.text = 0;
}
}
};
Key.addListener(keyListener);
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.ENTER)) {
total_vruns.text = (Number(v_1.text)+1) + (Number(v_2.text)+1);
}
};
Key.addListener(keyListener);
)

TextTextHowever, I have decided that I would rather have the total field
change everytime the innings fields change.

I wrote this:

Key.addListener(keyListener);
function addScore () {
var Inning_v1:Number =(Number(v_1.text)+1)
var Inning_v2:Number =(Number(v_2.text)+1)
total_vruns.text = Inning_v1 + Inning_v2;
}

but I don't know how to make this be triggered...
I tried putting it within the keypress info for the inning fields' keypresses
but failed...

Is that where this information should go so that it updates?

THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!
Re: change transparent text to opaque janst
11/19/2004 3:29:24 PM
woops!
I missed your response above...

I'm trying that now!

Re: change transparent text to opaque janst
11/19/2004 3:38:06 PM
Okay,

I tried using your code and it's not working for me... I have a zero in the
dynamic textfield "total_vruns" (I renamed "total_runs" to "total v_runs"
because I also have to have a "total_hruns" for the home team...)
The "total_vruns" is remaining at 0)...

any suggestions?

THANKS
:)
Re: change transparent text to opaque janst
11/19/2004 3:47:43 PM
I tried putting the addition in the keypresses but that didn't work...

Key.addListener(keyListener);
v_1._visible = false;
h_1._visible = false;
v_2._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
updateScoreBoard();
if (Key.isDown(81)) {
v_1.text = Number(v_1.text)+1;
v_1._visible = true;
if ((Number(v_1.text)+1)>19) {
v_1.text = 0;
total_vruns.text = (Number(v_1.text)+1)
}
} else if (Key.isDown(65)) {
h_1.text = Number(h_1.text)+1;
h_1._visible = true;
if ((Number(h_1.text)+1)>19) {
h_1.text = 0;

}
} else if (Key.isDown(87)) {
v_2.text = Number(v_2.text)+1;
v_2._visible = true;
if ((Number(v_2.text)+1)>19) {
v_2.text = 0;
total_vruns.text = (Number(v_1.text)+1) + (Number(h_1.text)+1)
}
}
};
Key.addListener(keyListener);

does v_1._visible = false;
h_1._visible = false;
v_2._visible = false;

need to be within a listener? or can it just be called on top?


Re: change transparent text to opaque NSurveyor
11/19/2004 3:49:30 PM
I just tested the code and it worked. Make sure you changed the function
completely and that the instance names for the textboxes are correct: function
updateScoreBoard() { Inning_v1.text = (Number(v_1.text)+1);
Inning_v2.text = (Number(v_2.text)+1); total_vruns.text =
Number(Inning_v1.text) + Number(Inning_v2.text); }
Re: change transparent text to opaque janst
11/19/2004 4:02:42 PM
Hi,

I used your code:

Key.addListener(keyListener);
v_1._visible = false;
h_1._visible = false;
v_2._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
updateScoreBoard();
if (Key.isDown(81)) {
v_1.text = Number(v_1.text)+1;
v_1._visible = true;
if ((Number(v_1.text)+1)>19) {
v_1.text = 0;
}
} else if (Key.isDown(65)) {
h_1.text = Number(h_1.text)+1;
h_1._visible = true;
if ((Number(h_1.text)+1)>19) {
h_1.text = 0;
}
} else if (Key.isDown(87)) {
v_2.text = Number(v_2.text)+1;
v_2._visible = true;
if ((Number(v_2.text)+1)>19) {
v_2.text = 0;
}
}
};
Key.addListener(keyListener);
function updateScoreBoard() {
Inning_v1.text = (Number(v_1.text)+1);
Inning_v2.text = (Number(v_2.text)+1);
total_vruns.text = Number(Inning_v1.text) + Number(Inning_v2.text);
}

I changed the "total_runs.text" to "total_vruns.text" since I changed my
dynamic textfield to totalvruns...

I received "Nan" in the total_vruns field...

Also, the code that I had written above was adding the numbers but it was
coming up with 1 when the q key was pressed once and putting 22 in the total
field when the w key was pressed once...

I am lost...

:)

Re: change transparent text to opaque janst
11/19/2004 4:05:55 PM
When I say that I wrote above, I mean this:
Key.addListener(keyListener);
v_1._visible = false;
h_1._visible = false;
v_2._visible = false;
keyListener = new Object();
keyListener.onKeyDown = function() {
updateScoreBoard();
if (Key.isDown(81)) {
v_1.text = Number(v_1.text)+1;
v_1._visible = true;
if ((Number(v_1.text)+1)>19) {
v_1.text = 0;
total_vruns.text = (Number(v_1.text)+1)
}
} else if (Key.isDown(65)) {
h_1.text = Number(h_1.text)+1;
h_1._visible = true;
if ((Number(h_1.text)+1)>19) {
h_1.text = 0;

}
} else if (Key.isDown(87)) {
v_2.text = Number(v_2.text)+1;
v_2._visible = true;
if ((Number(v_2.text)+1)>19) {
v_2.text = 0;
total_vruns.text = (Number(v_1.text)+1) + (Number(h_1.text)+1)
}
}
};
Key.addListener(keyListener);

Re: change transparent text to opaque janst
11/19/2004 4:21:19 PM
Hi,

I just created a test in a totally new flash file using the actionScript that
you provided and I am still receiving Nan in the total textfield...

:(

I made all textfields dynamic and I placed a "0" in each textfield...

v_1
v_2
h_1
total_vruns

I changed the total_runs in your code to total_vruns since that is what I
named that field...
Re: change transparent text to opaque NSurveyor
11/19/2004 5:11:41 PM
Did you make sure you had the Inning_v1 and Inning_v2 textboxes? BTW, I just
finished making a scoreboard in the past half an hour. Is this what you want
your one to look like?
VIEWhttp://www.geocities.com/saif7463/Sample_scoreboard.html
Re: change transparent text to opaque janst
11/19/2004 5:17:05 PM
WOW!!!!!!!!!!!!!

You are the best!!!!!!!!!!!

That is exactly what I'm trying to do!

I'm looking over my textfield names...
Re: change transparent text to opaque janst
11/19/2004 5:22:09 PM
Re: change transparent text to opaque NSurveyor
11/19/2004 5:22:58 PM
This is basically what I did: First I made all the home textboxes (h_1 to h_10)
and visitors (v_1 to v_10). Then, in the properties panel, I made all of them
show their border around the text. Next, I made the two total score boxes,
(totalh, and totalv). Then all the rest is actionscript:

currentTextbox = next();
Key.addListener(keyListener);
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(KEY.UP)) {
_root[currentTextbox].text = Number(_root[currentTextbox].text)+1
}else if(Key.isDown(KEY.DOWN)){
if(Number(_root[currentTextbox].text) > 0){
_root[currentTextbox].text = Number(_root[currentTextbox].text)-1
}
}else if(Key.isDown(KEY.RIGHT)){
currentTextbox = next();
}else if(Key.isDown(KEY.LEFT)){
currentTextbox = previous();
}
totalh = totaller("h");
totalv = totaller("v");
};
Key.addListener(keyListener);
function next() {
pteam = team+"_"+String(inning);
_root[pteam].backgroundColor = "0xFFFFFF";
_root[pteam].textColor = "0x000000";
if(team == undefined){
team = "v";
inning = 1;
}else if (team == "h" and inning<10) {
team = "v";
inning++;
}else if(team == "v"){
team = "h";
}
_root[team+"_"+String(inning)].backgroundColor = "0xFFB0B0";
if(_root[team+"_"+String(inning)].text == ""){
_root[team+"_"+String(inning)].text = 0;
}
return team+"_"+String(inning);
};
function previous() {
_root[team+"_"+String(inning)].backgroundColor = "0xFFFFFF";
_root[team+"_"+String(inning)].textColor = "0x000000";
if (team == "v" and inning > 1) {
team = "h";
inning--;
}else if(team == "h"){
team = "v";
}
_root[team+"_"+String(inning)].backgroundColor = "0xFFB0B0";
return team+"_"+String(inning);
};
function totaller(horv){
total = 0;
for(icount = 1;icount<=10;icount++){
if(isNaN(Number(_root[String(horv)+"_"+String(icount)].text))==false){
total+=Number(_root[String(horv)+"_"+String(icount)].text)
}
}
return total;
};
Re: change transparent text to opaque NSurveyor
11/19/2004 5:23:59 PM
Re: change transparent text to opaque janst
11/19/2004 5:30:38 PM
I'm blown away...

Re: change transparent text to opaque NSurveyor
11/19/2004 5:33:40 PM
Re: change transparent text to opaque janst
11/19/2004 6:12:42 PM
Hi,

I have pur your code into place and I have a question...

I'm not getting any response in my total runs fields. Can you tell me everything about those fields' qualities?

Re: change transparent text to opaque NSurveyor
11/19/2004 6:17:49 PM
Re: change transparent text to opaque janst
11/20/2004 1:29:03 AM
Hi,

Thank you very much for your help.

I am not able to set my dynamic textfields for the total sum of the v and h
innings...

I don't understand your comment:
"Oh sorry. The textboxes intance names are not totalh and totalv. Those are
the variables that are associated with each of the textboxes in the properties
panel for each of the textboxes. "

Please elaborate...

Thank you!
Re: change transparent text to opaque NSurveyor
11/20/2004 1:39:50 AM
Ok. So both of the textboxes do not need instance names. Select the textbox
that should display the home teams runs, and open the properties panel. Look at
the part with Var: (to the left of the 'Character' button) . Type in totalh. Do
the same thing with the other textbot, but make the variable, totalv.
Re: change transparent text to opaque janst
11/20/2004 1:51:34 AM
Hi,

Okay, I tried that and I still am not getting a response in those fields...

Is all of the code copied into the forum? Is something missing maybe?

Re: change transparent text to opaque janst
11/20/2004 1:59:21 AM
IT'S
WORKING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!


YAYYYYYYYYYYYYYYYYYYYYYYYYYYYY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!

THANK
YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!

:)
Re: change transparent text to opaque NSurveyor
11/20/2004 2:01:34 AM
Ok try this. Have totalh and totalv as the instance names of two of the
textboxes. Now use this code:

currentTextbox = next();
Key.addListener(keyListener);
keyListener = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(KEY.UP)) {
_root[currentTextbox].text = Number(_root[currentTextbox].text)+1
}else if(Key.isDown(KEY.DOWN)){
if(Number(_root[currentTextbox].text) > 0){
_root[currentTextbox].text = Number(_root[currentTextbox].text)-1
}
}else if(Key.isDown(KEY.RIGHT)){
currentTextbox = next();
}else if(Key.isDown(KEY.LEFT)){
currentTextbox = previous();
}
totalh.text = totaller("h");
totalv.text = totaller("v");
};
Key.addListener(keyListener);
function next() {
pteam = team+"_"+String(inning);
_root[pteam].backgroundColor = "0xFFFFFF";
_root[pteam].textColor = "0x000000";
if(team == undefined){
team = "v";
inning = 1;
}else if (team == "h" and inning<10) {
team = "v";
inning++;
}else if(team == "v"){
team = "h";
}
_root[team+"_"+String(inning)].backgroundColor = "0xFFB0B0";
if(_root[team+"_"+String(inning)].text == ""){
_root[team+"_"+String(inning)].text = 0;
}
return team+"_"+String(inning);
};
function previous() {
_root[team+"_"+String(inning)].backgroundColor = "0xFFFFFF";
_root[team+"_"+String(inning)].textColor = "0x000000";
if (team == "v" and inning > 1) {
team = "h";
inning--;
}else if(team == "h"){
team = "v";
}
_root[team+"_"+String(inning)].backgroundColor = "0xFFB0B0";
return team+"_"+String(inning);
};
function totaller(horv){
total = 0;
for(icount = 1;icount<=10;icount++){
if(isNaN(Number(_root[String(horv)+"_"+String(icount)].text))==false){
total+=Number(_root[String(horv)+"_"+String(icount)].text)
}
}
return total;
};
Re: change transparent text to opaque NSurveyor
11/20/2004 2:19:46 AM
AddThis Social Bookmark Button