0

I know that much has already been discussed about this issue. I do not want to change a value or address,I can do these things and there is no problem. But I want to add some code to the existing code in the SWF file.

I tried using JPEXS Free Flash Decompiler, but I was not able to save the codes added in a SWF file.The software reported ridiculous errors from other lines of the file and did not save changes : "CURLY_CLOSE expected but SEMICOLON found on line 779" is there any other way ?

What I added :

var tmp_a = 10;

what JPEXS stucked on :

 777 enterFrameDispatcher.addEventListener(Event.ENTER_FRAME,function():*
 778      {
 779        testRenderLoop(psurface);
 780      },false,0,true);

It exactly says that "testRenderLoop" has some problems !

Here's the SWF File . I'm working on a script named VEngine.as in the swf.

Little Elite
  • 65
  • 13
  • SWF is Flash compiled application format and is not actually supposed to be altered. Or your skill and understanding (no offense) is not enough for the task. Anyway, as far, as I am aware, JPEXS was your best shot, other tools only allow to reverse-engineer SWF into source files then you need to build them into SWF on your own. – Organis Sep 04 '18 at 06:37
  • Maybe you're right. But I'm unlikely to know if I have not done it. After trying to save the file inside JPEXS, I encounter an error of "CURLY_CLOSE expected but SEMICOLON found on line 779". This line has nothing to do with the code I added. It is clear that the JPEXS has some problems. – Little Elite Sep 04 '18 at 07:16
  • You need to show some example of a line (or lines) of code that you added. It's possible they need some API that you did not import. Also is the additional code structured properly? Is there a missing `)` bracket in your code? Use the [`edit`](https://stackoverflow.com/posts/52154719/edit) button to shows us your AS3 code of lines **775** up to **780** to help us assess that error "`CURLY_CLOSE expected`..." – VC.One Sep 04 '18 at 12:04
  • 1
    I added the codes . does it help !? – Little Elite Sep 04 '18 at 12:22

1 Answers1

0

Try adding a data type (since it's required for variable declarations) :

var tmp_a :int = 10;

Let me know how it goes. I'm also concerned about enterFrameDispatcher... but that's for later.

VC.One
  • 14,790
  • 4
  • 25
  • 57
  • Unfortunately, the same errors still exist. I put the swf file link at the end of question. If possible, check it out. Thanks – Little Elite Sep 05 '18 at 06:28
  • I noticed that may be file is compressed, optimized or obfuscated by third-party applications, So where do I get to know how to deal with these tools? – Little Elite Sep 05 '18 at 16:41
  • Have you seen `cord.swf` actually work? It shows me a blank screen, so even if you edit okay there would still be nothing (visible) happening. Any simple edit will cause an error in JPEXS. Also the code is badly structured. Too many functions with return type `*` instead of `void`. The worst is a ton of in-line functions (why create new functions **inside** other functions which are themselves already inside more other functions??? Whoever made this code didn't want it to work? – VC.One Sep 05 '18 at 16:57
  • 1
    I don't know about compress/optimize. The code shows okay so it's not obfuscated. You get `_loc_` names because compiler doesn't need names for them, it knows what it means (when app data is in memory). Basically your problem in SWF is some bad code before line 777 where there is a missing `}` so you'll have to scroll upwards looking for that mistake. – VC.One Sep 05 '18 at 17:09
  • as I know this code should converted to an exe by flash player to work and show contents ! it's weird ! I don't know why it's programmer did like that ... but it seems I can do nothing with it ! – Little Elite Sep 05 '18 at 18:03
  • I found that Line 777 should be " enterFrameDispatcher.addEventListener(Event.ENTER_FRAME,function()):*" . One parenthesis was lost. but now the errors changed to "PARRENT_CLOSE" line 556. but there's no mistake in that line ! now it's deadend ... – Little Elite Sep 06 '18 at 19:23
  • I already tried changing code in many ways. It will always error. Delete a `;` then add back the same `;` in same place like you didn't change anything... `Save` option still gives an error. This means the SWF code was already broken even before any edit. That's why I ask, if this app ever worked before you opened with JPEXS? – VC.One Sep 08 '18 at 22:35
  • 1
    PS: See how you think _"one parenthesis was lost"_? It's not lost, it's placed at line **780** ending `false,0,true);`. But this kind of code layout is messy. If there's a missing anything it now becomes a trial to find that. Basically a function looks like example `function1 { .... }` and separate outside `function2 { .... }` etc, but what the developer did here is like `function1 { ... function2 { ...function3 { ...function4 { ..function5 { .... } .. } ... } ... }` so putting long functions **inside** other long functions makes a debugging mess & no gained benefits. Notice my missing `}`? – VC.One Sep 08 '18 at 22:51
  • Thank you for keeping track of the subject. yes I got what are you telling. I executed the swf (converted to exe by flash player 10) and it had some things to do (of course it needs some resource files behind itself). It's weird . – Little Elite Sep 09 '18 at 12:41