Advanced Snow Effects

Hey Guys,

I’ve been roaming around here for awhile now and I’m finally settling in to get some serious learning underway with Flash and AS3. My first endeavor is for a personal website.

I’ve taken apart the code on the AS3 demo of the snow effect demonstrated here on Kirupa (much thanks for that) and I’ve tinkered with it to get some of the effects I’m after. However, because of my novice skill level, I’ve had some trouble even recognizing ways to accomplish what I’m after. Let me get a run down here of what I’d like to do and ways that I’ve thought of to accomplish this.

The objective here is to have snow passing by glowing lamp. More precisely, I want the snow to increase in brightness as it approachs the lamp and decrease as it moves away, but within the confines of the circle of light. Also, I’d like the snow to change from white to yellow in the process, and then back again and eventually to a dark blue.

I’ve been able to change the movie clip from the standard white of my drawn snowflake to dark blue, then to yellow, then back via color transformation. Here’s the code that I got for that, which works successfully:

[COLOR=Red]this.addEventListener(Event.ENTER_FRAME, SnowGlow);[/COLOR]

[COLOR=Red]function SnowGlow(e:Event) {[/COLOR]

[COLOR=Red] var firstColor:ColorTransform=this.transform.colorTransform;[/COLOR]
[COLOR=Red] firstColor.color=0xFFFFFF;[/COLOR]
[COLOR=Red] this.transform.colorTransform=firstColor;[/COLOR]

[COLOR=Red] var secondColor:ColorTransform=this.transform.colorTransform;[/COLOR]
[COLOR=Red] secondColor.color=0xFFFF99;[/COLOR]
[COLOR=Red] this.transform.colorTransform=secondColor;[/COLOR]

[COLOR=Red] var thirdColor:ColorTransform=this.transform.colorTransform;[/COLOR]
[COLOR=Red] thirdColor.color=000066;[/COLOR]
[COLOR=Red] this.transform.colorTransform=thirdColor;[/COLOR]

[COLOR=Red] if (this.x < 400){[/COLOR]
[COLOR=Red] this.transform.colorTransform=firstColor;[/COLOR]
[COLOR=Red] }[/COLOR]
[COLOR=Red] if (this.x > 375) {[/COLOR]
[COLOR=Red] this.transform.colorTransform=secondColor;[/COLOR]
[COLOR=Red] this.scaleX=1.4scale;[/COLOR]
[COLOR=Red] this.scaleY=1.4
scale;[/COLOR]
[COLOR=Red] }[/COLOR]
[COLOR=Red] if (this.x < 350){[/COLOR]
[COLOR=Red] this.transform.colorTransform=thirdColor;[/COLOR]
[COLOR=Red] this.scaleX=1scale;[/COLOR]
[COLOR=Red] this.scaleY=1
scale;[/COLOR]
[COLOR=Red] }[/COLOR]
[COLOR=Red] if (this.y < 150){[/COLOR]
[COLOR=Red] this.transform.colorTransform=thirdColor;[/COLOR]
[COLOR=Red] }[/COLOR]
[COLOR=Red] if (this.y > 450){[/COLOR]
[COLOR=Red] this.transform.colorTransform=thirdColor;[/COLOR]
[COLOR=Red] }[/COLOR]
[COLOR=YellowGreen][COLOR=Red] }[/COLOR][/COLOR]
[COLOR=YellowGreen][COLOR=Black]This hasn’t been entirely to my liking, however, since the bounds are very obvious, very restricting, and very time consuming to set up. What I’d like to do is programmatically change the color, so as to have a smooth transition. Also, this code only allows for a box in which the color changes (by way of the borders established in the if conditionals). Like I’ve mentioned, I’d like to make this a circle.

Here are my questions so as to reach my goal:

[/COLOR][/COLOR]
[LIST=1]
[]Can I create a circle “space” that when the dynamic snowflake objects pass into it they light up?
[
]Can the snowflakes gradually change color and brightness with scripting?
[]Can I use a movieclip gradient that the snow passes through that would overlay its color onto the snow while making the gradient movieclip invisible in the final SWF? This would mean that I could color all the snow dark blue and have the moveclip gradient do the work. At present, obviously, the snowflakes are lost behind the gradient movieclip.
[
]Is there a way to tell the snowflakes to disappear, or remove themselves, at a certain point in the stage? I’ve looked into removeChild, but I’ve had little success.
[/LIST]
That’s about the extent to which I can describe my issue right now. I’ve just gotten into AS3 in the last two days, so I apologize that I’m a little slow here. Thanks for your help guys, and I appreciate all the help this site supplies. I’m looking forward to getting to know the community here as time wears on.

Thanks Again,

Like A Lion