A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [MX] Value Becomes The If Value

  1. #1
    Senior Member
    Join Date
    Jul 2008
    Posts
    391

    [MX] Value Becomes The If Value

    PHP Code:
    ant.timer=100;
    onEnterFrame = function() {
    if (
    ant.timer>0) {
    ant.timer--;
    }
    if (
    ant.timer=0) {
    ant.stop();
    }

    When I remove the ant.timer=0 if statement, the timer counts from 100 to 0. But when I include it, the timer becomes 0 right away and the code in that if statement doesn't work. The timer changes to whatever value my second if statement is.

  2. #2
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    Try using a comparison equality,
    PHP Code:
    if(ant.timer == 0) {
        
    code...;

    Wile E. Coyote - "Clear as mud?"

  3. #3
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    Thanks that worked.

  4. #4
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    Good stuff.
    Wile E. Coyote - "Clear as mud?"

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