dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Please Help

  1. #1
    Electrical Engineer
    Join Date
    Aug 2003
    Location
    Indiana, USA
    Posts
    122

    Please Help

    I had the following code working until I changed the else if from an else and just do something. I changed it to an else if so that I could check to make sure a radial button (name = noerror) is clicked (or not changed...this is the default setting) by user. However the do something else does not work now. Am I using the radial buttons correctly _root.noerror is a radial button.

    Oh another possibly important note is that the radial buttons are not on the same frame as the following action. Do the last values get saved and that is what is used...or do I need to somehow save the values on the last frame that they are up? If so, how do I do this?


    if (_global.SVFAIL == true) {
    _root.VFCmovie.display2.text = "S V = F A I L";
    }if (_global.SVFAIL == true) {

    /*do something else*/

    Thanks,
    Nathan

  2. #2
    Senior Member stoc's Avatar
    Join Date
    Nov 2001
    Location
    Romania, Arad
    Posts
    428
    please , post your .fla , maybe would be better.
    Stoc Digital Studio - Web Applications Development
    http://www.stoc-studio.ro

  3. #3

    Re: Please Help

    I don't get your problem, but from your code I see you have the same IF twice. Check out how you should do it

    Code:
    if (_global.SVFAIL == true) {
    _root.VFCmovie.display2.text = "S V = F A I L";
    }else{
    
    /*do something else*/
    }
    this should work, or you can use a different (else if) aproach:


    Code:
    if (_global.SVFAIL == true) {
    _root.VFCmovie.display2.text = "S V = F A I L";
    }else if(_global.SVFAIL == false){
    
    /*do something else*/
    }
    but in your case where you have only 2 possible values, the first approach would work better
    Damir Secki
    FLASH | PHP | MYSQL | HTML | JAVASCRIPT | developer
    www.extremis.com

  4. #4
    Electrical Engineer
    Join Date
    Aug 2003
    Location
    Indiana, USA
    Posts
    122
    Sorry, Somehow I had posted the wrong code on the second if statement. I can't attach my fla file because it is way too big. I am creating a computer based training manual and haven't really worried about the size....several MB's or I would post it.


    if (_global.SVFAIL == true) {
    _root.Firelistmovie.display2.text = "S V = F A I L";
    } else if (_root.noerror.getState() == true)
    {
    /* do Stuff Here*/
    } else if (_root.nofire.getState() == true
    /* do something else*/
    } else if (_root.invalidfire.getState() == true
    /* do something different*/
    } else if (_root.bothbad.getState() == true
    /* and yet something different*/

    Should this work?


    noerror, nofire, invalidfire, and bothbad are all radial button in the same group located in the movie during the first 10 frames or so then hits a stop and waits for user to either leave the default setting on the radial buttons and click next or just change the radial button and click next.

    The above code is later in the scene after the radial buttons are no longer visable. DOES FLASH RETAIN THE VALUES THAT WERE LAST USED FOR THE RADIAL BUTTONS?

    Thanks,

    nathan

  5. #5
    Electrical Engineer
    Join Date
    Aug 2003
    Location
    Indiana, USA
    Posts
    122
    The end parenthesis are actually end the code... sorry

  6. #6
    You should not use else if for different variables. you should just use

    if (_global.SVFAIL == true) {
    ...
    }
    if (statement2){
    }
    if (statemen3){
    }



    else if is used for checking the values of the same variable

    if(a==1){
    ...
    }else if(a==2){
    ...
    }else if(a==3){
    ...
    }
    Damir Secki
    FLASH | PHP | MYSQL | HTML | JAVASCRIPT | developer
    www.extremis.com

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