5 Replies Latest reply on Jul 19, 2007 8:26 PM by kglad

    How do I alter this code?

    jcarruth@earthlink.net
      This code makes an external text file scroll on the stage. I would like to alter it so that it continues to scroll while the mouse is down, as moving the text a tiny bit on each mouse click seems useless to me. Thanks, jcarruth.
      ------------------------------------------------------------------------------------------ -----------------------------------------
      var external_txt:TextField = new TextField();
      var externalReq:URLRequest = new URLRequest("external.txt");
      var externalLoad:URLLoader = new URLLoader();
      externalLoad.load(externalReq);
      externalLoad.addEventListener(Event.COMPLETE, textReady);
      up_btn.addEventListener(MouseEvent.CLICK, scrollUp);
      down_btn.addEventListener(MouseEvent.CLICK, scrollDown);
      external_txt.x = 175;
      external_txt.y = 100;
      external_txt.border = true;
      external_txt.width = 200;
      external_txt.height = 200;
      external_txt.wordWrap = true;
      addChild(external_txt);
      function textReady(event:Event):void
      {
      external_txt.text = event.target.data;
      }
      function scrollUp(event:MouseEvent):void
      {
      external_txt.scrollV --;
      }
      function scrollDown(event:MouseEvent):void
      {
      external_txt.scrollV ++;
      }
        • 2. Re: How do I alter this code?
          jcarruth@earthlink.net Level 1
          Thanks, kglad!

          Worked beautifully!

          jcarruth
          • 3. Re: How do I alter this code?
            miquael Level 1
            I would like to see this work. I got 8 error message on running it. Are these some custom Class package? And I do not see Class instantiations here.

            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: The class or interface 'URLRequest' could not be loaded.
            var externalReq:URLRequest = new URLRequest("external.txt");

            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: The class or interface 'URLLoader' could not be loaded.
            var externalLoad:URLLoader = new URLLoader();

            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 14: The class or interface 'Event' could not be loaded.
            function textReady(event:Event):void

            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 20: The class or interface 'int' could not be loaded.
            var t:Timer=new Timer(50,0);

            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 26: The class or interface 'MouseEvent' could not be loaded.
            function scrollUp(event:MouseEvent):void {

            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 30: The class or interface 'MouseEvent' could not be loaded.
            function scrollDown(event:MouseEvent):void {

            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 34: The class or interface 'MouseEvent' could not be loaded.
            function stopScrollF(evt:MouseEvent){

            **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 37: The class or interface 'TimerEvent' could not be loaded.
            function scrollF(evt:TimerEvent){
            • 4. Re: How do I alter this code?
              jcarruth@earthlink.net Level 1
              Michael,

              I e-mailed the FLA file to you in which it is working, so you can examine the code for yourself.

              jcarruth
              • 5. Re: How do I alter this code?
                kglad Adobe Community Professional & MVP
                you're welcome, jc.

                miq, it's as3 code. your publish settings are as2.