5 Replies Latest reply on Feb 26, 2015 6:39 AM by kglad

    Text box renders text as HTML...stop it!!!!!!

    basil_60

      Hi

      I'm using AS 2 with Flash CS5.

      Each year in my teaching interactivity in Flash, we get a few students who can't make this simple calculator work. I've included the code to show you what we're doing.

      The problem is that one of the text boxes, instead of returning a number, returns HTML. You can see the problem when you trace the output from "answer" in the Output window.

       

      We've checked that "Render text as HTML" is not clicked. I'd really like to hear of a resolution - maybe I can do this a better way!!! It seems so simple, yet, it always causes problems. Add I can't see why it does?

       

      I'd appreciate any advice.

       

      stop();

      var a:Number = Math.round (Math.random ()*10);

      var b:Number = Math.round (Math.random ()*10);

      var score:Number = 0;

      var sndTrack:Sound = new Sound();

      var sndTrack2:Sound = new Sound();

       

      trace(a+b);

      check_btn.onRelease =function():Void {

        trace (answer);

        if (Number(answer) != (a+b))

       

       

        {

       

        e = ("Sorry, the answer was " + (a+b));

        sndTrack2.attachSound("gasp");

        sndTrack2.start();

       

        }

      else

        {

        e = ("Well done, the answer was correct " + (a+b));

        sndTrack.attachSound("clap");

        sndTrack.start();

        score ++;

        }

      }

      next_btn.onRelease =function():Void{

        e = "";

        answer ="";

        a = Math.round (Math.random ()*10);

        b = Math.round (Math.random ()*10);

       

       

        Selection.setFocus("answer");

       

       

      }