A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Adding an integer to a variable & getURL question (AS2/AS3)

Threaded View

  1. #1
    Junior Member
    Join Date
    Feb 2002
    Posts
    9

    Adding an integer to a variable & getURL question (AS2/AS3)

    I have been stuck on AS2 for a long, long time, and I want to learn AS3 but I don't really know where to start with things that should be relatively simple. I'll start, actually, with my getURL question.

    I have an old, Flash MX file that attempts to load URLs based on a "while" command, and so what that file does is add strings to form a URL which is then opened in a browser. The "while" works until the "counter" variable reaches 0. For example, this forum is located at: <http://board.flashkit.com/board/forumdisplay.php?29>. My old Flash MX file would take that address then add one to the number 29 for as long as the "counter" had value, so if you started with "5," the file would load URL <http://board.flashkit.com/board/forumdisplay.php?29>, then <http://board.flashkit.com/board/forumdisplay.php?30>, then <http://board.flashkit.com/board/forumdisplay.php?31>, and so on and so forth until <http://board.flashkit.com/board/forumdisplay.php?33>.

    Back when I made the file everything worked in sequential order (29, 30, 31), but now when I run it modern browsers respond seemingly random (30, 29, 31, 33, 34).

    on (release) {
    while (countdown > 0) {
    countdown = eval("countdown") - 1;
    full = eval("front") + eval("middle") + eval("end");
    getURL(eval("full"), "_blank");
    middle = number(middle) + 1;
    }
    countdown = eval("countdown") + 5;
    }

    Front is the beginning of the URL, like <http://board.flashkit.com/board/forumdisplay.php?>, middle is the number, like 29, and end is anything that needs to go after. Now, the above is AS2. Anyone know why the URL would be loading in random order?

    The second part should be a much easier question. In AS3, how do I add an integer to a variable for display in a text field? What I want to do is click a button to have a text field increase + 1.

    MyTextField.text = "10";
    One.addEventListener(
    MouseEvent.CLICK,
    function(evt:MouseEvent):void {
    MyTextField.text = MyTextField + 1;
    }
    );

    The above formula turns MyTextField into "[object TextField]1," whereas I want it to evaluate the value of MyTextField then add 1 every time I click on the button One (so the first click would yield 11).

    Thanks!
    Last edited by G.v.P; 05-17-2013 at 06:13 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center