Add paste support to the input field

jfmherokiller

Member
Apr 23, 2020
5
0
28
Im still new to this whole game setup so im posting the code on the forums.

I figured out a way to add paste support to the game using ffdec
This this is the code in human readable format. file is GameTextModule.
Code:
         this._textInput.visible = false;
         this._textInput.addEventListener(Event.PASTE,this.pasteEvent);
      }
Code:
      private function pasteEvent(param1:Event) : void
      {
         this._inputText.text = Clipboard.generalClipboard.getData(ClipboardFormats.TEXT_FORMAT) as String;
      }

after opening the swf go to `GameTextModule` in `classes.UIComponents.ContentModules`.

use the add trait button and add a `pasteEvent` method.

edit its pcode and replace it with.

Code:
trait method Qname(PrivateNamespace("classes.UIComponents.ContentModules:GameTextModule"),"pasteEvent")
dispid 0
method
name "classes.UIComponents.ContentModules:GameTextModule/private:pasteEvent"
flag HAS_PARAM_NAMES
param Qname(PackageNamespace("flash.events"),"Event")
paramname "e"
returns Qname(PackageNamespace(""),"void")

body
maxstack 1
localcount 2
initscopedepth 10
maxscopedepth 11

code
getlocal_0
pushscope
getlocal_0
getproperty Qname(PrivateNamespace("classes.UIComponents.ContentModules:GameTextModule"),"_inputText")
getlex Qname(PackageNamespace("flash.desktop"),"Clipboard")
getproperty Qname(PackageNamespace(""),"generalClipboard")
getlex Qname(PackageNamespace("flash.desktop"),"ClipboardFormats")
getproperty Qname(PackageNamespace(""),"TEXT_FORMAT")
callproperty Qname(PackageNamespace(""),"getData") 1
getlex Qname(PackageNamespace(""),"String")
astypelate
coerce_s
setproperty Qname(PackageNamespace(""),"text")
returnvoid ; trait
end ; code
end ; body
end ; method
end ; trait
In the function Build add this pcode.
Code:
getlocal_0
getproperty Qname(PrivateNamespace("classes.UIComponents.ContentModules:GameTextModule"),"_textInput")
findpropstrict Qname(PackageNamespace("flash.events"),"Event")
getproperty Qname(PackageNamespace("flash.events"),"Event")
getproperty Qname(PackageNamespace(""),"PASTE")
getlocal_0
getproperty Qname(PrivateNamespace("classes.UIComponents.ContentModules:GameTextModule"),"pasteEvent")
callproperty Qname(PackageNamespace(""),"addEventListener") 2
 
Last edited:

Paradox01

Well-Known Member
Feb 8, 2020
1,817
2,484
USA
I think someone's been eating paste. That didn't make a lick of sense to me.
 
Last edited:
  • Like
Reactions: Malidica

RhymeDrooler

Well-Known Member
May 8, 2017
269
17
What should it change? I started new game in standalone flash player and successfully pasted text in name field using shift-ins, ctrl-v and right click menu.
 
  • Like
Reactions: Paradox01

jfmherokiller

Member
Apr 23, 2020
5
0
28
the game was updated with what I discussed in this thread. Seemingly since last night. I was working with the version number ending in 74 but now its 76
 
Last edited: