Jump to content
Search Community

Help with ColorMatrixFilterPlugin

Guest rlhoban
Moderator Tag

Recommended Posts

Guest rlhoban

Hi -

 

I'm having trouble with getting a value from a movieclip.

 

A user of the application chooses a color from a color picker and the following code is executed.

 

TweenMax.allTo(targets, 0, {colorMatrixFilter:{colorize:myColor, amount:1}});

 

Later when the user clicks on the object i would like to set the color picker back to the color that was originally chosen. I am having difficulty getting the value from movieclip.

 

Thank you in advance for you help.

Link to comment
Share on other sites

I think the easiest thing to do would just be to store the color inside the movie clip like so:

 

 

// do something like this when you select the color from the picker
var myColor:uint = 0xff6600;

TweenMax.to(mc, 1, {colorMatrixFilter:{colorize:myColor, amount:1}});
//give the movie clip a dynamic property to remember the color value
mc.customColor = myColor;


//do this to retrieve the color value

function getColor(e:MouseEvent):void{
trace(e.target.customColor);

// -- add code to change the color picker to the color you sampled FROM the movie clip

}

//
mc.addEventListener(MouseEvent.CLICK, getColor);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...