If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.

#1009 Wrong AS3 output in case of looping through ArrayCollection with 'for each' and 'for' with direct-index-access
Author:
devbn

Date created:
Type: bug
Visibility: Everybody
Assigned to:
State: closed 

> What steps will reproduce the problem?
Decompile test.swf file attached together with this issue.
> What is the expected output? What do you see instead?
EXPECTED:
The method 'application1_creationCompleteHandler' in class 'test' must be something like
this:
var a:ArrayCollection = new ArrayCollection(["first","second"]);
for each(var o:String in a)
{
trace(o);
}
for(var i:* = 0; i < a.length; i++)
{
o = a[i];
trace(o);
}
ACTUAL:
var o:String = null;
var i:* = 0;
var a:ArrayCollection = new ArrayCollection(["first","second"]);
for(for each(o in a)
{
trace(o);
}; i < a.length; )
{
o = a[i];
trace(o);
i++;
}
> What version of the product are you using? Is it "nightly build"? Which operating system
do you have?
Using JPEXs FFdec version 6.0.1
> Please provide any additional information below. If the problem is related to a SWF
file, attach it here, otherwise we can't help you.
See attached files
P.S:
I mean the expectation is that the decompiled source must have two separate FOR loop, but
the actual only contains one loop followed by one ERROR loop statement WITHOUT 'for'
keyword
There are 2 for keywords:
for(for each(o in a)
the first loop is inside your first parameter of your 2nd for loop, so this code is
equivalent. (if it is allowed in AS, i don't know)
So you can find the "for" keyword for the 2nd loop before your first loop:)
But true, this is not so nice. (Even if it works)
This code causes compile error in FlashBuilder:
Description Resource Path Location Type
1008: Attribute is invalid. test.as /te/src line 20 Flex Problem
1084: Syntax error: expecting colon before leftparen. test.as /te/src line 18 Flex
Problem
1084: Syntax error: expecting identifier before for. test.as /te/src line 16 Flex Problem
1084: Syntax error: expecting identifier before rightbrace. test.as /te/src line 19 Flex
Problem
1084: Syntax error: expecting identifier before rightparen. test.as /te/src line 19 Flex
Problem
1084: Syntax error: expecting rightparen before semicolon. test.as /te/src line 19 Flex
Problem
1084: Syntax error: expecting semicolon before leftbrace. test.as /te/src line 17 Flex
Problem
Looks like this is already fixed in 6.1.0,
it was problem with for loop /debugline detection.
State: new→upgraded
Thank you!
I close this issue due to inactivity. Please create new issue if problem still exists.
State: upgraded→closed