| You are here: DEVPPL ‹ Forum ‹ Programming ‹ Flash Forum |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
Rewriting a statement that works!
2 posts
• Page 1 of 1
0
Rewriting a statement that works!
Hello all,
When I try to use the following code in Flash I get an error:
_root.("textfield"+textfieldcount).text = currenttext+newtext;
What I'm trying to do essentially is target the textfield called "textfield1" (where the number on the end is the variable "textfieldcount") and add more text to the end of whats already there.
I attempted to make the ("textfield"+textfieldcount) a variable, but instead of targeting the actual textfield with that instance name to perform the function on, Flash attempts to target the variable itself and not the textfield, resulting in nothing happening. If i simply replace ("textfield"+textfieldcount) with "textfield1" it works fine, but that doesnt help later when the textfieldcount variable is increased to 2 and beyond.
Is there a way I can structure the above statement to function how it is meant to?
Many thanks, Mj
When I try to use the following code in Flash I get an error:
_root.("textfield"+textfieldcount).text = currenttext+newtext;
What I'm trying to do essentially is target the textfield called "textfield1" (where the number on the end is the variable "textfieldcount") and add more text to the end of whats already there.
I attempted to make the ("textfield"+textfieldcount) a variable, but instead of targeting the actual textfield with that instance name to perform the function on, Flash attempts to target the variable itself and not the textfield, resulting in nothing happening. If i simply replace ("textfield"+textfieldcount) with "textfield1" it works fine, but that doesnt help later when the textfieldcount variable is increased to 2 and beyond.
Is there a way I can structure the above statement to function how it is meant to?
Many thanks, Mj
- Mjhood
- Reputation: 0
- Posts: 2
- Joined: Fri Jan 05, 2007 12:41 am
- Highscores: 0
- Arcade winning challenges: 0
0
- Code: Select all
var mc = orderform['l'+n];
mc.qty = cart[n].qty;
that is a code used in a paypal cart system... I can't figure out where the orderform array is declared though, so I don't think that will help you much
Umm, couldn't you just have each dynamic text box have a variable set in the "Var:" field?
- Tkgd
- Reputation: 0
- Posts: 103
- Joined: Thu Nov 15, 2007 11:46 pm
- Highscores: 0
- Arcade winning challenges: 0
|
|