;

PDA

Click to See Complete Forum and Search --> : Controling a movie in a button


Groat
05-22-2008, 07:42 PM
I have a button with a movie clip in it. When i scroll over the button the first part of the movie plays. I want the second part of the movie to play when i scroll off the button. The movie clip is inside the button on the "over" state frame. i tried the following code and it didn't work.

Button name = ice_btn
Movie name = slider_mc

Code
ice_btn.addEventListener(MouseEvent.MOUSE_OUT, toIce);


function toIce(event:MouseEvent):void {
slider_mc.gotoAndPlay(6)
}

Groat
05-23-2008, 02:56 AM
Kinda got it working but now i have another problem. I restarted and make a movie clip with 4 button states; up, down, over, out. All of the states work however, the "stop();" isn't working. So when ever i mouse over the button all the button states loop. I attached the file below. If someone could help me out it'd be greatly appreciated.


stop();


this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
this.addEventListener(MouseEvent.CLICK, onRelease);
this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);


function onMouseOver(e:MouseEvent) {
e.target.gotoAndPlay("over");

}

function onMouseOut(e:MouseEvent) {
e.target.gotoAndPlay("out");

}

function onRelease(e:MouseEvent) {
e.target.gotoAndPlay("over");

}

function onMouseDown(e:MouseEvent) {
e.target.gotoAndPlay("down");

}

dipankar.paul
05-25-2008, 02:46 PM
Hi there,

Instead of using a movieclip inside try to use graphic element. Coz if u use movieclip then "MouseOver" event happens to the inside movieclip and that triggers the "MouseOut" event of the outer movieclip. Therefore you have a loop effect.
Please see the attachment. I have converted the inner movieclip into graphic and it works.
I would suggest you to add the drop shaddow effect mannually, that way you will be able to downsize the rendering time at runtime.

Cheers
Dipz
---------------
www.webvariations.com