I’m new to flash so my question may be stupid.
I unserstand security restrictions about working with clipboard. The user must do an action then clipboard may be written.
But what if on mouseclick i have to load some text from server using URLRequest and copy obtained data to clipboard?
Like this:
protected function clickHandler(e:MouseEvent):void
{
this.fileReference = new FileReference();
this.fileReference.addEventListener(Event.SELECT, this.fileSelectHandler);
this.fileReference.browse();
}
protected function fileSelectHandler(e:Event):void
{
var request:URLRequest = new URLRequest(this.url);
this.urlLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, this.completeHandler);
urlLoader.load(request);
}
protected function generateLinkCompleteHandler(e:Event):void
{
System.setClipboard(this.urlloader.data);
}
Maybe somehow it is possible to “pass” the “safe context” to further events?
or it’s another way to do this?
thanks!
Thanks to sydd who answered my question in comments. I’ll copy the link provided by him here System.setClipboard() inside event handler
if he consider to write it as an answer i’ll reaccept.