0 Replies Latest reply on Nov 22, 2006 8:36 PM by ParomitaDey15

    Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error

    ParomitaDey15
      Hi Everybody,

      I checked through the previous messages on Error # - 2038 and unfortunately none of them solved my problem so I am back with same troublesome error - 2038 File I/O error.

      I am working in an application, where the user may doubleclick on an image and download the file. The images are presented in a gallery format using a tilelist control where the images are displayed with itemrenderer mxml component. On doubleClick event we call a method which takes the filepath and the filename and we are using FileReference and URLRequest objects to perform the download operation.
      The application opens the browse dialog box but when we click on the Save button it is showing an error. We have used the download method in a separate application where it worked fine. Please advise as to why we are getting a File I/O error and what additional do we need to do to stop this error. The file path takes a java servelet path to the server and the servelet is working independently I have tested that by running it directly from the browser window also from a separate jsp file.

      Can any one help me understand why we get this error. There isn't any explanation on the runtime error list under the flex documentation and I am completely clueless as the same code works perfectly fine on a separate application. I am pasting the a related code snippet for reference.

      Code snippet

      DAMData.as
      import flash.net.URLRequest;
      import flash.net.FileReference;
      import mx.controls.Alert;

      private var fileref:FileReference = new FileReference();
      private var urlval:URLRequest;
      private function DownloadAssetFile(pUrl:String,filename:String):void{
      urlval = new URLRequest(pUrl);
      fileref.download(urlval,filename);
      }

      The mxml portion is a mxml component which has a Tilelist control where the images are displayed through an itemrenderer. The DownloadAssetFile method is called from the itemrenderer component of the tilelist..

      DAThumbnailView Component

      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%">

      <mx:Script>
      <![CDATA[
      import mx.core.Application;
      import mx.controls.Alert;
      import mx.collections.ArrayCollection;
      import com.xpflow.aam.model.catalog.*;
      import com.xpflow.model.Model;

      [Bindable]public var model:Model = Model.getInstance();
      public var FilterArrayVal:Array = new Array();

      [Bindable]private var selectedPhoto:Asset;

      public var _gallery:AssetGallery;

      public function get gallery():AssetGallery{
      return _gallery;
      }

      [Bindable]
      public function set gallery(c:AssetGallery):void{
      _gallery = c;
      }

      public var AssetnamVal123:String = new String();
      public function GetOptions():void{
      if(gallery.selected < 0){
      model.catalog.catalogOptionsVisible = false;
      return;
      }
      if(AssetnamVal123 == "null"){
      //Do Nothing
      }else{
      model.catalog.catalogOptionsVisible = true;
      }
      }
      ]]>
      </mx:Script>

      <mx:TileList id="DAThumbNailList"
      width="100%" height="100%" rowHeight="120" columnWidth="110"
      itemRenderer="com.xpflow.aam.view.catalog.DAThumbNailRenderer"
      dataProvider="{gallery.assets}"
      borderStyle="none" styleName="genDASelectionStyle"
      itemClick="GetOptions();"
      creationComplete="setSelectedIndexVal();"
      verticalAlign="top"
      horizontalScrollPolicy="auto"
      verticalScrollPolicy="auto"/>
      </mx:VBox>

      DAThumbnailRenderer component

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml"
      horizontalAlign="center"
      verticalScrollPolicy="off"
      horizontalScrollPolicy="off" verticalAlign="top" verticalGap="1"
      click="CheckAssetName();"
      mouseOver="createAssetToolTip(event);"
      mouseOut="destroyAssetToolTip(event);">

      <mx:Script source="../../../common/DAMData.as"/>
      <mx:Script source="../../../common/FormatVersionNumberScript.as"/>
      <mx:Script>
      <![CDATA[

      import mx.controls.ToolTip;
      import mx.managers.ToolTipManager;

      private var astX:Number;
      private var astY:Number;
      private var AssetToolTip:ToolTip;
      private var tooltipText:String = "";

      private function createAssetToolTip(event:MouseEvent):void{
      var s:String = "Filename: " + data.filename;
      tooltipText = s;
      tooltipText += "\nFiletype: " + data.assettype;
      tooltipText += "\nFilesize: " + data.filesize;
      tooltipText += "\nVersion: " + FormatVersionNumberValue(data.version.toString());
      astX = event.currentTarget.x + 200;
      astY = event.currentTarget.y + 160;
      AssetToolTip = ToolTipManager.createToolTip(tooltipText, astX, astY);
      AssetToolTip.setStyle("backgroundColor",0xb7b5c0);
      AssetToolTip.width = (s.length * 6.5);
      AssetToolTip.height = 80;
      }

      private function destroyAssetToolTip(event:MouseEvent):void {
      ToolTipManager.destroyToolTip(AssetToolTip);
      }

      private function CheckAssetName():void{
      parentDocument.AssetnamVal123 = new String(data.filename);
      }
      ]]>
      </mx:Script>
      <mx:HBox width="100%" height="87"
      paddingBottom="1" paddingTop="1" horizontalAlign="center"
      verticalAlign="middle">
      <mx:Image id="imgDAAsset" source="{data.assetsm}"
      doubleClick="DownloadAssetFile(data.filepath, data.filename);"
      doubleClickEnabled="true"/>
      </mx:HBox>
      <mx:Text id="lblDATitle" text="{data.filename}" width="84"
      styleName="assetTextStyle"/>

      </mx:VBox>

      Please help.

      Thanks and Regards,
      Paromita