How to stop copy / paste in flash form

I work for a medical transcription company, and our medical transcription test, which we administer to our applicants, is an earlier flash form application that stops copying and pasting, lowering the clipboard when entering the form. This worked great in IE 7, but lately it occurred to me that this doesn't work so well in Firefox. Or perhaps this is the flash version, since flash should be browser independent. I am by no means a flash developer, in fact I am terrible at this. So I need to know how to stop copying and pasting using a script action.

Based on the comments, additional information seems to be needed. What actually is a test, it plays a voice file (Basic MP3), which they must transcribe as listening. The copy and paste problem occurs when their transcription friend has already passed the test and simply sends it to his friend so that he can skip it.

0
source share
6 answers

You may not be able to โ€œdisable insertionโ€ per se (without any placement of the Flash control yourself, say, in a Windows application or in any browser extension), but you can certainly make a pretty good guess about how someone is using a timer-based math application. Here's a (super) example Flex application illustrating what I mean:

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" creationComplete="this_creationComplete(event)"> <mx:Script> <![CDATA[ private var timer:Timer; import flash.events.Event; private function this_creationComplete(event:Event):void { timer = new Timer(1000); timer.addEventListener(TimerEvent.TIMER, timer_tick); timer.start(); } private function timer_tick(event:TimerEvent):void { var elapsedTimeInMinutes:Number = timer.currentCount / 60; var averageWordLength:Number = 4; var humanlyPossible:Number = 200; var thisPersonsSpeed:Number = (txtTest.text.length / averageWordLength) / elapsedTimeInMinutes; if (thisPersonsSpeed > humanlyPossible) { txtSpeed.text = "Wait, " + Math.floor(thisPersonsSpeed).toString() + " words per minute? This clown is probably cheating."; txtTest.enabled = false; timer.stop(); } else { txtSpeed.text = "Currently typing " + Math.floor(thisPersonsSpeed).toString() + " wpm. Hurry up! Faster!"; } } ]]> </mx:Script> <mx:VBox> <mx:TextArea id="txtTest" width="600" height="300" /> <mx:Text id="txtSpeed" /> </mx:VBox> </mx:Application> 

Essentially, it's just a timer that calculates words per minute; if this number exceeds a certain threshold, the timer stops and the form turns off.

Of course, this is not ironclad, and if I implemented it myself, I would add some additional measures oriented to the time frame (for example, stop the timer after periods of inactivity, etc.), but it should illustrate the point. I'm sure there are other solutions, but something simple like this might be good enough for you.


Update: a couple of people mentioned Event.PASTE, which will work, but does not exist in ActionScript 2 / Flash Player 9. If you were able to provide Flash Player 10 and could script in ActionScript 3, this would be a different option.

0
source

I assume that since this is a translation test, you are showing some source document side by side with the form that you want the user to fill out based on the specified source document. Instead of emptying the clipboard, wouldn't it be easier to prevent them from copying the original document? If the source document is also under the control of your flash object, it should be simple to set it as readonly and unselectable. This has the added benefit of allowing them to copy form fields, as it can be their normal use during transcription and allows them to test faster.

Please note that no solution like this will ever stop someone who is defined and has little time - if you try to do something other than the fact that they are not cheating on this test, you will end up in DRM territory, which is very difficult and very useless.

+4
source

Recently, Flash updates have made it harder to access the buffer. As a rule, programmatic access to the clipboard often does not work if the user does not initiate it. Thus, the clipboard cleanup code is more likely to work if you place it inside a button call. It really will not help you, but it tells you what is wrong and why the thing you are trying to fix cannot be fixed. I suggest using the rmeador clause.

If this is not practical, take a screenshot with the text and use graphics for the text. Someone who is stubborn can still copy and paste with little effort, but this is a pretty simple way to stop him from accidental use without using a flash form.

Inside for flash, you can see the insert event handler.

0
source

Could not register the event descriptor to capture the past event in the text field?

 function onPasteMessage(event:Event){ ... } ... myTextField.addEventListener(Event.PASTE, onPasteMessage) 

onPasteMessage can be a simple warning to the user that the past is not allowed or something that cancels the paste action depending on when the event is fired and when / how the text field is changed. Most likely, if you capture an event at this level, you will prevent the text from the default clipboard, default eventHandler, from being copied to the text box.

0
source

In the absence of event.paste in earlier versions of Flash, you could probably set up something like an onKeyUp listener that checked for a V key while holding down the control key / command. I assume it will look something like this:

 var listening_object = new Object(); Key.addListener(listening_object); listening_object.onKeyUp(){ if ( Key.getCode() == whatevercodeforVis && Key.isDown(Key.CONTROL)){ freakout(); } } 

Where freakout () did something like clearing a text field or a warning dialog popped up. This would not help when pasting the right mouse button, but you could turn off the context menu - you can use most parts of the flash, but whether it works in text fields. I'm sure.

Is it completely out of scope to produce a few slightly different readings that are randomized at run time to catch people who may be inclined to cheat?

0
source
  package { import flash.desktop.Clipboard; import flash.desktop.ClipboardFormats; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; import flash.ui.ContextMenu; public class PasteExample extends MovieClip { public function PasteExample():void { //make a movie var pasteTarget:Sprite = addChild(new Sprite()) as Sprite; pasteTarget.graphics.beginFill(0); pasteTarget.graphics.drawRect(0, 0, 100, 100); pasteTarget.endFill(); var contextMenu:ContextMenu = new ContextMenu(); contextMenu.clipboardMenu = true; contextMenu.clipboardItems.paste = true; pasteTarget.contextMenu = contextMenu; pasteTarget.addEventListener(Event.PASTE,pasteHandler) } private function pasteHandler(e:Event):void { var clipboadStr:String = Clipboard.generalClipboard.getData(ClipboardFormats.TEXT_FORMAT) as String; trace(clipboadStr) } } 
0
source

Source: https://habr.com/ru/post/1346452/


All Articles