Voetsjoeba's Button moveEase Movie clip

Hello!

In another post I saw Voetsjoeba giving AS code on how to make a movieclip move/ease to hover over whatever button was rolled over, you said to ask about changing the MC size… but what I want to know is can the MC be tinted to a differnt colour depending on what button is rolled over? Like 50% red tint on one button then 50% blue tint on another button?

Any idea how to do that Voetsjoeba? or anyone else?

Cheers

how about using getRGB() and setRGB()?

just a though… voets might be able to help more, because i don’t know exactly what you are working with.

This was the post with the code I got:


On the movieclip that you want to ease into position, place this AS

ActionScript:-------------------------------

onClipEvent(load){
_root.tarX = initialxposition
_y = initialyposition
}
onClipEvent(enterFrame){
_x = _root.tarX-(_root.tarX-_x)/1.2
}


Change initialxposition and initialyposition to the x and y positions of where you want the movieclip to start. This could be on the first button, or on the left outside the stage, or anything.

To the buttons, add this code:

ActionScript:--------------------------------------

on(rollOver){
_root.tarX = this.instancenameofbutton._x
}


There you go. You can also have the movieclip to change size smoothly (for example if one buttons is large and another is small), just ask and I’ll modify it


I woulda linked to the other post but I couldnt find it.

Cheers

hey, i don’t know if this one will help you, but maybe you can get a brainwave from it…

http://www.kirupa.com/developer/mx/alpha_fade.htm

it is quite a kewl effect.

Add this code to the movieclip that eases into position:

To onClipEvent(load)
[AS]
_alpha = 50
_root.mccolor = new Color(this)[/AS]

To onClipEvent(enterFrame)
[AS]
_root.mccolor.setTransform({ra:_root.red, ga:_root.green, ba:_root.blue, aa:_root.alpha});
[/AS]

So the entire code would look like:
[AS]
onClipEvent(load){
_root.tarX = _x
_root.tarW = _width
_alpha = 50
_root.mccolor = new Color(this)
}
onClipEvent(enterFrame){
_x = _root.tarX-(_root.tarX-_x)/1.2
_width = _root.tarW-(_root.tarW-_width-5)/1.2
_root.mccolor.setTransform({ra:_root.red, ga:_root.green, ba:_root.blue, aa:_root.alpha});
}[/AS]

Then, on your buttons, add this:

[AS] _root.green = 100;
_root.blue = 0;
_root.red = 0;
_root.alpha = 50;[/AS]

If you’d want it to become green. 100 indicates the % of greenness. So the whole code of a button would be like:

[AS]on (release) {
_root.tarX = this.home._x;
_root.tarW = this.home._width+5;
_root.green = 100;
_root.blue = 0;
_root.red = 0;
_root.alpha = 50;
}[/AS]

Hope that helps you :slight_smile:

Hello, thanks alot Voetsjoeba, I have it changing colour but what I meant was could it morph to another colour instead of a straight colour change, so it looks like a colour tween?

Here ya go :slight_smile:

MovieClip:[AS]
onClipEvent (load) {
_root.tarX = _x;
_root.tarW = _width
_root.mColor = new Color(this);
_root.tarR = 100;
_root.tarG = 0;
_root.tarB = 0;
_root.tarA = 50;
}
onClipEvent (enterFrame) {
//Properties
_x = _root.tarX-(_root.tarX-_x)/1.2;
_width = _root.tarW-(_root.tarW-_width)/1.2;
//Colors
curColor = _root.mColor.getTransform();
curra = curColor.ra;
curga = curColor.ga;
curba = curColor.ba;
curaa = curColor.aa;
_root.mColor.setTransform({ra:_root.tarR-(_root.tarR-curra)/1.1, ga:_root.tarG-(_root.tarG-curga)/1.1, ba:_root.tarB-(_root.tarB-curba)/1.1, aa:_root.tarA-(_root.tarA-curaa)/1.1});
}[/AS]

Buttons:[AS]
on (release) {
_root.tarX = this.home._x;
_root.tarW = this.home._width+20;
_root.tarR = 0;
_root.tarG = 100;
_root.tarB = 0;
_root.tarA = 50;
}[/AS]

:wink:

Thats superb, thanks very much!:slight_smile: :bounce:

You’re welcome :slight_smile:

cool stuff voets. :thumb: