Question

What line of code I need for my URLRequest to be automatically filled by clipboard or an extern *.txt file? This is the as3 script and where is XXXXXX I need script to take automatically text from clipboard and put there before execute, OR take text from an extern *.txt file, put there and execute:

var request:URLRequest = new URLRequest("XXXXXX");  
var loader:Loader = new Loader();  

loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);  
loader.contentLoaderInfo.addEventListener(Event.INIT, loadComplete);
loader.load(request);

function loadProgress(event:ProgressEvent):void {  
    var percentLoaded:Number = Math.ceil(event.bytesLoaded/event.bytesTotal); 
    trace("Loading: "+percentLoaded+"%");  
}  

function loadComplete(event:Event):void {  
    trace("Complete");
    loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadProgress);  
    loader.contentLoaderInfo.removeEventListener(Event.INIT, loadComplete);
    loader.x = 0;
    loader.y = 0;
    addChild(loader);
}
Was it helpful?

Solution

You can access the clipboard and alter it, copy it, paste it, but you can only paste what is in the clipboard via a paste event. This has to do with Security issues.

Flash Player requires that the getData() be called in a paste event handler. In AIR, this restriction only applies to content outside of the application security sandbox.

See http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/Clipboard.html#getData() for more explanation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top