Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.23 / 5.00 3,881 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.93 / 5.00 4,634 ViewsAt 11/25/14 04:33 PM, SkyTheStarHero wrote: Man, thank you so much for even replying! You're awesome! Though I just put it in the flash, and I placed it in the same frame as the script for stopping the frame for a textbox. Nothing really happened.. Do I put it in a different frame in the timeline? Or do I put it in the same frame as the script for stopping the animation for pressing space on the text box? Here's the action script for it by the way.
stop();
onEnterFrame = function () {
if (!Key.isDown(Key.SPACE)) {
_root.allow = true;
} else if (Key.isDown(Key.SPACE) && _root.allow == true) {
play();
_root.allow = false;
}
};
Hmm, you already have an onEnterFrame function. If you use the code I provided, then it'll replace that and pressing Space won't work anymore. This'll require some modifications; nothing too complicated though.
Assuming you have a button called skipBtn that's always on the stage/timeline, then you'd need this code on the same frame as your onEnterFrame code; I've combined the two.
So this should go on the frame where you currently have your onEnterFrame code:
var stageSnd:Sound = new Sound(_root)
var vol:Number = 100
var startFade:Boolean = false
stop()
function FrameAction():Void
{
if (!Key.isDown(Key.SPACE))
{
_root.allow = true;
}
else if (Key.isDown(Key.SPACE) && _root.allow == true)
{
play();
_root.allow = false;
}
if (startFade)
{
stageSnd.setVolume(--vol);
if (vol <= 0)
{
onEnterFrame = null;
}
}
}
And on the frame where you have the button skipBtn: (skipBtn should not have any code as this will then overwrite it)
function startFadeFunction():Void
{
startFade = true
}
skipBtn.onRelease = startFadeFunction
And when you want it to go back to normal volume, set this:
stageSnd.setVolume(100) At 11/25/14 04:33 PM, SkyTheStarHero wrote: Man, thank you so much for even replying! You're awesome! Though I just put it in the flash, and I placed it in the same frame as the script for stopping the frame for a textbox. Nothing really happened.. Do I put it in a different frame in the timeline? Or do I put it in the same frame as the script for stopping the animation for pressing space on the text box? Here's the action script for it by the way.
stop();
onEnterFrame = function () {
if (!Key.isDown(Key.SPACE)) {
_root.allow = true;
} else if (Key.isDown(Key.SPACE) && _root.allow == true) {
play();
_root.allow = false;
}
};
Hmm, you already have an onEnterFrame function. If you use the code I provided, then it'll replace that and pressing Space won't work anymore. This'll require some modifications; nothing too complicated though.
Assuming you have a button called skipBtn that's always on the stage/timeline, then you'd need this code on the same frame as your onEnterFrame code; I've combined the two.
So this should go on the frame where you currently have your onEnterFrame code:
var stageSnd:Sound = new Sound(_root)
var vol:Number = 100
var startFade:Boolean = false
stop()
function FrameAction():Void
{
if (!Key.isDown(Key.SPACE))
{
_root.allow = true;
}
else if (Key.isDown(Key.SPACE) && _root.allow == true)
{
play();
_root.allow = false;
}
if (startFade)
{
stageSnd.setVolume(--vol);
if (vol <= 0)
{
vol = 0
startFade = false
}
}
}
And on the frame where you have the button skipBtn: (skipBtn should not have any code as this will then overwrite it)
function startFadeFunction():Void
{
startFade = true
}
skipBtn.onRelease = startFadeFunction
And when you want it to go back to normal volume, set this:
stageSnd.setVolume(100)