check if files exist on server?

2920
29
09-06-2010 05:01 AM
NatashaManzuiga
Regular Contributor
Hi, how can I test if an image files exist on server in Flex 3.0?

Thanks in advance
Tags (2)
0 Kudos
29 Replies
RobertScheitlin__GISP
MVP Emeritus
Natty,

    Try something like this:
loader.contentLoaderInfo.addEventListener(IOErrorE vent.IO_ERROR, imgLoadErrorMethod);
0 Kudos
NatashaManzuiga
Regular Contributor
Natty,

    Try something like this:
loader.contentLoaderInfo.addEventListener(IOErrorE vent.IO_ERROR, imgLoadErrorMethod);


Hi Robert!!
Thanks, I tried with the following code:
Now I want to ask u how can I set a value to the MiniSearch widget textbox from the SearchWidget..Can u help me with this?
       
       public function IOErrorEventHandler(imgx:String):void {

          var loader:Loader = new Loader();
          loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete);
          loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
          var request:URLRequest = new URLRequest(imgx);
          loader.load(request);
      }
      private function onComplete (evt : Event) : void
   {
                  infoImage.source = "Images/" + infoData.title + ".jpg";
    infoImage.height = 150;
    infoImage.width = 190;
    infoImage.visible = true;
    infoImage.includeInLayout = true;
   }
      private function ioErrorHandler(event:IOErrorEvent):void {
    infoImage.visible = false;
    infoImage.includeInLayout = false;
      } 
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Natty,

   Can you be a little more specific? Are you wanting to send the image that you got to the MiniSearch or just a string value? I need to have a clear idea of your desired work flow.
0 Kudos
NatashaManzuiga
Regular Contributor
Natty,

   Can you be a little more specific? Are you wanting to send the image that you got to the MiniSearch or just a string value? I need to have a clear idea of your desired work flow.


Hi Robert, just a string value to the MiniSearch widget  :)))

Thanks,

Naty
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Naty,

   OK I need just a little bit more. Remind me you put the MiniSearch in your Index.mxml right? Does the MiniSearch have an id attribute and if so what is it? Basically we will have to get a reference to the MiniSearch throught the SearchWidget using parrentApplication and then using the id of the minisearch and the id of the textInput.
0 Kudos
NatashaManzuiga
Regular Contributor
Naty,

   OK I need just a little bit more. Remind me you put the MiniSearch in your Index.mxml right? Does the MiniSearch have an id attribute and if so what is it? Basically we will have to get a reference to the MiniSearch throught the SearchWidget using parrentApplication and then using the id of the minisearch and the id of the textInput.


Robert, yes I put the MiniSearch in my index.html
how can I get the Id?
Thanks,

Naty
<SiteContainer id="container">
    <configManager> <ConfigManager/> </configManager>
       <uiManager>     <UIManager/>     </uiManager>
       <controller>    <Controller x="20" y="20"/>    </controller>
       <dataManager>   <DataManager/>   </dataManager>
       <widgetManager> <WidgetManagerDocked/> </widgetManager>
       <mapManager>  <MapManager/> </mapManager>
</SiteContainer>
<widgets:MiniSearch x="20" y="420" />
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Naty,

   Add an id to the minisearch like so:
<widgets:MiniSearch id="miniSearch" top ="120" left="50"/>

   then you need to do call this from where ever
this.parentApplication.miniSearch.ti.text = "hello";
0 Kudos
NatashaManzuiga
Regular Contributor
Naty,

   Add an id to the minisearch like so:
<widgets:MiniSearch id="miniSearch" top ="120" left="50"/>

   then you need to do call this from where ever
this.parentApplication.miniSearch.ti.text = "hello";


Thank u so much Robert it fixes my problem!!
I read a XML to populate a combobox inside my MiniSearch...now I wish I could select a value from a click...Is it possible?

Thanks,
Naty
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Naty,

   Sure it's possible can you post your MiniSearch.mxml?
0 Kudos