Skip to main content
Known Participant
October 2, 2007
Question

Help with Timer/Interval

  • October 2, 2007
  • 12 replies
  • 1052 views
Hello everyone,

I have a flash application I am working on that is going to be in a kiosk as a touchscreen app. If there is no user activity I need it to timeout and return to the mainscreen. I copied and pasted some code for that and its working great. I have 5 seperate .swf's. selectionscreen.swf is the main file with four buttons to the other swf's. When you click on one of the four buttons it will load that swf to level 0. If the user clicks on a button and they do not move the mouse once the .swf has loaded it will not timeout. How do I get the code below to timeout if the user does not move their mouse once opening one of the .swf files?

This topic has been closed for replies.

12 replies

clbeech
Inspiring
October 12, 2007
Hey Rine, sorry for the delay. I have taken a look into these files, and see what the problems are. Can you PM me with your email, so we could coorespond further in more detail.
clbeech
Inspiring
October 10, 2007
Rine, sorry I haven't been back here, I had to switch computer systems for this and download again, the files are CS3, right? I couldn't read them with my other system. I'll post back tomorrow with results.
RineAuthor
Known Participant
October 10, 2007
Correct they are CS3 files but I used actionscript 2.0. Thanks!
RineAuthor
Known Participant
October 12, 2007
hi cbeech,

Just wondering if you had any luck?
clbeech
Inspiring
October 8, 2007
OK Rine, give me a little time with these and I'll post back.
RineAuthor
Known Participant
October 9, 2007
Just curious to see if you had figured anything out? Thanks!
clbeech
Inspiring
October 8, 2007
Hey Rine, how big are the other swf files? It might be better if everything was within the same file instead of loading in, for speed and control. I think I understand what's going on here is that the timer code(s) are getting 'left behind' so to speak. All of these swf files could be on sperate layers and called to become visible or not, which also will disable all button functions for that MC, but if they are shuffled to a level, even with a BG, then yes, the buttons under the top level will still be active, however there are ways to 'turn them off' so to speak by disabling all buttons or MCs within a level.

I'm also wondering about the onEnterFrame at frame5, home_screen.swf, and why you would want to use that there when you could just load the swf in once, and that this is probably where the timer code should go. Also the timer code we have set up here, brings up the selection screen, and shouldn't it go back to the 'touch screen to begin' page in the home_screen.swf?

could you post your files so that I can look further into the issues here? I would need at least the home_screen, selection_screen and one of the others, or all of them.
RineAuthor
Known Participant
October 8, 2007
I changed the file names a bit also. home_screen.swf and select_screen.swf used to be combined. the reason I seperated them is because when I would go to movie1.swf and click go back to timeline to take me back to the 4 buttons I could not go to a specific frame (frame 5) when loading a .swf.

It was done as seperate .swf files because we were concerned that one large file might be too much. The size of the stage is 1440 x 900 and in the background of home_screen.swf is a 30 second HD video.

Maybe it would be better to have it all as one file? Any potential downfalls to this? At this point I'd rather see if I can't get it working as it is rather than having to move it all to one file.

Files:
http://www.araknidwebdesign.com/ho/home_screen.fla
http://www.araknidwebdesign.com/ho/select_screen.fla
http://www.araknidwebdesign.com/ho/hlhuntyears.fla

and the video file:
http://www.araknidwebdesign.com/ho/flvvids/building_test2.flv
RineAuthor
Known Participant
October 8, 2007
Sorry I left for a while. The timeout is at the bottom of the priority list right now and I had to take some time and finish other items.

Using the last code that you posted I put it into my movie and it didn't work. I would click on the button in the main movie and it would not redirect to the proper movie correctly. However, since then my movie structure has changed.

As of now here is what happens. home_screen.swf is the main movie. On frame 1 I have a stop(); it says touch screen to begin. Then the user touches the screen to begin and they advance to frame 2 of home_screen.swf. It plays a little motion tween and goes to frame 5. After the motion tween plays and reaches frame 5 i have an onEnterFrame function that redirects them to select_screen.swf which loads on level 0. In the select_screen.swf is where I have my four buttons which will take the user to movie1.swf, movie2.swf, movie3.swf and movie4.swf. They all load to level 0. The reason I have everything loading to level 0 is that I was running into a problem where if I loaded a new movie to a different level I could still click on the buttons behind the movie in the higher level.

So using the new structure and keeping in mind the problems with the buttons and levels how would I get the timeout code to work?
clbeech
Inspiring
October 3, 2007
OK, but did it trace the current 'time' value, in other words was the interval running? Also if you are using the most recent code post, did you add the to lines to start the interval on load?

If you still had the loadMovie lines in your code, that would indicate that you did not change over to the MovieClipLoader class that I had indicated, do you have other loadMovie calls still on the selectionscreen.swf, because it should get loaded on starting, and if there are loadMovie calls present, the interval will not function. I do not know why, but it seems to be a fact, and repeatable.

I'm just wondering, you said 'from my original code', have you made any of the changes I'd applied here?
RineAuthor
Known Participant
October 3, 2007
I removed the loadMovie instance all together from my original code just to test it and see what the trace functions would say.

It never timed out if I never moved the mouse.
clbeech
Inspiring
October 3, 2007
did you convert all calls to loadMovie and/or loadMovieNum to the MovieClipLoader instance. I had found that there seems to be some kind of interference with these calls and setInterval. If they are present within any of the loaded documents, the interval will not fire.
RineAuthor
Known Participant
October 3, 2007
I'm sorry I guess my brain isn't functioning this morning. I put those two lines in after the runTimer function and it doesn't appear to be doing anything.

Can you attach my original code with those two lines and show me? Not sure what I'm missing
clbeech
Inspiring
October 3, 2007
well sure that's no problem, I had though that since I'd loaded the selection screen in at the begining of the code here, that it wouldn't need to timeout from the opening of the document. so I didn't fire the interval loop within the opening run.

If you would like to start the interval at opening, so that it loops without mouse movement first, then add these line after the 'runTimer' function ...

clearInterval(time);
time = setInterval(runTimer, 100);

... that will start the interval upon opening the doc.