Sign in to follow this  
j_rock

Color change fla [SOLVED]

Recommended Posts

in releation to my last post about changing the color value of a selected movice clip with the transfom manager AS2

 

a button births a mc on2 the stage , when this mc is clicked the transfom manager is applyed

 

can anyone look at this code and tell me where i am going wrong

I cant seem to get the code to work to change the colour value of the last selected movie clip the tranform manager was applied to (var t) to

change from the default black to white when the button is clicked

 

 

 

stop();

 

 

 

import gs.TransformManager;

 

 

 

var NumInc:Number = 0;

var home:MovieClip = this;

var selectedClip:MovieClip

 

function buildIt(movieType:String) {

var t = home.attachMovie(movieType, "movie_mc"+NumInc, getNextHighestDepth(), {_x:232.8, _y:419.1});

var transformManager_obj = new TransformManager({forceSelectionToFront:false, allowDelete:true});

var transformManager_obj = new TransformManager({targetObjects:[t], bounds:{xMin:0, xMax:900, yMin:0, yMax:900}, forceSelectionToFront:true, eventHandler:onAnyEvent});

selectedClip = this["movie_mc"+NumInc]

++NumInc;

}

 

 

 

 

btn1_btn.onPress = function() {

buildIt("movietrib");

};

 

 

 

 

btn2_btn.onPress = function() {

buildIt("movietrib1");

};

 

 

 

color_btn.onPress = function() {

Color.prototype.setTint(255, 255, 255, 100)

//var colorful = new Color();

//colorful.setRGB(0xFFFFFF);

selectedClip.setTransform(colorful);

};

 

Color.prototype.setTint = function (r, g, b, amount) {

var percent = 100 - amount;

var trans = new Object();

trans.ra = trans.ga = trans.ba = percent;

var ratio = amount / 100;

trans.rb = r * ratio;

trans.gb = g * ratio;

trans.bb = b * ratio;

selectedClip.setTransform(trans);

}//

 

 

Can anyone help?

im really stumped

Share this post


Link to post
Share on other sites

Hi j_rock ;)

 

I think the problem is that you don't use the good tool to transfom the color of a MovieClip ;)

Why did you don't use TweenMax :mrgreen: ? It's easier ;)

 

Here is a sample and simple code that show you how to do it ;)

http://www.ynicos.com/examples/colorChange.swf

 

The .fla

http://www.ynicos.com/examples/colorChange.fla

 

 

If you really don't want to use one of the multiple way to change color with TweenMax, use the flash.geom.ColorTransform class,

Adobe : "The Color class has been deprecated in favor of the flash.geom.ColorTransform class".

 

See

http://help.adobe.com/en_US/AS2LCR/Flash_10.0/00000919.html#202260

 

Hope i help you ;)

Share this post


Link to post
Share on other sites

hi

 

thanks for your reply

but i dont think im able to use tween max

i had a look an i cant figure out hoe to hust use the alpha tint and remove tint

 

i'll try the othe link u posted

 

i think this if a futile effort on my behalf ill prpb just do without this function

 

again thanks for the effort

j

Share this post


Link to post
Share on other sites

Everybody are abble to use TweenMax, cause it's really easy :)

 

If you don't understand how you can use something just ask your question ;)

 

It's simple to manage color with TweenMax, trust me :) .

Change the tint of a MovieClip like that.

if a have a MovieClip called "myObject" and his color is black, i can tint it to white like this :

 


TweenMax.to(myObject,1,{tint:0xFFFFFF});

 

If you want to remove the tint of a tinted object like "myObject", just do:

 


TweenMax.to(myObject,1,{removeTint:true});

 

it will set the tint at "myObject" to his original : black ;)

 

 

 

 

Say me what you whant to do exacly and simply ;)

Share this post


Link to post
Share on other sites

i see waht u are saying but how does the code work for a button?

 

have a look at the swf in the folder here u will see what i am trying to achive

its prob easier than me trying to explain :) :)

 

again thank you for your time trying to help

 

j

Share this post


Link to post
Share on other sites

Hi j_rock ;)

 

Check this .fla ;)

If you don't understand something, just ask.

 

// When you use getNextHighestDepth(), you have to refer it to an object where the next highest depth will be evaluate

// like this.getNextHighestDepth() or home.getNextHighestDepth()

// getNextHighestDepth() alone will not work i think ;)

 

// When you do

// var transformManager_obj = new TransformManager({forceSelectionToFront:false, allowDelete:true});

// var transformManager_obj = new TransformManager({targetObjects:[t], bounds:{xMin:0, xMax:900, yMin:0, yMax:900}, forceSelectionToFront:true, eventHandler:onAnyEvent});

 

// the next var applied to "transformManager_obj" will overwrite all previous property you set in the first instantiation

// Declar your vars at one in a function like

// var transformManager_obj = new TransformManager({forceSelectionToFront:false, allowDelete:true});

// transformManager_obj = new TransformManager({targetObjects:[t], bounds:{xMin:0, xMax:900, yMin:0, yMax:900}, forceSelectionToFront:true, eventHandler:onAnyEvent});

 

 

Hope it help you :)

Share this post


Link to post
Share on other sites

HI

 

yes i get it now thank you so much for your help

your detailed comment are really helpful and insightful and easy to understand

 

 

again thanks ever so much for your time

 

your a legend

 

j_rock

Share this post


Link to post
Share on other sites

:D Thanks

 

In the .fla, i missed something.

 

Add :

var isGroupSelected:Boolean = false;

 

Near var currentSelectedObj....

 

;)

Share this post


Link to post
Share on other sites

Take this file under the post.

The previous don't work good for a group, i missed somes essential things.

 

See you ;)

Share this post


Link to post
Share on other sites

hey

 

k no problem got the updated file

working like a charm

 

cheers

 

j

Share this post


Link to post
Share on other sites

hey

 

here is the new inside mc fla

cheers

 

j

Share this post


Link to post
Share on other sites

her is the inside mc fla

 

it explains what i mean

 

j

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.