A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: "if loop" hassles...it's so simple but it's not working!! please help!

  1. #1
    www.intensewd.com
    Join Date
    Apr 2002
    Location
    Australia
    Posts
    450
    hi,

    an asp script retrieves skill ranks. ranks are "excellent", "fair" and "average".

    a loop creates empty movie clips, positions them and attaches a coloured box which symbolises their rank. the coloured boxes are "redbox", "greenbox" and "purplebox". each of these are "linked for action script".

    if i use this AS in the loop that creates the empty mc's and attaches the boxes:

    skill = eval("/:skill" add i);
    thisrankbox="redbox";

    then flash shows a red box for each rank. the same works for 'thisrankbox="purplebox" etc.

    if i try and use a loop to decide which box to display (which is what i need to do), no boxes are displayed:

    skill = eval("/:skill" add i);

    if (skill=="excellent"){
    thisrankbox="redbox";
    }
    if (skill=="good"){
    thisrankbox="greenbox";
    }
    if (skill=="average"){
    thisrankbox="purplebox";
    }

    what's going on? it *appears* to be such a simple bunch of if statements....
    Cheers,
    Ben

  2. #2
    Senior Member
    Join Date
    May 2002
    Posts
    248
    I would try tracing out the "skill" variable after doing the eval, to make sure that it really does equal one of the 3 choices. If that doesn't tell you what's going wrong, post your FLA somewhere so we can take a look.

    BTW, eval is a deprecated function. You should try using the brackets instead, like if you had a movie clip named "clip4" on the root, you can access it as _root["clip" + 4];

    -Dan

  3. #3
    www.intensewd.com
    Join Date
    Apr 2002
    Location
    Australia
    Posts
    450
    hey tomservo,

    it was actually something really really really stupid that i think is the kind of mistake everyone can make after a long day...

    if (skill=="excellent"){

    should have been:

    if (skillrank=="excellent"){

    oh well...i'd have loved to use trace during these things but i'm having issues getting IIS to run properly alongside Apache...

    plus XP corrupted all my user profiles so pretty much nothings configured now anyway...

    Cheers,
    Ben

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