Skip to main content
Inspiring
April 9, 2007
Question

how to setup a Desaturation Tween

  • April 9, 2007
  • 48 replies
  • 4046 views
Hi just a quick question, i have a function to swap depths and tween the _alpha property of some movie clips, ---=> Thanx kglad <=--- but i was wondering if theres a way to change the color property without filters??
im especially interested in the Saturation / De-Saturation for this idea i have.

or do i need to use import flash.filters to do this?

if this is the only way, i dont think it will be worth it, unless creating a function for it is simple.

Thanx in advance.
This topic has been closed for replies.

48 replies

kglad
Community Expert
Community Expert
April 12, 2007
ahh, well that wasn't the most clever manuever. but i can also say that i've had more than my share of rock-head errors.

you need to remove the dotted line. that's not bonafide actionscript. that will stop the error message.

and the movieclip.prototype code should be place before any code that uses the prototype.
SketchstaAuthor
Inspiring
April 12, 2007
ohh damn it.... the error was because i didnt remove the dotted line... =(
i knoew i was doing something stupid.

but im still not getting anything happening tho..

Im gonna mess aound with it abit more.
I bet im doing something stupid again..
kglad
Community Expert
Community Expert
April 12, 2007
send me a link to your fla that results in that error message.
SketchstaAuthor
Inspiring
April 12, 2007
all it is, is a rectangle movieClip on _root, and on another layer i have the code.

the movieClip has an instance name of mc2

Heres the FLA

Im doing something stupid aren't i???
SketchstaAuthor
Inspiring
April 12, 2007
WOW.. with this code i dont think i'll even need the _alpha Tween you helped with before...

How did you get so AS smart?? tell me your secret dude.. was it something you eat?? maybe drink??

I wish i could just download your AS knowledge...even at dialup speed, i'll wait the 2 full months to get all the knowledge you have, i dont care.. =P

but anyway, im getting an error from line 4.
I dont know what the assignment operator is, my best guess would be that MovieClip needs to be changed somehow..

the error code is...

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 4: Left side of assignment operator must be variable or property.
MovieClip.prototype.colorFadeF = function(rgb1, a1, rgb2, a2, speed, steps) {

SketchstaAuthor
Inspiring
April 11, 2007
Hmm... this means i've had it right for a while now.. except for the clearInterval() part..

when i was clearing the interval, i was clearing it from ( r ) because i was seeing it as one big 6 digit number.
i wasnt looking at it as 3 separate 2 digit numbers.. but this makes sence tho.

im calling to this function the same time im calling the swapDepths() and alpha tween, which makes this transition quite slow, so i changed the incrementation from 01 to 10.
makes it abit harder to hit the target max number, but it's nice n fast now.

now comes my next part...have to make this run in reverse
( i know, i know....i want too much..) but hey..thats what a designer does right? =)

this would be a good place to have this as one of those functions where you can specify the params for it.. I might look into that before trying to write this in reverse.

wish me luck =P
and thanx again..=)
kglad
Community Expert
Community Expert
April 11, 2007
the code below the dotted line allows you to fade any movieclip from a color of rgb1 and alpha of a1 to a color of rgb2 and alpha of a2 in speed seconds using any number of steps. to apply to a movieclip mc2:



kglad
Community Expert
Community Expert
April 11, 2007
you're welcome sketchsta. and congrats on the semis!!!
SketchstaAuthor
Inspiring
April 11, 2007
Hey kglad, i've been messing around with the setInterval() version of your code, and I came up with this.. ( Is this kinda the same as the code you gave me first, with the Array?? )

anyway, it doesnt work exactly as i hoped.
I tried ALOT of variations, some of which make no sense...but i tried anyway, and still didnt get it right. =)

Is there a way to set the MAX each (r, g, b) can go to?
as you can see at the bottom, i tried to cheat...but to no avail..

is there any hope for my modified version of your code, or did i just waste afew hours for nothing?
kglad
Community Expert
Community Expert
April 11, 2007
try:

SketchstaAuthor
Inspiring
April 11, 2007
I marked this as the answer because everything KGLAD said is the answer, but with different techniques.

So... read it. =)
SketchstaAuthor
Inspiring
April 11, 2007
Thanx kglad.
and Yes, trying to learn alot of things at one time is disastrous to my brain. =)

I learn AS according to what ideas i get for websites. and alot of times i come here to ask how, and if theres better ways of doing it.
I guess thats why i dont know anything about Arrays, Loading from XML, external as files, creating variables, etc.. because all i can think about is how to do it in the Actions Pannel. =)

I gave up learning almost everything else except Actionscript. I see too many things that AS can do, and i LOVE it.
and this forum is the biggest help. Especially since stupid Australia doesnt sell AS2.0 books. No store around my area sells them.

Ohh by the way, if you're a Manchester Utd fan... we won this morning against Roma, 6 - 1
We're in the Semi's =)

anyway, back to work.. gonna finish this navigation transitions, and get started on the pages.
Thanx again kglad, always the AS Genius! =)
kglad
Community Expert
Community Expert
April 10, 2007
no, go for it. noone offers help here and expects their revealed techniques to be proprietary.

like everything else, there should be no rush to learn everything. learn what you can and keep trying. even if you can only learn a little at any one time, if you stick with something long enough, you'll become an expert.
SketchstaAuthor
Inspiring
April 10, 2007
hmm... i think i understand it now. I can follow along when i read it. But i will need alot of practice on this before i would be able to make another function like yours.

Im slowly starting to write bigger and fairly complex ( complex for me ) functions, so i think i will have to make the most of creating variables like you do. The problem is, im not fluent enough in AS yet to think ahead.

thanx for the info on setInterval(), i just found it.
theres abit to read and try on there, so it's gonna have to wait abit, while im learning tweens, and trying to adopt your methods of writing functions.
hope you dont mind. =P