FLASH AS2 how to make a movieclip visible for 1 second
I have a quiz and when the correct answer is clicked i want to show a correct answer mc
so when the answer is clicked a "correct" or an "x" will flash up for 1 second.
I have to functions on for right (celebrate) and one for wrong (wrong_answer)
function celebrate() {
_root._root.<<<<code to show mc for 1 second>>>>>>>>>>
_root.triangle_mc.scaleTo(100, 0.4, "easeOutBack", 0, glamour);
_root.triangle_mc.scaleTo(100, 0.4, "easeOutBack", 3);
_root.triangle_mc.brightOffsetTo(23, 0.4, "easeOutSine", 0);
_root.tr开发者_运维百科iangle_mc.brightOffsetTo(0, 0.5, "easeOutSine", 3);
_root.triangle_mc.tween('_y', 370, 0.4, "easeOutBack", 0);
_root.triangle_mc.tween('_y', 418, 0.4, "easeOutBack", 3);
}
function wrong_answer() {
_root.<<<<code to show mc for 1 second>>>>>>>>>>
_root.triangle_mc.scaleTo(100, 0.4, "easeOutBack", 0);
_root.triangle_mc.scaleTo(100, 0.4, "easeOutBack", 3);
_root.triangle_mc.brightOffsetTo(23, 0.4, "easeOutSine", 0);
_root.triangle_mc.brightOffsetTo(0, 0.5, "easeOutSine", 3);
_root.triangle_mc.tween('_y', 370, 0.4, "easeOutBack", 0);
_root.triangle_mc.tween('_y', 418, 0.4, "easeOutBack", 3);
}
so can anyone help with this issue of showing a mc clip for 1 second??
many thanks in advance for any help
You could use setTimeout to call a function after 1 second and remove your message or movieClip from the screen. Something like this:
myBtn.onRelease = function()
{
myMC._visible = true;
setTimeout(removeMC,1000); // 1000 milliseconds = 1 sec
}
function removeMC()
{
myMC._visible = false;
}
精彩评论