-
[F8] waiting few seconds until load movie
i have a button which has a sound(event) attached to it when you click on it. i want to make it so itl wait until the sound of the button is over to load the next swf, because it loads it right when i click the button. and how can i make my other sound which is the sound on the main screen stop when the button sound starts.
-
search in the flash help for interval or setInterval
-
what code would i put in the actionscript for the button to make it wait a few seconds.
-
like I said it stands in the flash help,
alternativly here online:
http://www.adobe.com/support/flash/a...ionary646.html
using google I get also some usefull results:
http://www.google.com/search?hl=en&c...al&btnG=Search
from what I´ve read on the very same sources this might be a way
PHP Code:
function delayedActionscript(){
//do stuff here that should be delayed...
stopAllSounds();// mute!
//load Sound code
clearInterval(myInterval);//remove this interval
}
someWhatEverButton.onPress = function(){
var time = 2000;//2 seconds
myInterval = setinterval(delayedActionscript, time);
}
get familar with the flash help,- it helped me for example many years ago like 80% of all I needed to know
-
You could have all your sounds in a separate MC ( or separate .swf since it seems you are loading those ). That way they will not just stop playing as soon as you load something else into the main timeline.
on sound complete will trigger whatever you want after the sound is complete.
You could use setInterval, but you have to match interval time with duration of sound ( not a big deal ).
Instead of abrupty cutting off the other sound, if you have all sounds nicely organized in a separate clip, you can fade one out while triggering the button sound, or fade one in and fade one out.
function fade() {
soundclip.music.setVolume(soundclip.music.getVolum e()-1);
if (soundclip.music.getVolume()<1) {
clearInterval(dofade);
soundclip.music.setVolume(0);
}
}
dofade = setInterval(fade, 100);
If this is a very short button sound then you don't need any of this. Sounds like your problem comes from loading another .swf into the same timeline where the button in question resides, thus unloading it as soon as it's clicked.
You should load your .swf into an empty movie clip on a timeline ( if that's not the case ), and just hide the button, no need to unload it.
Last edited by MikeMD; 06-21-2008 at 03:06 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|