PDA

View Full Version : Dynamic text field variables



onemhunki
September 11th, 2005, 10:25 AM
Folks,

I have a movie where a variable named daysleft will be loaded from an external text file into a dynamic text box, this bit works fine.

But I then need the movieclip "numbers" to gotoAndStop to the frame number imported via the variable daysleft. Although daysleft displays on the screen a trace(daysleft); says the variable is undefined.

Any idea how I can acheive what I'm trying to do.

Cheers all.

Phlashman
September 11th, 2005, 10:40 AM
simply do this:

numbers.gotoAndStop(Number(daysleft));

onemhunki
September 11th, 2005, 10:59 AM
Cheers for the speedy reply Phlasman,

It doesn't seem to work however, the thing that concerns me is a trace(daysleft); still says undefined although a number is showing in the dynamic text box.

kdd
September 11th, 2005, 12:55 PM
give dynamic textbox an instance name, let's say you gave "days"
so:


daysLeft = int(days.text);
numbers.gotoAndStop(daysleft);

onemhunki
September 13th, 2005, 06:18 AM
Interesting...well i'm the closest I've been so far to getting this to work. Using your code the movieclip numbers is moving to a frame, but the wrong one, currently the variable daysleft is 21 and the movie is going to frame 31, and a test text field that I'm using to check the variable is displaying -2147483648.

onClipEvent(data) {
trace(daysleft)
daysleft = int(days.text);
this.gotoAndStop(daysleft);
}

Any ideas?