
Код:
movie 'loop.swf' // flash 9, total frames: 1, frame rate: 12 fps, 550x400 px
frame 0
constants 'a', 'b', 'i', 'k', 'Math', 'random', 'round', 'sumA', 'sumB', 'sumA ', ' sumB '
push 'a', 0.0, 0.0, 0.0, 0.0, 0.0, 5
initArray
varEquals
push 'b', 0.0, 0.0, 0.0, 0.0, 0.0, 5
initArray
varEquals
push 'i', 0.0
varEquals
label1:
push 'i'
getVariable
push 100
lessThan
not
branchIfTrue label2
push 'k', 0.0, 'Math'
getVariable
push 'random'
callMethod
push 4
multiply
push 1, 'Math'
getVariable
push 'round'
callMethod
varEquals
push 'b'
getVariable
push 'k'
getVariable
push 'b'
getVariable
push 'k'
getVariable
getMember
increment
setMember
push 'a'
getVariable
push 0.0, 'Math'
getVariable
push 'random'
callMethod
push 4
multiply
push 1, 'Math'
getVariable
push 'round'
callMethod
push 'a'
getVariable
push 0.0, 'Math'
getVariable
push 'random'
callMethod
push 4
multiply
push 1, 'Math'
getVariable
push 'round'
callMethod
getMember
increment
setMember
push 'i', 'i'
getVariable
increment
setVariable
branch label1
label2:
push 'sumA', 0.0
varEquals
push 'sumB', 0.0
varEquals
push 'i', 0.0
setVariable
label3:
push 'i'
getVariable
push 5
lessThan
not
branchIfTrue label4
push 'sumA', 'sumA'
getVariable
push 'a'
getVariable
push 'i'
getVariable
getMember
add
setVariable
push 'sumB', 'sumB'
getVariable
push 'b'
getVariable
push 'i'
getVariable
getMember
add
setVariable
push 'i', 'i'
getVariable
increment
setVariable
branch label3
label4:
push 'sumA ', 'sumA'
getVariable
add
push ' sumB '
add
push 'sumB'
getVariable
add
trace
end // of frame 0
end
Это вот что получается после компиляции - ну, давайте попробуем разобраться
Не знаю, я не вижу почему бы второй вариант должен так странно себя вести, скорее всего - баг плеера а не компилятора. (Хотя первый вариант все равно оптимальнее).