5 Replies Latest reply on Mar 8, 2010 9:18 AM by cyber0897

    image component goes crazy when source cannot be found

    cyber0897 Level 1

      hey guys.. so im not sure if this is a bug, or im doing something wrong... basically i have a webservice, which is called as soon as my application gets initialized, and when i click a button i basically have the program go to a certain location locally to get the image so it can display it.. but i just recently uploaded my application to a server

       

      and i forgot to change the file path... and when i was in the net portion of fire bug, i noticed that it was trying to get the location of the images infinitely.... if that makes any sence...

       


      when i opened the net portion of the firebug i noticed that it could not find over 900 items... and the list kept increasing, looked like it was stuck in an infinite loop

       

      i know for a fact that my program does not load the image infinitely,

       

      i have attached an image of what i see...

       

       

      so im just trying to find out if there is a way i can gracefully terminate the search when the image is not found?Screen shot 2010-02-25 at 3.56.33 PM.png

        • 1. Re: image component goes crazy when source cannot be found
          David_F57 Level 5

          Hi,

           

          Are you using any form of loop around the image retrieval, for instance if you had a loop counter that incremented on load success but once failed will it keep looping becuase the counter doesn't update in the fault routine. ( my first thought).

           

           

          David

          • 2. Re: image component goes crazy when source cannot be found
            cyber0897 Level 1

            well, what i do is basically get all the images from the webservice and assign them to an array collection, and then use the "TileList" component to display all the images

             

            so in my init function i have

            storyService = new StoryHandler();            //<-------- webservice
            storyService.addEventListener(ResultEvent.RESULT, getAllMainImages);
            storyService.GetAllImages(true);
            

             

            private function getAllMainImages(event:ResultEvent):void{
                 for each(var item:Object in event.result){
                      mainImages.addItem(item);
                 }
            }
            

             

            in teh same component, when a button is pressed i popup a window which displays all my main images, so on click of that button i call this function

            public function changeMainImage():void{
                 mainImageSelectWindow = new mainImageSelectionPopup();
                 mainImageSelectWindow = PopUpManager.createPopUp(this, mainImageSelectionPopup, true) as mainImageSelectionPopup;
                 mainImageSelectWindow["imageList"].dataProvider = mainImages;
                 
                 mainImageSelectWindow["change"].addEventListener(MouseEvent.MOUSE_DOWN, completeMainImageChange);
                 
                 PopUpManager.centerPopUp(mainImageSelectWindow);
            }
            

             

             

            and finally my mainImageSelectionPopup file contains just a "tilelist" component with an item renderer...

            <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx" width="500" height="500" close="titleWindowClose(event)">
                 ....
                      ....
                           ....     
                 <s:VGroup width="100%" height="100%">
                      <mx:TileList id="imageList" columnWidth="135" rowHeight="135" width="100%" height="100%">
                           <mx:itemRenderer>
                                <fx:Component>
                                     <mx:VBox>
                                          <mx:Image source="/Desktop/story handler images/{data.FileName}" />
                                     </mx:VBox>
                                </fx:Component>
                           </mx:itemRenderer>
                      </mx:TileList>
                      <s:Button id="change" label="Change" />
                 </s:VGroup>
            
            </s:TitleWindow>
            

             

             

            the errors you see in my firebug start as soon as i click on my button....

            so as you can see, i dont use any loops... but maybe you have an insite on why its doing that..

             

            i know that the path for the image is wrong, but shouldn't it just exit gracefully once it discovers an incorrect source?

             

            after doing some research, i found out that apparent the image component will start searching all the swffiles linked to this application for that path or that image, i was wondering if its doing that in this case... if so, how do i make it stop doing that??

            • 3. Re: image component goes crazy when source cannot be found
              Flex harUI Adobe Employee

              Put a breakpoint on SWFLoader.as:load() and see who's calling it, how many

              times, and why.

              • 4. Re: image component goes crazy when source cannot be found
                cyber0897 Level 1

                umm...where exactly can i find the swfloader.as file?? and how do i debug that file when its on the server??