1 Reply Latest reply on Dec 29, 2006 6:00 PM by phi2265

    issue with URLRequest

    phi2265 Level 1
      public var request:URLRequest = new URLRequest(data.clip);

      for some reason, that does not work.
      data.clip = path of a text file that i am importing.
      it works if i replace data.clip with a text file, like "test.txt"
      and i know data.clip is returning the right value, i made a text box display whats held in data.clip and its displaying the right information. but for some reason, URLRequest will only work with the exact name of a file and not data.clip

      any insight? thanks.

      here is all the code, its a renderer for a tileList
      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" horizontalAlign="center" verticalGap="0" borderStyle="none" creationComplete="firstLoad();">
      import mx.controls.*;
      import flash.display.Sprite;
      import flash.events.*;
      import flash.net.*;

      public var textImport:String;
      public var fileName:String;
      public var loader:URLLoader = new URLLoader();
      public var request:URLRequest = new URLRequest(data.clip);
      private static const windowsCRLF:RegExp = /\r\n/gm;

      private function firstLoad():void{
      loader.addEventListener(Event.COMPLETE, completeHandler);

      private function completeHandler(event:Event):void{

      loader = URLLoader(event.target);
      textImport = new String(loader.data);
      textImport = textImport.replace(windowsCRLF, "\n");
      text1.text = textImport.toString();

      <mx:Image id="image" width="150" height="88" source="{data.image}" scaleContent="true" autoLoad="true"/>
      <mx:Text id="text1" width="180" textAlign="left" fontWeight="bold" height="75"/>
      <mx:Text id="text2" width="180" textAlign="left" fontWeight="bold" height="75"/>