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.
![List of issues](/flash/images/issue_list.png)
#2237 Can't add an import to a class
Author:
xrtxn
![user user](/flash/images/user.png)
Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: AS3Direct Editation
State: upgraded ![Help](/flash/images/help.png)
![Help](/flash/images/help.png)
> What steps will reproduce the problem?
Click on edit actionscript, add `import com.adobe.serialization.json.JSON;` to the imports
and save it.
> What is the expected output? What do you see instead?
I expect it to show in the code. It just disappears.
> What version of the product are you using? Is it "nightly build"? Which operating system
do you have?
Tried both the 20.1.0 nightly 2780 build and the 20.1.0 stable. I use arch linux.
> Please provide any additional information below. If the problem is related to a SWF
file, attach it here, otherwise we can't help you.
Does your SWF file contain such class?
No, neither me or the search tool found such class.
Also, I can't add any other imports to this or to other files.
Then you need to add that class first.
Things you import must be present in the current SWF file or in playerglobal.swc library.
State: new→opened
Type: bug→question
Type: bug→question
Thank you!
I think there's another thing: after typing the line of code that imports stuff, you also
need to add something in the current script that actually uses the imported stuff,
otherwise FFDec removes the importing line as it isn't used anywhere. Here's an example
video:
After adding the classes, it still wouldn't let me import it, even after adding the line
of code to initialize it so the import shouldn't disappear but it does.
Well, then attach the SWF file you are trying to modify here and tell me which class you
want to modify and how and I can then investigate and tell you what's wrong there.
Without sample SWF file, I cannot do anything about it.
I'm trying to add "import com.adobe.serialization.json.JSON;" as an import to
se.raketspel.slotcar.mongobox.MongoBox. The initialization should already be in the login
function.
![Download](/flash/images/disk.png)
I don't know what the issue exactly is but it seems like it doesn't accept importing the
name JSON but after renaming the class to ADOBEJSON it works flawlessly.
It's probably because the JSON is existing class in toplevel namespace of playerglobal
library,
and you are trying to import JSON from another namespace.
Toplevel JSON has precedence in such case.
I need to further investigate whether it's a bug in FFDec...
In nightly 2821, an error message should appear when you try to use unqualified name which
exists both as toplevel class and as an import.
Assuming you added the import to JSON, then you should make sure all occurences of JSON in
this script are fully qualified.
Example:
import com.adobe.serialization.json.JSON;
...
com.adobe.serialization.json.JSON.encode(requestData) instead of JSON.encode(requestData)
State: opened→upgraded
Type: question→bug
Type: question→bug