Copy link to clipboard
Copied
Hey all,
How can I get a movie inside a button to trigger on rollover so it doesn't stop when mouse moves off the button? The final output will be a touchscreen so it should function when tapped once. I will have several buttons existing at the same time so I can't use the timeline to solve it. I'm using action script 3.0. Any help welcome please. I am a designer not a coder so scripting knowledge is limited,
Thanks,
Sarah
Copy link to clipboard
Copied
it will actually be easier to use a movieclip instead of a button and control your off,over and down frame display using actionscript.
Copy link to clipboard
Copied
Sounds good in theory. Any chance of a sample? One graphic for example is an ambulance. On rollover the ambulance drives off, siren flashing and sound blaring. I've figured it out in action script 2.0 but 3.0 is a no go.
Thanks!
Copy link to clipboard
Copied
Try something like this:
ball.addEventListener(MouseEvent.CLICK, triggerMC);
function triggerMC(e:MouseEvent):void {
ball.play();
}
Assuming "ball" is your MovieClip instance.
Here's an FLA => https://dl.dropboxusercontent.com/u/78088/shares/mc_click.fla
Copy link to clipboard
Copied
Hi Joseph,
I'm using Flash CS5 so couldn't open your CC file. Vould you save it down to cs5 for me please?
Thanks,
Sarah
Copy link to clipboard
Copied
check jl's answer but i think this might be more what you're looking for:
button_mc.addEventListener(MouseEvent.MouseOver,overF);
button_mc.addEventListener(MouseEvent.MouseOut,outF);
// button_mc should have a stop() in its first frame, an 'over' frame with your movieclip (eg, over_mc)
function overF(e:MouseEvent):void{
button_mc.gotoAndStop("over");
button_mc.over_mc.play();
}
function outF(e:MouseEvent):void{
if(button_mc.over_mc.currentFrame!=1){
button_mc.addEventListener(Event.ENTER_FRAME,enterframeF);
}
}
function enterframeF(e:Event):void{
if(button_mc.over_mc.currentFrame==button_mc.over_mc.totalFrames){
button_mc.removeEventListener(Event.ENTER_FRAME,enterframeF);
button_mc.over_mc.gotoAndStop(1);
button_mc.gotoAndStop(1);
}
}
Copy link to clipboard
Copied
thanks Joseph and kglad. I'll get time tomorrow to try these options.