PDA

View Full Version : ** Lots of dynamic text on the fly **



The_Vulcan
August 21st, 2003, 04:11 AM
How would one go about this ?

say you have a number of input text fields. and ppl feed their orders in.

big mac = 5
mc chicken = 2
lg coke = 0
fillet of fish = 0
cookies = 0
sunday = 2

then once they are done it shows thier order..... without all the menu items.

big mac = 5
mc chicken = 2
sunday = 2

To do this I was going to attempt to have an if statement for each item.

if there was an item ordered a dynamic text box would be created at _x _y...... then add 10 to _x. (to move the next one down the stage)

if there was no item ordered a dynamic text box would not created.

then the next item would be created further down the page as _x was increased with the last menu item created.


So is this the only way to go about creating this, or is there a better way ?

Voetsjoeba
August 21st, 2003, 04:14 AM
Since you already have an idea on how to do it with the _x and _y, here's a tutorial you can use for displaying the orders:

http://www.kirupa.com/developer/flash5/displayingtextfield.htm

The_Vulcan
August 21st, 2003, 04:49 AM
Thanks for that...

I have that tute saved to my drive already....

I was gonna try something like this when I get a chance. { thanx Kax }
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=31224




x_position = 0;

if(big mac != 0){

// create TextFields(label | ? | Y | x_position | length | height )
this.createTextField("big mac", 0, 0,x_position , 80, 16);
// set text format
big mac.setNewTextFormat(new TextFormat("Verdana", 10));
// set TextField type to input
big mac.type = "dynamic";
// admit characters only from 0 to 9 and .
big mac.restrict = "0-9.";
// show TextField border
big mac.border = true;
// call function
big mac.onChanged = addition;

x_position = x_position + 10;
}



oh, and what is the ? section in the
TextFields(label | ? | Y | X | length | height )

claudio
August 21st, 2003, 09:48 AM
Depth
:)

The_Vulcan
August 21st, 2003, 02:35 PM
sweet....

in Kax's example he sets up each new text field on a new layer.

is there any reason for that ?

claudio
August 21st, 2003, 02:45 PM
You mean depth right?
He sets each textfield on an unique depth level otherwise the second will replace the first one.
this.createTextField("a_txt", 0, 0, 0, 80, 16);
this.createTextField("b_txt", 0, 100, 0, 80, 16);//"b_txt" will replace "a_txt" since im creating both on same depth level

The_Vulcan
August 22nd, 2003, 02:42 AM
All is clear now..... thanx claudio

claudio
August 22nd, 2003, 10:40 AM
welcome :thumb: