...

View Full Version : Needing help with Actionscript



Geodesic_D
12-26-2006, 06:13 PM
I've put together an image slideshow in Flash, and I want to give users the ability to skip to any frame they desire.

I have an input text on the frame called 'frameno' - this is where the user enters what frame they want to go to. Then, they click a button, and are taken to the specified frame.

The AS on the button is



on (release)
{
var frame = frameno.value;
gotoAndStop(frame);
}


But whenever I enter a number in 'frameno' and press the button, nothing happens. What am I doing wrong?

Also, I would like to give some sort of warning if the user were to enter a number higher than the number of frames in the slideshow.

Many thanks. :thumbsup:

_Aerospace_Eng_
12-26-2006, 07:19 PM
Hmm I have a feeling that frameno.value is a string. gotoAndStop requires that you feed it a number. Try this

on (release)
{
var frame:Number = parseInt(frameno.value);
gotoAndStop(frame);
}
As for checking to see if the number is higher than number of frames you can do something like this

on (release)
{
var frame:Number = parseInt(frameno.value);
if(frame <= numberOfFrames)
{
gotoAndStop(frame);
}
else
{
error.text = 'The number you entered is more than the number of total frames, please enter a different number not greater than' + numberOfFrames;
}
}
where error is the instance name of a dynamic text box.

Geodesic_D
12-27-2006, 01:23 AM
Nope, that never worked.

Is it even possible, what I want to do?

_Aerospace_Eng_
12-27-2006, 01:34 AM
Yeah but you've given us very little info. I have no idea where frameno.value is coming from. Attach your .fla file. Help us help you. We aren't psychic you know.

Geodesic_D
12-27-2006, 09:55 PM
I can't attach it - it's a 7.51MB file, so even if I were to zip it, it would still exceed the 50KB filesize limit.

Instead, I have uploaded it to my web server.

*LINK INVALID*

Don't worry - it hasn't got anything nasty attached!

_Aerospace_Eng_
12-28-2006, 06:50 AM
Hmm frame is coming back as undefined. If you do trace(frame) you get undefined. I'm not sure why though however this works ok.

on(release)
{
gotoAndStop(frameno.text);
}

Geodesic_D
12-29-2006, 01:59 AM
Yeah, that worked. Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum