AS3 - Shader with Pixel Bender
I'm trying out Pixel Bender but am having an error as follow.
ArgumentError: Error #2004: One of the parameters is invalid.
at flash.display::ShaderData/_setByteCode()
at flash.display::ShaderData()
at flash.display::Shader/set byteCode()
at Distorsion/onLoadComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
The code that I have is
_loader = new URLLoader();
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, onLoadComplete);
_loader.load(new URLRequest( "distorsion.pbj"));
Then this is the code that throws the error
private function onLoadComplete(event:Event):void {
// this line c开发者_C百科aused the error
shader = new Shader(event.target.data);
}
What am I doing wrong?
The pbj file is just some sample file I copied from here http://www.kevingoldsmith.com/labs/PBSynth-v1/sinegenerator2.pbk
Thanks,
Tee
精彩评论