i'm studying Pixel Bender. i have a filter who's parameter i want to tween. as far as i know, in order to tween a pixel bender parameter, i need to tween a number object and assign the tweening number object as the array value for the shader data.
i was convinced the following would work, but it seems that Number class doesn't have a value property, so i don't know what property to use when setting up a new tween for the number object:
import fl.transitions.*;
import fl.transitions.easing.*
var shader:Shader;
var shaderFilter:ShaderFilter;
var motionTween:Tween;
var tweenNumber:Number = new Number(0.0);
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, dataLoaded);
loader.load(new URLRequest("PBFilter.pbj"));
function dataLoaded(e:Event):void
{
loader.removeEventListener(Event.COMPLETE, dataLoaded);
shader = new Shader(e.target.data);
shaderFilter = new ShaderFilter(shader);
flower.filters = [shaderFilter];
motionTween = new Tween(tweenNumber, "value", Bounce.easeOut, 0.0, 100.0, 5, true);
motionTween.addEventListener(TweenEvent.MOTION_CHANGE, updateFilter);
}
function updateFilter(e:TweenEvent):void
{
shader.data.amount.value = [tweenNumber];
myMovieClip.filters = [shaderFilter];
}