• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Question about flash actionscript

GoingUp

Lifer
I had tried using AND as well as &&. For a little while && worked, but I no longer get any success. Nothing will happen.

here is my code

else if (145<=test._x && test._x<295){

Do stuff

}

For some reason the loop never executes, even though the X position of the test clip is 150. What the heck am I doing wrong?
 
Originally posted by: ahurtt
is the position of test clip 150 or "150"?

its at 150, the number.

when I test for if its just under 150, it always works...
if (test._x <150){

do something

}
the above code will always get me results, but as soon as I try to use the else if and set a range of values, nothing works.
 
what if you try changing your test to say:

if (test._x >= 145 && test._x < 295) ?

Can you post a bigger sample of the rest of your code for context?
 
yep need a larger code samle...that line works perfectly OK in flash so something else in the program is not functioning properly
 
Without seeing more of the code, I can only make a guess as to what could be happening. My best guess is that the "if" statement that corresponds to your "else if" is evaluating to true and so the "if" block is executing and the "else if" never gets evaluated. You changed the statement to a regular "if" which means it will always evaluate regardless of how the previous "if" statement evaluates. By making it an "else if" then it will not evaluate at all (it will be skipped) if its corresponding "if" (or some other "else if" before it in the same logical block) evaluates true.
 
Back
Top