PDA

View Full Version : Simple rollover thing


GdabZ
03-05-2008, 09:30 AM
Hello !
I'm a beginner in Flash, I knew 2-3 things in AS2, but I'm a true noob in AS3. Excuse my poor English, I'm French.

I have made a banner that has a looping background. On the top of that moving background, on another layer, I have several buttons grouped in a MovieClip.

I would simply like to change the color of an object while the mouse flys over the buttons.


menuComplet.Maison.addEventListener(MouseEvent.ROL L_OVER, animeFond);

function animeFond(e:MouseEvent):void
{
barreColor.color = '#FFFFFF';
}


As the button 'Maison' is contained in a group figuring on the scene as 'menuComplet', I try to reach it by 'menuComplet.Maison'

barreColor is a MovieClip on the scene, and I would like to change its color depending to the rollover on the button 'Maison'

I may not have been understandable so let me join the fla file :
essai.fla (http://sadjester.free.fr/essai.fla)

Thanks ! ;)

GdabZ
03-05-2008, 11:06 AM
I got it !


function animeFond(e:MouseEvent):void
{
var colorTransform:ColorTransform = barreColor.transform.colorTransform;
colorTransform.color = 0xFFFFFF;
barreColor.transform.colorTransform = colorTransform;
}


But I'll prefer to change the tint of my object 'barreColor' than the color itself ?

I've tried to replace colorTransform by tintColor, but it doesn't work :


function animeFond(e:MouseEvent):void
{
var coloriage:ColorTransform = barreColor.transform.colorTransform;
coloriage.setTint(0xFFFFFF, 0.1); // Will apply 10% of white, giving a tint
barreColor.transform.colorTransform = coloriage;

}


reason given : 1061: Call to a possibly undefined method setTint through a reference with static type flash.geom:ColorTransform.

GdabZ
03-05-2008, 12:31 PM
function retourALaNormale(e:MouseEvent):void
{
var color:ColorTransform = barreColor.transform.colorTransform;

color.redMultiplier = 1;
color.greenMultiplier = 1;
color.blueMultiplier = 1;

barreColor.transform.colorTransform = color;
}

This one works, but the tint amount is 100% and I can't figure out how to change it, as color.tintMultiplier doesn't work...

Help, please !;)