Closed helmutgranda closed 6 years ago
If it's an AVM1 SWF (ActionScript 1 or 2), find all DoAction tags. In each DoAction tag, find the ActionConstantPool actions. Search the action's constant array for the string value you want to change.
If it's an AVM2 SWF (ActionScript 3), as3swf won't help you much because it doesn't parse AVM2 byte code. You'll have to use the as3commons bytecode library to do that (works similar there, change values in constant pool)
I am using AVM2
If I understand this correctly the code would have to be compiled twice? one for the visual changes and once for the AS with two different libraries.
There is no AS in a SWF, there's only byte code.
also stuff like var filetype = "parent" is not normally preserved, so you can not search for "filetype". you could search for "parent", if that string is unique enough, but to replace it with the string of different length - you need to use as3commons.
Thank you all for the comments, as a last resource I am looking at the possibility to be able to add AS to the timeline, given that the original content is being discarded.
Basically I have a very complex AS3 project that is composed of multiple external custom AS files and they are integral for the display of this file, the goal is that with a custom UI the user will be able to modify some of the default settings and save a new SWF with the new properties (for example filetype="child" - I am not really using filetype as a variable but was mainly to pass the point across).
Is that possible with just AS3SWF? I am also looking at HAXE but right now the problem is porting all the custom classes and custom code to HAXE.
You can use as3commons bytecode lib to modify AS3 code, add code, anything you imagine. See
https://www.google.co.in/search?#q=modify%20as3%20bytecode
https://www.google.co.in/search?#q=modify+as3+bytecode+as3commons
A more similar example to what you need, modifying strings in AS3 code.
The lib can parse & generate AS3 code via the DoABC Tag, that can be inserted into the SWF using as3swf.
Hi All,
I am trying to determine how to make changes to scripts on the timeline. For example my original SWF has the following:
var filetype = "parent";
Any derivative from this SWF I would like to change the variable filetype to "child".
After looking at the "loaderInfo.bytes" in its raw format I am not able to find the code that is added to the timeline. I see that external classes can be referenced but that would mean that I would have to update the external class as well at run time.
Thanks...