View Full Version : Dynamic text field for names
haznut
06-08-2010, 11:40 AM
Hello!
Iīm doing a simple flash with 3 frames. First frame ask for your name. The second one is a mini drawing board..and the third one is an exit message.
What i need to do and canīt find out how, is to set a field on the first frame so the user can type in his/her name, and then appear on frame 3 on the exit message.
Any help would be very appreciated.
Thanx a lot for your time.
franky87
06-08-2010, 12:49 PM
For the first frame, you can use an inputfield.
In your code, you have a variable that holds the information from frame 1 and display it on frame 3 in an dynamic TextField.
haznut
06-08-2010, 02:10 PM
Thanx a lot for your reply.
I understand the escense of what you said, but i need some directions so i can apply it...like code or some guides?
Thanx again.
franky87
06-08-2010, 07:39 PM
If you on your first frame have a input TextField with the instance name
nameInp and on the third frame have a dynamic TextField named nameDyn. Also have some sort of button to go to the next frame, named nextBtn
Make a as-file named Main.as
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip
{
private var myName:String = ""; //Will hold the inputname
public function Main()
{
gotoAndStop(1);
nextBtn.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(mouse:MouseEvent):void
{
myName = nameInp.text;
gotoAndStop(2);
}
}
}
When you come to frame 3, you add this code
name_dynamic.text = myName;
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.