0

I'm making a website and I want to make MouseEvent.ROLL_OUT and then be able to click on the object i deffined as button. How can i do that?

I tried this but it's not working...

b2.addEventListener(MouseEvent.ROLL_OVER, b2_out);
b2.addEventListener(MouseEvent.CLICK, b2_clicked);

function b2_out(event:MouseEvent):void
{

    this.gotoAndStop("page1");
}

function b2_clicked(event:MouseEvent):void
{
    this.gotoAndStop("page6");
}
gn66
  • 803
  • 2
  • 12
  • 33
  • what exactly do you wanna make ? it seemy that you want to change the page to page1 as the cursor leves the button ? – Ace Nov 22 '12 at 10:48
  • i think that way the user is not able to get on page6 this way, because after clicking the button , he proppably will roll_out from the btn and goto page1 again... – Ace Nov 22 '12 at 10:49
  • in page1 i have the same function for ROLL_OUT and returns to this page, this happens because I want to add an efect on my object to change its color. Its the sabe object and identical pages but when mouse rolls over it changes to blue and mouse rolls out its goes back to grey. So what I wanna do is when mouse goes over, it change it's color to blue but if the user clicks on the object he will be redirected to another page (page6) – gn66 Nov 22 '12 at 11:00
  • are you working in Adobe Flash ? and are you familiar with actionscript 3 ? are you going to have the effect on the BUTTONS ( so a simple mouseOver effect ) or on the PAGE ? – Ace Nov 22 '12 at 11:07
  • structuring the movieclips and the timeline well is very important for those effects. – Ace Nov 22 '12 at 11:08
  • yes, I'm working with Adobe Flash Professional CS6 and I created a documment in actionscript 3, I want to make the effect on the buttons, but I'm new to flash, I'm doing those effect wrong? – gn66 Nov 22 '12 at 11:11
  • I started to do the site this way its because action script 3 dont allow to make the animation directly in the object. I you want I have my file here to understand it better: http://www.mediafire.com/?qsd1l0i644sln0q – gn66 Nov 22 '12 at 11:28

1 Answers1

1

If Adobe Flash cs6 you can choose either "MovieClip" or "Button" as you convertig an object ( image or a simple rectangle ) to a symbol. ( rightclick -> convert to symbol )

the easy way is to choose "button", there you already have the diferend button states.

enter image description here

but animation is complicated this way. so if you dont have transition effects, this will be your bet.

you can simply key one of the 4 frames if you go inside that BUTTON-movieclip you've just created.

enter image description here

the other way would be to choose "MovieClip".

that way you have to use the timeline to animate the transition effect.

enter image description here

the code for that is pretty simple.

in yout parent movieclip ( or root ):

function btn1Over(event:MouseEvent):void {
    btn1.gotoAndPlay("over");
}

function btn1Out(event:MouseEvent):void {
    btn1.gotoAndPlay("out"); // if you want, you can leave the stop(); function in the "out" section so it will get back to "still" state.
}

btn1.addEventListener(MouseEvent.ROLL_OVER, btn1Over);
btn1.addEventListener(MouseEvent.ROLL_OUT, btn1Out);

hope this is helpful. rate and mark as answer if it is.

also you could check on youtube for video tutorials or sites like developphp.com.

the web is full of tutorials on flasch / as3.

have fun. Ace

Ace
  • 1,437
  • 6
  • 28
  • 46
  • Well I follow the example and the objec did everything just fine, thanks for the help! – gn66 Nov 22 '12 at 11:50