dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Actionscript problem with else if

  1. #1
    Junior Member
    Join Date
    Jan 2004
    Location
    Holland!!!
    Posts
    17

    Actionscript problem with else if

    I have made a simple loop in flash that checks if a variable is the integer 5. If it is, it has to look what the value of another variable is. According to that value it has to play a certain frame.

    But I cant make it work... Why not? Can somebody help me?

    This is my code:
    Code:
    teller = random(100 + 1);
    koe = random(8 + 1);
    if (teller != 5)    {
        gotoAndPlay(1);
    }
    if (teller == 5)    {
        if (koe == 1)    {
            gotoAndPlay(3);
        } else if (koe == 2)    {
            gotoAndPlay(41);
        }else if (koe == 3)    {
            gotoAndPlay(81);
        } else if (koe == 4)    {
            gotoAndPlay(121);
        } else if (koe == 5)    {
            gotoAndPlay(161);
        } else if (koe == 6)    {
            gotoAndPlay(201);
        } else if (koe == 7)    {
            gotoAndPlay(241);
        } else if (koe == 8)    {
            gotoAndPlay(281);
        } else {
            gotoAndPlay(1);
        }
    }
    This is placed on frame 2 and frame 1 has the actionscript
    Code:
    play()
    to it.

  2. #2
    \/\/EB/\/\ASTER lukesquall's Avatar
    Join Date
    May 2003
    Location
    Solitude
    Posts
    683
    EDIT: It does work OK anyway, but as there is a very rare chance to match the 'teller' variable, it take quite a while, especially on a low frame rate.
    Last edited by lukesquall; 01-31-2004 at 05:57 PM.

  3. #3
    Junior Member
    Join Date
    Jan 2004
    Location
    Holland!!!
    Posts
    17
    It still doesn't work, it looks like if the variable koe just has the value 1, but is has not (i'm so sure because i have textfields that parse the variable)

  4. #4
    \/\/EB/\/\ASTER lukesquall's Avatar
    Join Date
    May 2003
    Location
    Solitude
    Posts
    683
    Here's my test. It works fine for me just need to wait for a few seconds. Let me see your FLA, maybe you have an error elsewhere.

  5. #5
    \/\/EB/\/\ASTER lukesquall's Avatar
    Join Date
    May 2003
    Location
    Solitude
    Posts
    683


    ~yarr
    Attached Files Attached Files

  6. #6
    Junior Member
    Join Date
    Jan 2004
    Location
    Holland!!!
    Posts
    17
    Originally posted by lukesquall
    Here's my test. It works fine for me just need to wait for a few seconds. Let me see your FLA, maybe you have an error elsewhere.
    Here you can download my fla (it's too big to post it in my message)

    www.leujel.nl/piraat_v2.fla

  7. #7
    Junior Member
    Join Date
    Jan 2004
    Location
    Holland!!!
    Posts
    17
    AHHHH I already know what goes wrong... Stupid me!! It plays just great as it is made right now... I just forgot to enter some other code..... Sorry!!

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