Copy link to clipboard
Copied
Hello, I use Flash CS6 and AS2 and i made a animation with a waterball.
So the problem is i dont want the animation to run instantly at loading the SWF up only if you Hover over it.
Can you guys please tell me what i need to change to make it really only at hover?
Thanks.
-Marc
Maybe you did not understand me.
On the first frame of the button show only the first frame of the animation or nothing if you like.
On the roll over state put the animation.
Then when the SWF loads you will have a static image and only it will play when you hover over it.
You can show on the first frame of the button the container, but switch it to Graphic and stop it.
Copy link to clipboard
Copied
assuming you have no streams (eg, video and sound), list all frame 1 movieclips in an array, eg
this.onRollOver = overF; // note: you may need an object with _alpha=0 on stage.
var mcA:Array=[_this,mc1,mc2,...]; // should contain, at least, _this
playF(mcA,false);
function overF():Void{
playF(mcA,true);
}
function playF(a:Array,b:Boolean):Void{
if(b){
for(var i:Number=i<mcA.length;i++){
MovieClip(mcA.play());
}
// may want to 'delete' event listener
} else {
for(var i:int=i<mcA.length;i++){
MovieClip(mcA.stop());
}
}
Copy link to clipboard
Copied
Am i supposed to set that into the AS Code of the animation?
Copy link to clipboard
Copied
yes, that should be added to the actions panel, frame 1 of the main timeline
Copy link to clipboard
Copied
It gives me many errors that it expects ; and unexpected apperiance of . or class called "int" cant be loaded and block needs to be closed with } 😕
Copy link to clipboard
Copied
try:
this.onRollOver = overF; // note: you may need an object with _alpha=0 on stage.
var mcA:Array=[_this,mc1,mc2,...]; // should contain, at least, _this
playF(mcA,false);
function overF():Void{
playF(mcA,true);
}
function playF(a:Array,b:Boolean):Void{
if(b){
for(var i:Number=i<mcA.length;i++){
MovieClip(mcA.play());
}
// may want to 'delete' event listener
} else {
for(var i:Number=i<mcA.length;i++){
MovieClip(mcA.stop());
}
}
}
Copy link to clipboard
Copied
Hi mate,
A very simple way may be to put your animation inside a Button symbol on the Roll over frame and then define the hover area.
While the mouse is over, the animation which should be inside a Movieclip, will loop, unless you have a stop somewhere.
Hope this helps!
Copy link to clipboard
Copied
It Helps a bit^^ But the problem is that like the Animation is playing as soon as the SWF Gets Loaded/Started and i dont want tht i just want it to come up at a Hover.
Copy link to clipboard
Copied
Maybe you did not understand me.
On the first frame of the button show only the first frame of the animation or nothing if you like.
On the roll over state put the animation.
Then when the SWF loads you will have a static image and only it will play when you hover over it.
You can show on the first frame of the button the container, but switch it to Graphic and stop it.
Copy link to clipboard
Copied
Thanks!
Copy link to clipboard
Copied
Here is a sample setup: hover_to_play.fla - Google Drive