This content has been marked as final. Show 20 replies
Hey, how about removing the boolean and restarting the interval on mouse movement alone, this way, even if they leave the mouse at the button and walk away, it should restart after the time is up. btw, the previous interval loop is not getting cleared in the code, one should always clear it so that multiples don't develop. maybe like this:
It still didn't work. I put the code in frame 1 of movie1.swf. I tested the movie and took my hand off the mouse before the movie ran and at the end of the 10 seconds movie1.swf did not redirect to selectionscreen.swf.
I need it to redirect even if the user never moves the mouse. The reason for this is that lets say someone is at the selectionscreen and chooses movie1 but gets distracted and walks away never even moving the mouse after movie1 is opened. It would need to direct back to selectionscreen even if the mouse never moved.
hmmm... did you make a selection from the first screen? it seems like you must have ... did you put a stop() action at the top of the code? I think I would do that.
Also the loadMovie() function's second parameter is incorrect, it should be a target object, not a level. If you want to load to a level you should use the loadMovieNum() function instead. However using the MovieClipLoader class gives you more control over the operation of the loading and has several event handlers.
I'm doing a couple of tests, but somethings not working right, I'm looking into it and will post back.
Yes I have stop(); where it needs to be. On Frame 1 of selectionscreen.swf I have stop(); in the actions layer. In selectionscreen.swf there are four buttons linking to the four other .swf's (movie1.swf...and so on).
When the user clicks on movie1.swf I also have stop(); on the first frame of the actions layer. Followed by the code I posted earlier. I also have the following code (attached) which controls a horizontal scroll bar. This code isn't messing with the code i posted earlier is it?
So if the user opens movie1.swf and they never ever ever move the mouse I need it to redirect back to the selectionscreen.swf. I'm thinking that there needs to be a timer that starts counting down once the movie is opened and if the mouse is moved this timer will stop, kind of like a Timer 1 in case the mouse is never moved. So once the mouse is moving and then the mouse stops moving it will start the other timer (Timer 2). I think my logic is correct on this, I just don't know how to write the code for it. What do you think?
Hey I'm back. OK I think I may have found the problem, after several trials it seems that both the 'loadMovie' and 'loadMovieNum' functions somehow interfere with a setInterval call, I've never run across this before but it seems to be the problem. I've run several tests, and repeatedly, if there is one of these two calls present, the interval will not run.
so I've revamp the code using a MovieClipLoader, it does the same thing, but you'll need to call to it differently by using 'MovieClipLoader.loadClip()'. Also from your buttons on the selections page you'll need to change the code to call back to the root level and use the MCL.
I don't see anything in the code you've posted here that would interfere with the timer codes, although there are a couple of things I'm wondering about but that's a different topic.
here's the new timer code, and a snippit for the button codes:
It is still not doing what I want it to do.
Try this and tell me if the code you gave me is working for you. Hit ctrl enter and dont touch the mouse. It will only timeout if you move the mouse first. I need it to timeout without having to move the mouse first.
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 ...
time = setInterval(runTimer, 100);
... that will start the interval upon opening the doc.
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
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.
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.
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?
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?
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.
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.
and the video file:
OK Rine, give me a little time with these and I'll post back.
Just curious to see if you had figured anything out? Thanks!
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.
Correct they are CS3 files but I used actionscript 2.0. Thanks!
Just wondering if you had any luck?
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.