PDA

View Full Version : Set Transform Color Issue



Digitalosophy
September 4th, 2003, 10:15 PM
Hey, I am trying to do this:

Inside a movie clip this what should be happening

When a user rolls over MC mc should turn green

When user roll out if green go back to original color = black

When user clicks MC turn red

If MC is red When user rolls back onto MC stay red and NOT turn green

But when MC is red and clicked again, MC goes back to green

here's what I got so far:

(inside the MC)



colorObj = new Color(this);
colorObj.setTransform({ra:100, rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0});
state = 0;
this.onRollOver = function() {
colorObj.setTransform({ra:100, rb:0,ga:100,gb:45,ba:100,bb:0,aa:100,ab:0});
if (state != 0){
colorObj.setTransform({ra:100, rb:69,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0});
}
//trace(state);
}
this.onRollOut = function() {
if (state == 0) {
colorObj.setTransform({ra:100, rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0});
}
}
this.onPress = function() {
state = 1;
colorObj.setTransform({ra:100, rb:69,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0});
if(colorObj = ({ra:100, rb:69,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0})){
//trace("Turn green");

}
}

grandsp5
September 4th, 2003, 10:42 PM
couldnt you just do it with different frames in the movie rather than the color Object? Unless that it what you want to use.

Digitalosophy
September 4th, 2003, 10:46 PM
i think that would be real confusing that way.
let me show you whats going on

grandsp5
September 4th, 2003, 10:46 PM
this.onRollOver = function() {
if(clicked == false}{
colorObj.setTransform(green);
}
}

this.onRollOut = function(){
if(clicked == false){
colorObj.setTransform(black);
}
}

this.onPress = function(){
if(clicked == false){
clicked = true;
colorObj.setTransform(red);
}
else{
clicked = false;
colorObj.setTransform(green);
}
}


this is with as. Change the string colors to your setTransform values. This will reset to as if it had never been clicked if you click twice, dunno if thats what you want.

lostinbeta
September 4th, 2003, 10:49 PM
You can use getRGB() and setRGB(), much shorter ;)

colorObj = new Color(this);
colorObj.setRGB(0x000000);
this.onRollOver = function() {
if (colorObj.getRGB() != 0xFF0000) {
colorObj.setRGB(0x009900);
}
};
this.onRollOut = function() {
if (colorObj.getRGB() == 0x009900) {
colorObj.setRGB(0x000000);
}
};
this.onPress = function() {
if (colorObj.getRGB() == 0x009900) {
colorObj.setRGB(0xFF0000);
} else {
colorObj.setRGB(0x009900);
}
};


Untested, but it's a point in the right direction none-the-less.

Digitalosophy
September 4th, 2003, 10:51 PM
woah posted at same time, i have to run for a bit hopefully your code will help me out later

thanks a lot bro

Digitalosophy
September 4th, 2003, 11:00 PM
omg all these posts at same time, thanks LIB and thanks Granps

you guys rock