Skip to main content
Participant
June 22, 2010
Question

Timer counter and Text Input

  • June 22, 2010
  • 1 reply
  • 648 views

Hi there,

I'd like some pointers on how to accomplish something in my application

I want to have a text input field where someone can input their name, for example. Then they would click a submit button and a small shape (probably a rectangle) would appear at the bottom of the screen with their name and a timer counting the elapsed time since the shape was placed on the stage.

I would like to be able to do this numerous times, with each click of the submit creating a new shape with the new name and an individual timer in each rectangle.

Can someone give me some insight how to accomplish this? I think I can write the code for the timer myself, if that helps!

Thanks a million!!

This topic has been closed for replies.

1 reply

markerline
Inspiring
June 22, 2010

If you can write the code for the Timer event you can just tie the timer event to the addChild function.  You can use a "for" loop to iterate the addChild function to create multiple children on the stage each time the timer reaches a certain number in milliseconds.  You can also use this for loop to removeChild for the movie clip you wish to change away from.

Participant
June 23, 2010

Thank you so much for the quick reply.

One thing - I don't want to craete a new child on the stage at certain time intervals. I want to add a icon (for lack of a better term) that contains a name (from the text input field) and a count up timer (counting time in minutes) whenever a user enters a name in the text field and clicks the submit button.

I wrote the timer function using the getTimer() script.

Sorry for the misunderstanding.

Thanks again for the help!!

markerline
Inspiring
June 23, 2010

I don't know much about AS3.0 admittedly, but in my resources I have discovered that adding a text field is done by creating the text field using new TextField() and then adding the child of that text field variable.  So you would still be using addChild().  If it is an icon with anything else besides just the text field you would contain all of the graphics including that text field in a movie clip which in Action Script 3 is done by creating a new movie clip variable and then using addChild().  In AS2.0 you didn't need to use the addChild method.  You could simply use the "Export for Action Script" instance name that you gave the movie clip in Flash.  Either way, AS2 or AS3 you're talking about using a movie clip.  In AS3 there are also things called Sprites but again, I know little about AS 3.0 .