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.

#1277 Decompile&Edit bug - JPEXS v9.0.0
Author:
ultra_xerox

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

> What steps will reproduce the problem?
I decompiled the file and wanted to edit it (i clicked on button "edit" and then on button
"save"), but then i got an error:
http://photo.heroeswm.ru/photo-catalog/0001544/042-e1824dd8.jpg
CURLY_CLOSE expected but colon COLON found on line 416
...
1. decompile arcomage.swf
2. go to "scripts", then to "frame 2", "DoAction"
3. click on "edit code" (don't edit it! - just click the button)
4. click on "save" -> you'll get an error
If you put "loop4" into comments (line 416) and replace "break loop4;" with "break;" (line
497), then it will work, but swf will not work properly (i loaded it localy with fiddler).
"Decomiple&Edit&Save" works with other swf files without any problems, so they can be
easily modified. So the problem seems to be only in this file.
----------------------------------------------------------------------------------
Bugged code: (search for "loop4")
function showfinish(winner, finished)
{
gamefinished = true;
switch(winner)
{
case 0:
switch(lang)
{
case 0:
finalresult.winner.text = "Ничья";
break;
case 1:
finalresult.winner.text = "Draw";
}
finalresult.winner.textColor = 13421772;
break;
case 1:
switch(lang)
{
case 0:
finalresult.winner.text = "Победил " + nick1;
break;
case 1:
finalresult.winner.text = "" + nick1 + " wins";
}
finalresult.winner.textColor = 16777113;
break;
case 2:
switch(lang)
{
case 0:
finalresult.winner.text = "Победил " + nick2;
break;
case 1:
finalresult.winner.text = "" + nick2 + " wins";
}
finalresult.winner.textColor = 16777113;
}
loop4:
switch(finished)
{
case 1:
switch(lang)
{
case 0:
finalresult.winwhy.text = "Построив огромную башню";
break;
case 1:
finalresult.winwhy.text = "By building a huge tower";
}
break;
case 2:
switch(lang)
{
case 0:
finalresult.winwhy.text = "Разрушив башню
противника";
break;
case 1:
finalresult.winwhy.text = "By demolishing the enemy tower";
}
break;
case 3:
switch(lang)
{
case 0:
finalresult.winwhy.text = "Собрав гору ресурсов";
break;
case 1:
finalresult.winwhy.text = "By collecting a heap of resources";
}
break;
case 4:
switch(lang)
{
case 0:
finalresult.winwhy.text = "По окончанию времени";
break;
case 1:
finalresult.winwhy.text = "By timeout";
}
case 5:
switch(lang)
{
case 0:
finalresult.winwhy.text = "Игра закончена по
таймауту";
break;
case 1:
finalresult.winwhy.text = "Game over by timeout";
}
break;
case 6:
if(resc[14] <= 0 && resc[24] <= 0)
{
switch(lang)
{
case 0:
finalresult.winwhy.text = "Обе башни разрушены";
break;
case 1:
finalresult.winwhy.text = "Both towers demolished";
}
break;
}
if(resc[14] >= towerforwin && resc[24] >= towerforwin)
{
switch(lang)
{
case 0:
finalresult.winwhy.text = "Обе башни огромны";
break;
case 1:
finalresult.winwhy.text = "Both towers are huge";
}
break;
}
switch(lang)
{
case 0:
finalresult.winwhy.text = "Оба игрока имеют гору
ресурсов";
break loop4;
case 1:
finalresult.winwhy.text = "Both players got a heap of resources";
}
}
finalresult._visible = true;
finalresult._x = scrwidth / 2 - finalresult._width / 2;
finalresult._y = scrheight / 2 - finalresult._height / 2;
}
----------------------------------------------------------------------------------
> What version of the product are you using? Is it "nightly build"? Which operating system
do you have?
- JPEXS v.9.0.0
- (Notebook) Windows 7 Home Premium SP1, 32 bit, Intel Core i5, 4GB RAM.

it seems that there is a problem with labeled statements
As I remember, labeled statements are unsupported in ActionScript1/2, however the
decompiler decompiles them sometimes this way. In this case, there can be normal break
instead labeled. I can probably fix the decompiler to prefer nonlabeled breaks
(innermost).
The other problem with saving the code:
You say "but swf will not work properly":
unfortunately, I am afraid I cannot test it myself on the SWF file.
It does not run locally on my machine and testing game logic is hard task for me since I
don't know the game.
If the SWF does not work at all - prints an error message when played in debug flash
player - then maybe I can fix something based on the message, but If it's bug in game
logic... well, fixing that would be very hard.
This SWF file is obfuscated which means there are overlapping blocks of code and an extra
code on the script beginning. FFDec can handle that a bit if you check "Automatic
deobfuscation" on the Settings panel,
but your not working SWF file after editation can mean two things:
1) the code was deobfuscated incorrectly, thus saved code has different logic
or
2) the deobfuscation was successfull, but the code saving (compilation) is wrong
I am afraid I cannot distinguish these two cases in this file(the file is obfuscated and
is quite long), thus the fixing would be hard.
"The other problem with saving the code: You say "but swf will not work properly":
unfortunately, I am afraid I cannot test it myself on the SWF file. It does not run
locally on my machine and testing game logic is hard task for me since I don't know the
game. If the SWF does not work at all - prints an error message when played in debug flash
player - then maybe I can fix something based on the message, but If it's bug in game
logic... well, fixing that would be very hard."
I'm currently on vacation and have only some basic tools on my notebook. I'll check it
again in 1-2 weeks on my main pc. I have an older debug log here (Flash Player Debugger)
(2016-03-16 14:53:24):
http://www.heroeswm.ru/forum_messages.php?tid=2443014&page=0#40706842
http://www.lordswm.com/regwar.php (instant registration)
http://www.lordswm.com/tavern.php (card game)
This seems to be fixed in current version. (probably earlier)
State: new→upgraded
State: upgraded→closed