PDA

View Full Version : **Change Movie Colour**



The_Vulcan
September 19th, 2003, 11:10 PM
1st....................
is it posssible to change the colour of a movie in the library, the same as you would an instance ?

2nd....................
At the moment I have a site I am working on where I want users to be able to change the colour scheme....

I have a on(press) do function change colour....

however when you go to a different scene it doesn't cary over the new colour....

So I am thinking that I have to set a a var with the colour I have changed to, and call that var at the beging of each scene, does that sound right ?

3rd....................
I wanted a random colour, I thought that if I put the random colour into the function that each time the button is pressed that calls the function the colour would be different, but this is not the case... what is the error in my logic ?


t1 = new Color(_root.t1);

myColorTransform = new Object();

myColorTransform = {ra: random(100) ,ga: random(100) ,ba: random(100) ,aa: '100' };

_root.bb.onPress = function(){

t1.setTransform(myColorTransform);
}

blah-de-blah
September 20th, 2003, 12:34 AM
I dont' really understand question 2, but for question 1...you could export actionscript (right click on the thing in the library and choose linkage. Then give it a name). THis is like the instance name...

And question 3....shouldn't it be t1.setRGB instead setTransform? I'm not too familiar with changing colors but i think it would be setRGB.

The_Vulcan
September 20th, 2003, 01:19 AM
Thanks blah-de-blah

I never thought of the link thing...

As for the setRGB

I was using it on 3D swift objects, in properties when you change the tint RGB, you lose all shading, so you only get a blob of color and it looks crap..

But in advanced, if you change the RGB%, it keeps all its shading and details.. Thats why I used myColorTransform = new Object();

Also, setRGB takes #ff ff ff and I am didn't want to figure out how to throw numbers at it with the # in the road.

The_Vulcan
September 20th, 2003, 01:26 AM
Sorry, I went to the library and set the linkage to export for actionscript and gave it the identifier of "xxx"

However it doesn't work, do you know why ?



xxx = new Color(xxx); // also tried _root.

myColorTransform = new Object();

myColorTransform = {ra: random(100) ,ga: random(100) ,ba: random(100) ,aa: '100' };

_root.bb.onPress = function(){

xxx.setTransform(myColorTransform);
}

Voetsjoeba
September 20th, 2003, 01:37 AM
You have to randomize it again on button press :)


t1 = new Color(_root.t1);
myColorTransform = new Object();
myColorTransform = {ra:random(100), ga:random(100), ba:random(100), aa:'100'};
_root.bb.onPress = function() {
myColorTransform = {ra:random(100), ga:random(100), ba:random(100), aa:'100'};
t1.setTransform(myColorTransform);
};

:)

The_Vulcan
September 20th, 2003, 02:20 AM
Thanks that worked...

Do you know how the linkage works so it will change all instances, including ones from different scenes ?

Voetsjoeba
September 20th, 2003, 02:27 AM
I never use Scenes, so I don't really know. I'll look after it :)

The_Vulcan
September 20th, 2003, 02:42 AM
Thanks for any help you can come up with...


How come you do not use scenes ?

Voetsjoeba
September 20th, 2003, 02:46 AM
I don't like them, they can't be handled well enough. I prefer external swfs. But anyways. I tried the scene setup and it didn't work. You don't seem to be able to target movieclip instances in other scenes. (which you can in swfs though ;))

The_Vulcan
September 20th, 2003, 03:03 AM
ok thanks, I have always used scenes..... guess I will look at scaping those now and learn how to use external swfs.

Thanks Voetsjoeba

Voetsjoeba
September 20th, 2003, 03:14 AM
No problem :)