Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Nov 2004
    Location
    Perth, UK
    Posts
    105
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Needing help with Actionscript

    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

    Code:
    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.
    Geodesic_D
    "I'd much rather be called GeodesicDragon."

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Hmm I have a feeling that frameno.value is a string. gotoAndStop requires that you feed it a number. Try this
    Code:
    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
    Code:
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Nov 2004
    Location
    Perth, UK
    Posts
    105
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Nope, that never worked.

    Is it even possible, what I want to do?
    Geodesic_D
    "I'd much rather be called GeodesicDragon."

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Regular Coder
    Join Date
    Nov 2004
    Location
    Perth, UK
    Posts
    105
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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!
    Last edited by Geodesic_D; 12-29-2006 at 02:00 AM.
    Geodesic_D
    "I'd much rather be called GeodesicDragon."

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    Code:
    on(release)
    {
    	gotoAndStop(frameno.text);
    }
    Last edited by _Aerospace_Eng_; 12-28-2006 at 06:53 AM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    Regular Coder
    Join Date
    Nov 2004
    Location
    Perth, UK
    Posts
    105
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Yeah, that worked. Thanks!
    Geodesic_D
    "I'd much rather be called GeodesicDragon."


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •