Jump to content
Search Community

shanethehat

Members
  • Posts

    2
  • Joined

  • Last visited

shanethehat's Achievements

0

Reputation

  1. Thanks for the reply. It does seem to happen on all the machines I've tested on, I guess I'll just have to do it differently.
  2. Hi, I'm trying to change the tint on a sprite in a loop. This works fine, but when I place another sprite at a higher depth that contains a gradient, the tint animation flickers. Any idea why, or how to prevent it? package { import com.greensock.plugins.TintPlugin; import com.greensock.plugins.TweenPlugin; import com.greensock.TweenLite; import flash.geom.Matrix; import flash.display.GradientType; import flash.events.Event; import flash.display.Sprite; public class Background extends Sprite { private var colorClip :Sprite; private var gradClip :Sprite; private var nextColor :int = 1; private var colors :Array = new Array(0xff0000, 0x00ff00, 0x0000ff ); public function Background():void { TweenPlugin.activate([TintPlugin]); if(stage) { init(); } else { addEventListener(Event.ADDED_TO_STAGE,init); } } private function init(evt:Event = null):void { colorClip = addChild(new Sprite()) as Sprite; colorClip.graphics.beginFill(colors[0]); colorClip.graphics.drawRect(0,0,654,274); var mat:Matrix = new Matrix(); mat.createGradientBox(654,274,toRad(-90)); gradClip = addChild(new Sprite()) as Sprite; gradClip.graphics.beginGradientFill(GradientType.LINEAR, [0x000000,0x000000], [.7,0], [0,255],mat); gradClip.graphics.drawRect(0,0,654,274); gradClip.cacheAsBitmap = true; startColorTimer(); } private function startColorTimer():void { TweenLite.delayedCall(4,changeColor); } public function changeColor():void { TweenLite.killTweensOf(changeColor); TweenLite.to(colorClip,1,{tint:colors[nextColor],onComplete:startColorTimer}); (nextColor+1 < colors.length)?nextColor++:nextColor=0; } private function toRad(a:Number):Number { return a*Math.PI/180; } } }
×
×
  • Create New...