4 Replies Latest reply on Nov 16, 2010 3:49 PM by thestevebelcher

    Why does the pixel bender filter stop working in IE?

    thestevebelcher

      First let me start off by saying I love the pixel bender toolkit.  I wrote a little sepia filter and it works great in the standalone swf player.  Yet,

      when I run the same swf inside of the html page, the filter is not there.  Any ideas? Thanks in advance.

        • 1. Re: Why does the pixel bender filter stop working in IE?
          Kevin Goldsmith Level 3

          Did you embed the PBJ file or do you load it dynamically at runtime?

          • 2. Re: Why does the pixel bender filter stop working in IE?
            thestevebelcher Level 1

            I load it dynamically at run time.

            • 3. Re: Why does the pixel bender filter stop working in IE?
              Kevin Goldsmith Level 3

              This may be a dumb question, but if you step through the code, does it look like the load is succeeding? I've had problems in the past around this, where I was failing to successfully load the file because it wasn't where I expected it to be or because of the security model in the player...

               

                   Kevin

              • 4. Re: Why does the pixel bender filter stop working in IE?
                thestevebelcher Level 1

                This may be a dumber answer, but I'm not sure I know how to step through the code.  I think you've hit on it exactly.  That is what it seems like - it is not getting loaded. All the files are in the same folder and I have allowed full permissions for this folder in the security settings tab.

                Here's some background of the set-up.  This app is for an upcoming traveling road show (similar to Antiques road show). As you exit the exhibit this app will function as a 'guest registry'. The app allows you to take your picture and saves it locally as a jpg and sends it to the email address entered.  So, everything is running off the localhost.  I can see now how the swf can't load the pbj file through the html wrapper.  I actually don't even want the html since I am running everything local. Yet, the only way I've found to save the caputured data to the local hard drive was through the as3corelib JPGEncoder class.

                 

                Currently I have this for my filter:

                 

                var urlRequest:URLRequest = new URLRequest("sepiaFilter.pbj");
                var urlLoader:URLLoader = new URLLoader();
                urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
                urlLoader.addEventListener( Event.COMPLETE, applyFilter );
                urlLoader.load(urlRequest);

                function applyFilter(event:Event):void

                {
                    urlLoader.removeEventListener( Event.COMPLETE, applyFilter );
                    var shader:Shader = new Shader( event.target.data );
                    var shaderFilter:ShaderFilter = new ShaderFilter( shader );
                Object(this).dataEntryMc.videoMc.filters = [ shaderFilter ];
                }

                 

                ...and this to save the captured data:

                 

                import flash.display.Sprite;
                import flash.events.MouseEvent;
                import com.adobe.images.JPGEncoder;

                var serverPath:String = "http://localhost/projects/civilWarRoadShow/";
                function createJPG(m:MovieClip, q:Number, fileName:String)
                {
                var jpgSource:BitmapData = new BitmapData (m.width/1.88, m.height*1.08);
                jpgSource.draw(m.parent, new Matrix(1, 0, 0, 1, -m.x*1.633, -m.y*1.12));
                var jpgEncoder:JPGEncoder = new JPGEncoder(q);
                var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

                var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");

                var jpgURLRequest:URLRequest = new URLRequest ( serverPath+"jpg_encoder_download.php?name=" + fileName); 
                jpgURLRequest.requestHeaders.push(header);   
                jpgURLRequest.method = URLRequestMethod.POST;   
                jpgURLRequest.data = jpgStream;

                var jpgURLLoader:URLLoader = new URLLoader();
                //jpgURLLoader.load(jpgURLRequest); 
                navigateToURL(jpgURLRequest, "_blank");
                }

                Should I download the Flex SDK and compile my code to embed the PBJ file? Or is there a more elegant solution.Thanks again.