How do I get the Interval to keep from repeating after it's used once?

How do I get the Interval to keep from repeating after it's used once? Because I tried clearInterval but I couldn't get it working.
When my code looks like this, with ClearInterval, it refuses to execute my action, which is to change scenes after a short interval:
(Pardon if there is some formating errors, I had to reformat it for the Internet)
Code with clearInterval command
stop(); 
Kollektiv.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void{
   gotoAndPlay(29);   
   var myInterval:uint = setInterval(fl_ClickToGoToNextScene_14,3000);   
   clearInterval(myInterval);
function fl_ClickToGoToScene_14(event:MouseEvent):void{
    MovieClip(this.root).gotoAndPlay(1, "Testside");
However, when my code looks like this it refuses to stop looping:
Code without ClearInterval command
stop();
Kollektiv.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
   function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void{
   gotoAndPlay(29);
   setInterval(fl_ClickToGoToNextScene_14,3000);
function fl_ClickToGoToScene_14(event:MouseEvent):void{
    MovieClip(this.root).gotoAndPlay(1, "Testside");
Any ideas? Also, feel free to dumb your answer down, because I am completely new to Flash, Actionscript and coding.

If you insist on using setInterval - you need to declare interval id in a higher scope so that you can clear it later:
stop();
var myInterval:uint;
Kollektiv.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void
          gotoAndPlay(29);
          myInterval = setInterval(fl_ClickToGoToNextScene_14, 3000);
function fl_ClickToGoToScene_14():void
          clearInterval(myInterval);
          MovieClip(this.root).gotoAndPlay(1, "Testside");
I suggest you use Timer instead:
stop();
import flash.events.TimerEvent;
import flash.utils.Timer;
var timer:Timer = new Timer(3000, 1);
timer.addEventListener(TimerEvent.TIMER, fl_ClickToGoToScene_14);
function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void
          timer.start();
          gotoAndPlay(29);
function fl_ClickToGoToScene_14(event:TimerEvent):void
          timer.stop();
          MovieClip(this.root).gotoAndPlay(1, "Testside");

Similar Messages

  • I have about 800 more songs on my nano than itunes, due to a crash. How can I get the songs onto itunes from the ipod, or at least get the new music ive gotten since the crash onto my ipod without deleting all the other songs when it syncs?

    i have about 800 more songs on my nano than itunes, due to a crash. How can I get the songs onto itunes from the ipod, or at least get the new music ive gotten since the crash onto my ipod without deleting all the other songs when it syncs?

    It has always been very basic to always maintain a backup copy of your computer for just such an occasion.  Use your backup copy to put everything back.
    If you have failed to bakup, then you can transfer itunes purchases from an ipod: File>Transfer Purchases

  • I'm new to Mac. I have an iPhone and a Mac Mini.  My original iTunes was on a Windows computer that crashed.  So, all of my iTunes Music and Movies are gone.  How do I get the movies and music from my iPhone to the new Mac Mini?

    I'm new to Mac. I have an iPhone and a Mac Mini.  My original iTunes was on a Windows computer that crashed.  So, all of my iTunes Music and Movies are gone.  How do I get the movies and music from my iPhone to the new Mac Mini?

    If you still have the crashed Win computer, you may be able to recover your music and movies from the hard drive. If you have a friend with a hard drive USB connection kit and a PC, they should be able to help.  Otherwise, check locally for computer services that might do that for you (I think Best Buy Geek Squad may be able to help). If the drive itself is in good shape, it shouldn't be too expensive. 

  • How do I get the music back on my iPhone after manually deleting it from the device (to get space for photos/videos)?

    How do I get the music back on my iPhone after manually deleting it from the device (to get space for photos/videos)?  I can sync with iTunes but it doesn't copy these songs back, even though they still appear in my iTunes library.  I can click on the Music link  under 'On My Device' in iTunes and the missing songs all appear to still be on the device, but they are not.  I normally delete using iTunes and do not have this issue.  This time I was out and needed more space to shoot photos and videos so I removed a lot of music from my phone through the Music App.

    The songs I'm trying to reload on my phone are on my PC.  These we had loaded into iTunes.  I can remove them all from the library and then add them all back one by one I imagine.  The problem I'm having is that I removed them manually from the phone, they still appear in iTunes music library yet they won't sync.  I don't want to take the time to compare the phone to my library, remove from the library what's missing on the phone and then add them all back again.  64GB (mostly music) will take a while.

  • My hard drive crashed.  How do I get the music I purchased from itunes back?

    My hard  drive crashed.  How do I get the music I purchased from Itunes back?

    Thanks Roaminggnome,
    I just spoke with a friend who like you is into Apple and he just walked me through the Cloud.  At least I was able to get those songs back. 
    Thanks.
    Do you know --- the last time I tried to back up my itunes it asked for 106 cd's do you how to direct the backup to the external drive?   By the way I found 3 back up cds from 2010 and 1 of the 3 cd's had an error.
    Sincerely,
    Nanettefrombrooklyn

  • How can I get the built in apps from iPad 2 to my iPad 1?

    How can I get the built in apps from ipad2 to my iPad 1?

    Is your iPad 2 running iOS 5.0.1 and your ipad 1 running iOS 4? If this is the case then go through the update process on your iPad 1. All the iPad 2 apps running on iOS 5 that are compatible with the iPad 1 will be put on your iPad 1. Those apps that require a camera will not appear because the iPad 1 does not have a camera.

  • How can I get the shutter count for my Canon 7D Mark II using Windows XP?

    How can I get the shutter count for my Canon 7D Mark II using Windows XP? I've been looking lots of places and doing some file uploads, but I can't seem to find anything. I'm wary of downloading software I know nothing about. Any help is greatly appreciated.
    Solved!
    Go to Solution.

    Nevermind, just, sort of answered my own question. Doesn't work on XP, but using a Win 7 'puter I was able to use Shutter Count, which now works w/ the 7D Mark II.

  • TS2771 How do I get the connect to iTunes display off so I can use iPod again?

    How do I get the connect iTunes connection display off so I can use iPod again?

    By connecting the iPod to your computer and restoring via iTunes.
    iTunes 10 for Windows: Update and restore software on iPod, iPhone, or iPad

  • How can we get the selected line number from JTextArea ?

    how can we get the selected line number from JTextArea ? and want to insert line/string given line number into JTextArea??? is it possible ?

    Praitheesh wrote:
    how can we get the selected line number from JTextArea ?
    textArea.getLineOfOffset(textArea.getCaretPosition());
    and want to insert line/string given line number into JTextArea??? is it possible ?
    int lineToInsertAt = 5; // Whatever you want.
    int offs = textArea.getLineStartOffset(lineToInsertAt);
    textArea.insert("Text to insert", offs);

  • Hello how do I get the question mark away from my tracks. The songs can be played against the

    Hello how do I get the question mark away from my tracks. The songs can be played against the

    You have to find the songs on your computer. If you have deleted them then you will not be able to add them. Check the backup of your computer.

  • Just imported clips and edited as new project. closed imovie. came back later and the entire project was gone. i was not done so i did not finalize it. how do i get the program to keep my project in progress

    running imovie on a powermac w 10.6.8. went through the tutorials. imported my clips, got the hang of basic editing, and created a project.
    was pretty happy with it, but needed to shut down and come back to work on it later. when i did come back, the entire project was gone.
    how do i get the program to save my work in progress, without finalizing it?
    thanks

    So, everything worked out just fine!
    I have all my material in the ProRes Codec on a seperate drive now. The project itself was kept or rather duplicated, the bin structure etc stayed the same but is linking to the newly created files. The playback and workflow is fluent. I am happy! 
    Time info: For about 120 GB of material the codec change process took 25 hours.
    Thanks for your help!
    Best
    *a

  • How do you get the web application path from the servlet?

    I have created a web application which is installed in
    /webapps/myApplication
    /webapps/myApplication/data/users.xml
    /webapps/myApplication/WEB-INF/classes/myServlet
    How can you get the path to the "users.xml" file from the "myServlet" file?
    The code below doen's seem to return the xml file. anybody knows why?
    public class myServlet extends HttpServlet {
    public void doGet( HttpServletRequest req, HttpServletResponse res ) throws ServletException, IOException
    File myXmlFile = new File("/data/users.xml");

    Try this..
    String FileName = getServletContext().getRealPath("\\data\\users.xml");
    File myXmlFile = new File(FileName);
    hope this helps..

  • How can i get the music ive copied from cd onto my new computer

       how can i get the music that i have copied from cd's on to my new computer.(the computer my phone was sync to blew up)  if i sync to the newit i will all the music  thats on my phone, 

    Restore from the backup of your old computer. Copy it from the CDs.
    Look for a 3rd party app that can do what you want. Senuti has been
    mentioned in the past - I do not use it so cannot comment on how
    well it works. I would assume there are others as well.
    iOS does not natively support syncing music back from the iPhone
    to a computer.

  • How do I get the bluetooth to disconnect from the iphone?

    I have a built-in Bluetooth in my 2011 Suzuki. The iphone 4 worked perfectly with the Bluetooth until I updated to iOS5. Now when I try to hang up from the Bluetooth call ( ie push the bluetooth button in the car), the phone goes to the keypad screen rather than the home screen. The sound remains muffled and the disconnect does not happen until I press on the home screen button- then the radio reconnects. Anybody have this problem??? How do I get the phone to hang up without touching it?????

    on your bluetooth try touching various other buttons. because it is a new update the usual "end call button" seems to be established or re-labeled as the keyboard button. so my guess would be that a different bluetooth button may in fact work as an end call button. if this doesnt work try to forget the bluetooth device and reconnect it as if it was the first time. if none of these work try to restore the iphone maybe something went wrong in updating to ios5.
    hope this helps good luck!

  • How do i get the lefthand sidebar to show everything after 11.1.5?

    restarted my computer last night. now the itunes sidebar is all weird.
    I figure this must be some sort of weird update.
    how do i get the sidebar to show everything again, instead of having to drill down strangly placed weird icons?
    like a 'library' sidebar drill down, that shows all movie and music and devices on the sidebar.
    would like it to always show everything like in previous versions of itunes as default.

    Thank you. that was it.
    (still shell-shocked over the arrow keys going away and other surprise over-simplification updates)

Maybe you are looking for

  • Using foreign CDMA phones on Verizon Wireless

    Hi, I went to South Korea for an internship and was given a LG U+ Samsung Galaxy S2 from a relative. It is CDMA, and after looking at the specifications it seems like it should work on Verizon Wireless network. However I was told that non VZW branded

  • How to remove PSE 2 from a Mac?

    Several years ago I purchased Photoshop Elements 2 on a CD and installed it on my Macintosh (OS X). Recently the program began acting oddly, saying "The command you entered could not be completed because the file is locked" even when the file was cle

  • Bookmark This Page has disappeared only on gmail sign-in. Why? How to restore?

    I am using a shared network computer but always use my own computer and always sign out after checking emails."Bookmark this page" option was there yesterday. Today, in its place is "edit bookmarks". If I go to any other website I can bookmark the pa

  • Compress FLV to MOV

    I have a number of FLV files I need to convert to MOV or MP4 formats. How can I do so? Thank you

  • Font mark up

    Hi there, does anyone know of a plug-in to produce a font mark-up in Indesign? I currently type all of mine out for each font that appears within my document for a laser brief. Thanks