Unable to copy / paste text fields in loadable SWFs in AIR

My AIR application loads a SWF file that contains a text box for input. I can enter text in a text box, but copying and pasting does not work. When I try to insert something using a keyboard shortcut, the text box will look like this:

enter image description here

(this is not a "T").

And after a series of copies / pastes, it looks like this:

enter image description here

When I right-click on a text field, nothing happens, the context menu with copy / paste options does not appear.

The downloadable SWF is located in AS2 (it is almost impossible to port it to AS3 because the code in it is very extensive and complex). I can not replace this SWF, it has extremely high value for my project. Besides this problem, SWF works great. Maybe I can change some configuration constants in the settings of the AS3 bootloader?

For testing purposes, I created two .flas, one of them in AS2 and contains a text field, and the other in AS3 and loads a text field. You can upload .flas to the archive from here .

+6
source share
1 answer

This is a dirty hack, but it works. :) Convert SWF from AVM1 to AVM2 on the fly. Use ForcibleLoader https://code.google.com/p/as3-classes/source/browse/trunk/org/lzyy/util/ForcibleLoader.as

In loader.fla:

var loader:Loader = Loader(addChild(new Loader())); var fLoader:ForcibleLoader = new ForcibleLoader(loader); fLoader.load(new URLRequest('tf.swf')); 

In ForcibleLoader.as add import flash.system.LoaderContext;

and

 var lc:LoaderContext = new LoaderContext(); lc.allowCodeImport = true; loader.loadBytes(inputBytes, lc); 

instead

loader.loadBytes(inputBytes);

in line ~ 75

+6
source

All Articles