Copy/Pasting strings to/from clipboard on HTML5 target



  • Hey everyone,

    I have a project targeted to HTML5, and I'm curious as to how I can copy or paste text from the clipboard. I believe I've tried using openfl, lime, perhaps even js.html, but I haven't been able to get anything to take. I'd like to generate a string and copy it, then paste it somewhere else to an FlxInputText object.

    Thanks for any help!



  • Or, perhaps, any ideas on where to look?

    I'd just like to be able to insert text without having the user type it out in it's entirety. I can retrieve a string through the console output with trace, but whenever I try to access the Clipboard, it's always a blank. If someone knows other ways to accept user input, please let me know.

    Thanks.


  • administrators

    Perhaps you could share some code of what you've tried so far? :)



  • Yeah, for sure!

    Using openfl didn't seem to set the paste text

        openfl.system.System.setClipboard("Test setClipboard");
    

    Both traces using lime return null

        trace(lime.system.Clipboard.text);
        lime.system.Clipboard.text = "Lime Clipboard Test";
        trace(lime.system.Clipboard.text);
    

    I believe I tried implementing js.html.ClipboardEvent in some way, but had no success. I'm probably unfamiliar with integrating it appropriately into a haxe project.

    If there's any easier way using a different target like Flash, or another target that would work through a browser, I'm open to taking that approach.


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.