Alex, we already know more often than not, your the one who is going to
answer.

I was not having a problem in this question, I was asking your opinion.

I can tell when you are very busy because our questions have to be much more
detailed when your more busy and I think you must be very busy right now.  

So, I am combining a question now with also asking your opinion.

I am loading a jpg image which is a texture I will use to map onto a 3D
image.  And here is my code which I am loading two different images for a
barn.   I am asking your opinion if you think this is a good way to load
multiple images.  Also, I got this code from an example.  As you can see,
the code uses a URLLoader to load the binary data and then the Loader is
converting that Binary data into an image.  My original question in a
previous message was "Is the URLLoader really needed here?"  I am guessing
the person who gave the example used the URLLoader and then the Loader
because they are doing this over the web which also works on a local
machine.  I am guessing the Loader would not work over the web.  So I am
asking someone who knows this stuff really well your opinion on best
practices.

Also, a little about me, I live in a Horse Trailer.  I am poor and I do not
work for anyone.  My horse trailer is parked in a farmers field out in the
country.  So I do not have people to talk to.  I code to pass time.  Also,
sometimes, I cant afford my cell phone which is how I access the Internet
and during those times, I have no way to look up information.  So when I get
cell phone service, I have questions.  I try to google first but if I am not
finding answers then I ask.  When it comes to Flex and Actionscript, your
the guy I ask.

                                loaders = new Dictionary();
                                images = new Dictionary();
                                var urlLoader:URLLoader = new URLLoader();
                                urlLoader.addEventListener(Event.COMPLETE,
group1_urlLoaderCompleteHandler);
                                urlLoader.dataFormat = 
URLLoaderDataFormat.BINARY;
                                urlLoader.load(new 
URLRequest(defaultRoofColorURL));
                                loaders[urlLoader] = "Roof";
                                urlLoader = new URLLoader();
                                urlLoader.addEventListener(Event.COMPLETE,
group1_urlLoaderCompleteHandler);
                                urlLoader.dataFormat = 
URLLoaderDataFormat.BINARY;
                                urlLoader.load(new URLRequest(defaultColorURL));
                                loaders[urlLoader] = "Sides";


                        private function 
group1_urlLoaderCompleteHandler(e:Event):void
                        {
                                var bytes:ByteArray = URLLoader(e.target).data;
                                var loader:Loader = new Loader();
                                
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
group1_LoaderCompleteHandler);
                                loader.loadBytes(bytes);
                                loaders[loader.contentLoaderInfo] = 
loaders[e.target];
                                delete loaders[e.target];
                        }
                        
                        private function 
group1_LoaderCompleteHandler(e:Event):void
                        {
                                images[loaders[e.target]] = e.target.content;
                                delete loaders[e.target];
                                
                                if (images["Sides"])
                                {
                                        var sbm:Bitmap = images["Sides"];
                                        imagePanel.barn.panelTexture = 
[sbm.bitmapData];
                                }
                                if (images["Roof"])
                                {
                                        var rbm:Bitmap = images["Roof"];
                                        imagePanel.barn.roofTexture = 
[rbm.bitmapData];
                                }
                                if (images["Sides"] && images["Roof"])
                                {
                                        imagePanel.createBarn();
                                }
                        }
                        




--
View this message in context: 
http://apache-flex-users.2333346.n4.nabble.com/Loading-Multiple-images-tp13414p13437.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply via email to