A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: if score, the?

  1. #1

    if score, the?

    How can I make it so in my game if the dynamic text is 4 (in other words if the score = 4) that then it would go to another frame?

  2. #2
    Senior Member
    Join Date
    May 2000
    Location
    Bombay, India
    Posts
    926
    Hi,

    Your dynamic text field obviously has a name, such as "score"

    So use the code:
    if (score ==4){
    goto AndStop ("some_frame")
    } else {
    gotoAndStop ("some_other_frame")
    }

    cheerio
    RanTen
    Unrepentant Rebel & Boat Rocker
    http://ranten.celltrix.com

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    I got a similar case with a game and i want it when it reaches like 40 in score it loads an external swf like with loadMovieNum.

    tried this but doesnt work:

    if(scoreTextField = 40){
    loadMovieNum ("index.swf",0);
    }

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    If that code is on a frame, it will only be executed once, and that is when the Frame loads! Either use that code on your button actions, when increasing the scoreTextField, or use this modified code on your frame:

    Actionscript Code:
    onEnterFrame = function(){
        if(scoreTextField = 40){
            loadMovieNum ("index.swf",0);
            delete onEnterFrame;
        }
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  5. #5
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thank you but it doenst work when the movie loads automaticly loads index.swf

  6. #6
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    sorry, wrote = instead of ==

    new code:

    Code:
    onEnterFrame = function(){
        if(scoreTextField == 40){
            loadMovieNum ("index.swf",0);
            delete onEnterFrame;
        }
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  7. #7
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thank you but it still doesn't work...

    Here is the Fla file. For the time being i putted a button and that the game lasts some time and then goes there.

    Please try to fix it.
    Attached Files Attached Files

  8. #8
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    I haven't thoroughly examined the FLA file, but the first error I spotted, is that scoreTextField is a textfield with a string, and not a number, therefore you can't check if it's equals to 40, because it's the variable, score, which is increased, and hence you have to check that one:

    Actionscript Code:
    onEnterFrame = function(){
        if(score == 40){
            loadMovieNum ("index.swf",0);
            delete onEnterFrame;
        }
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  9. #9
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    omg it works ty very much!!!

  10. #10
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    No problem
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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