PDA

View Full Version : Making things show in a dynamic text field.


reason808
02-26-2011, 04:03 AM
I thought this would be simple, but . . . I've just spent an hour searching the help files and web for a simple demonstration or code example.

All I want to do is put the frame number into a dynamic text field. This is a simple self-test file. I'd like to know how to use actionscript to put other things in a text field, too.

Can anybody point me to a tutorial or instructions that show how to do this?
It's frustrating that something so simple and common doesn't have an example to work from.

I've attached a .fla file of what I'm trying to do.

tango88
03-03-2011, 02:46 PM
Define a variable to track the frame number.
Update this number when a button is pressed.
Update the textfield when a button is pressed.


Like this:


var framNo:int=1;FrameBox.text=framNo.toString();

// This code controls the timeline

stop();

// This code controls the buttons

nextBtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
function mouseDownHandler1(event:MouseEvent):void {
framNo++;FrameBox.text=framNo.toString();
nextFrame();
}

prevBtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler2);
function mouseDownHandler2(event:MouseEvent):void {
framNo--;FrameBox.text=framNo.toString();
prevFrame();
}

FEK315
03-04-2011, 05:21 AM
hey Tango are all these flash games at
www.flashbynight.com yours?