check if files exist on server?

2925
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
NatashaManzuiga
Regular Contributor
I sent u the Minisearch and the XML source 🙂 I wish I could select building and plan passing @dgn value...
Thank u soooooo much,
Naty

Naty,

   Sure it's possible can you post your MiniSearch.mxml?
0 Kudos
NatashaManzuiga
Regular Contributor
I wish I could select building and plan passing @dgn value..
I sent u the Minisearch and the XML source 🙂 I wish I could select building and plan passing @dgn value...
Thank u soooooo much,
Naty
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Naty,

   Hmm... Explain to me the desired work flow?

Right now even your xml is malformed...

Should look like this
<?xml version="1.0" encoding="utf-8"?>
<Buildings>
    <Building name='1'>
        <Plan code='P1' dgn='1p1.dgn'/>
        <Plan code='PT' dgn='1pt.dgn'/>
        <Plan code='S1' dgn='1s1.dgn'/>
     </Building>
    <Building name='11O'>
        <Plan code='PT' dgn='11opt.dgn'/>
        <Plan code='S1' dgn='11os1.dgn'/>
    </Building>
</Buildings>
NOT
 <Plan code='S1' dgn='11os1.dgn'/Plan>
0 Kudos
NatashaManzuiga
Regular Contributor
Robert, yes u are right!!
Sorry I sent u the first version of my XML and u have to replace "/Plan" with "/" but u know this.
What I want to do is that after I performed a query from SearchWidget I obtain RecordData as result....when I click one record I stored a variable named DGN that is the same of these related combobox...so it should work like this: I click the record I pass the DGN value and this set the corresponding Building and Plan in this minisearch widget. like to show where I am 🙂
I hope I m clear now. 🙂
Naty

Naty,

   Hmm... Explain to me the desired work flow?

Right now even your xml is malformed...

Should look like this
<?xml version="1.0" encoding="utf-8"?>
<Buildings>
    <Building name='1'>
        <Plan code='P1' dgn='1p1.dgn'/>
        <Plan code='PT' dgn='1pt.dgn'/>
        <Plan code='S1' dgn='1s1.dgn'/>
     </Building>
    <Building name='11O'>
        <Plan code='PT' dgn='11opt.dgn'/>
        <Plan code='S1' dgn='11os1.dgn'/>
    </Building>
</Buildings>
NOT
 <Plan code='S1' dgn='11os1.dgn'/Plan>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Naty,

   Took me a little while to find the time but here is the solution.

this.parentApplication.miniSearch.Building.selectedItem = this.parentApplication.miniSearch.dp.Building.Plan.(@dgn == "1pt.dgn").parent();
    this.parentApplication.miniSearch.Plan.selectedItem = this.parentApplication.miniSearch.dp.Building.Plan.(@dgn == "1pt.dgn");
0 Kudos
NatashaManzuiga
Regular Contributor
Naty,

   Took me a little while to find the time but here is the solution.

this.parentApplication.miniSearch.Building.selectedItem = this.parentApplication.miniSearch.dp.Building.Plan.(@dgn == "1pt.dgn").parent();
    this.parentApplication.miniSearch.Plan.selectedItem = this.parentApplication.miniSearch.dp.Building.Plan.(@dgn == "1pt.dgn");


Thanks so much Robert!!
I still have refresh problem with the dependent combobox...Plan..
Sometimes if I dont run two times this code...it doesnt work :confused:

Naty
0 Kudos
NatashaManzuiga
Regular Contributor
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;
      } 

Hi Robert,

It doesnt work with PDF... :((((
Can u help me?

Thanks

Naty
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Naty,

   What doesn't work? What are you trying to do? What does your code changes look like when you try to make this work for pdfs? This was a while ago that I help you with this and I am not even sure what you were doing here...
0 Kudos
NatashaManzuiga
Regular Contributor
Naty,

   What doesn't work? What are you trying to do? What does your code changes look like when you try to make this work for pdfs? This was a while ago that I help you with this and I am not even sure what you were doing here...


Hi Robert.
I can perfectly check if there is a .jpg file in my server. I m so thankful to u about this!
I want to use the same code that u see below to test if there is a PDF file or not but it doesnt work 😞
Naty

      
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
   {
    var nameBuilding:String = Building1.selectedItem.@dgn;
    nameBuilding="CleanPrintA4/" + nameBuilding.toString().substr(0,nameBuilding.length-4) + ".pdf";
    var u:URLRequest = new URLRequest(nameBuilding);
    navigateToURL(u, "_blank");
   }
      private function ioErrorHandler(event:IOErrorEvent):void {
 
      }
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Naty,

   With the code you just posted you are attempting to load a PDF file into an image control which is not supported. There is no PDF viewer component in Flex by default.
0 Kudos