Here is an example of the embed that works but only if I put my hard code my
images rather than loading them from a list.

                [Embed("../panels/OceanBluePanel.jpg")]
                private static const OCEANBLUEPANEL:Class;

                this.panelTexture = [new OCEANBLUEPANEL().bitmapData];


Here is where Texture is being used
                        graphics.clear();
                        //draw
                        for (i = 0; i < len; i++) {
                                graphics.beginFill(colors[i]);
                                graphics.drawTriangles(vertices, indices[i], 
null,
TriangleCulling.NEGATIVE);
                                graphics.endFill();
                                graphics.beginBitmapFill(texture[i], null, 
true, true);
                                graphics.drawTriangles(vertices, indices[i], 
uvt[i],
TriangleCulling.NEGATIVE);
                        }
                        //finish
                        graphics.endFill();
                        //set distance for depth sorting
                        distance = position.z;



Now, here is the loader code I currently have which I get the null reference
error.
This Loader was the most elaborate of the loaders I tried

                        private function ldr_CompleteHandler(e:Event):void
                        {
                                bmd = Bitmap(e.target.content).bitmapData;
                                this.panelTexture = [new 
LoadedImageClass().bitmapData];
                        }

                        private function urlldr_CompleteHandler(e:Event):void
                        {
                                var bytes:ByteArray = URLLoader(e.target).data;
                                var loader:Loader = new Loader();
                                
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
ldr_CompleteHandler);
                                loader.loadBytes(bytes);
                        }
                        
                        private function ldr_ErrorHandler(e:Event):void
                        {
                                Alert.show("There has been an error Loading 
Image");
                        }
                        

//                              var url:String = "panels/BrownPanel.jpg";
/*                              var urlLoader:URLLoader = new URLLoader();
                                var urlRequest:URLRequest = new URLRequest(url);
                                urlLoader.addEventListener(Event.COMPLETE, 
urlldr_CompleteHandler);
                                urlLoader.dataFormat = 
URLLoaderDataFormat.BINARY;
                                urlLoader.load(urlRequest);
*/                              





--
View this message in context: 
http://apache-flex-users.2333346.n4.nabble.com/Loading-JPG-bitmapdata-Something-like-Embed-but-at-runtime-tp13402p13412.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply via email to