I'm really suprised at this ( Sorry about the byte code )
Why does Flash push UNDEF on the stack and then pop it back off ? ( I tested it with defining var score=50 and it still produced the same output ).PHP Code:/*
if (score==500){
trace("true");
} else {
trace("false");
}
*/
push 'score'
getVariable
push 500
equals
not
branchIfTrue label1
push 'true'
trace
branch label2
label1:
push 'false'
trace
label2:
/*
(score==500 ? trace("true") : trace("false"))
*/
push 'score'
getVariable
push 500
equals
branchIfTrue label3
push 'false'
trace
push UNDEF, UNDEF
branch label4
label3:
push 'true'
trace
push UNDEF, UNDEF
label4:
pop
Is it just a Flash quirk or am I being really stupid ? It seems strange that (condition ? action : else) generates more ( And from the looks of it, junk ) byte code than the long hand way ?
OK, you can edit it by hand and save the "NOT" statement, but...
Squize.





Reply With Quote