A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: If not equal problem

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    996

    If not equal problem

    I'm trying to do a check if the mc name is equal to a string that is in the BioArr. The reason for this is so that if it has been clicked it cannot be clicked again until another buttons has been clicked.
    I can't use the enable function for other reasons.
    If a user clicks the same button many times in a row the code inside the if statement won't be run until the user clicks another button.

    For some reason my if (newBio != bioArr[i]) { statement is not working.

    Code:
    	mc.onPress = function() {
    		var newBio = String(this._name+"Bio");
    		trace("NEWBIO :"+newBio);
    		for (var i = 0; i < bioArr.length; i++) {
    			trace("BIO ARR RESULTS :"+bioArr[i]);
    			if (newBio != bioArr[i]) {
    				swapBio(newBio);
    				bioArr.push(newBio);
    				//trace("bioArr :"+bioArr);
    			}
    		}
    		//}
    	};
    }

  2. #2
    Retired SCORM Guru PAlexC's Avatar
    Join Date
    Nov 2000
    Location
    NJ
    Posts
    1,387
    Where are your bioArr and swapBio defined? Probably need to target them with _parent or _root from the function.

    Check your curly braces as well.
    "What really bugs me is that my mom had the audacity to call Flash Kit a bunch of 'inept jack-asses'." - sk8Krog
    ...and now I have tape all over my face.

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Posts
    996
    bioArr is on the _root but I already tried to target it from there and it still made no difference. In any case it would not make a difference if it was on the root I should not have to use _root in this caes.
    swapBio works fine its "newBio != bioArr[i] " that is not working

    The problem is the != sign is not working so if newBio is == to bioArr[i] it still runs the code between the if statement when it is not meant to unless it's newBio != to bioArr[i]
    .
    Last edited by ericflash; 12-13-2004 at 05:27 PM.

  4. #4
    Senior Member
    Join Date
    Sep 2002
    Posts
    398
    Make sure you are checking a string against a string or movieClipTargetPath against movieClipTargetPath.. sounds like you may need to use >> eval( bioArr[i] )

  5. #5
    Senior Member
    Join Date
    Apr 2001
    Posts
    996
    sounds like you may need to use >> eval( bioArr[i] )
    Wow wainui nice advice I tried to place the eval function in the for loop where you sugested.IT crashed flash twice so I don't think that would be wise to do.

  6. #6
    Senior Member
    Join Date
    Sep 2002
    Posts
    398
    classic! Are you blaming me???

    You think that little bit of code crashed flash???

    You have stipulated that
    Code:
    var newBio = String(this._name+"Bio");
    is a string...

    waht type is bioArr[i] ??? I think this is where your error is.. make sure you are checking String against string...

  7. #7
    Senior Member
    Join Date
    Apr 2001
    Posts
    996
    eval function in a for loop will crash flash. Try it

    As for your other advise yes both are Strings.
    I have no idea why it is not working but I found another way to do what I was trying to do. Strange why this code is not working.

    Thanks for everyone’s help.

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