1 Reply Latest reply on Sep 22, 2010 12:54 PM by learner_doug

    Dont Understand Why This Text Wont Load .....

    Whitetimer Level 1

      Hi All

       

      I'm having trouble loading a text document and cant understand why ... Any thoughts please ?

      Code:

      <s:NavigatorContent xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      xmlns:v="Views.*"
      width="900" height="100%"
      creationComplete="loadTXT(event)">

      <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
      </fx:Declarations>

      <fx:Metadata>
      [Event(name="", type="")]
      </fx:Metadata>

      <fx:Script>
      <![CDATA[
      import mx.controls.Alert;

      private function loadTXT(event:Event):void
      {
      var loader:URLLoader = new URLLoader();
      loader.load(new URLRequest("Data/Text/WT_Intro.txt"));
      loader.addEventListener(Event.COMPLETE, onComplete);
      }

      private function onComplete(event:Event):void
      {
      var myData:String = new String(event.target.data)
      whitetimeIntroTXT.text = myData;
      }

      ]]>
      </fx:Script>

      <s:layout>
      <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle" />
      </s:layout>

      <s:BorderContainer width="100%" height="100%">
      <s:layout>
      <s:VerticalLayout verticalAlign="top" horizontalAlign="center" paddingBottom="10" paddingTop="10" />
      </s:layout>
      <s:TextArea id="whitetimeIntroTXT" width="400" height="100%"/>
      </s:BorderContainer>

      <s:BorderContainer width="275" height="100%">
      <s:layout>
      <s:VerticalLayout verticalAlign="top" horizontalAlign="center" />
      </s:layout>

      </s:BorderContainer>

      </s:NavigatorContent>

       

       

      Many Thanks