Is it possilbe to control iframe's mouse down and key down

50 views
Skip to first unread message

dragon2934

unread,
Oct 28, 2009, 10:27:26 AM10/28/09
to Flex-IFrame
Hi,
Is it possilbe to control iframe's mouse down and key down, such as I
don't want user can use mouse right button at iframe web page, so that
I can disable mouse right click.

Thanks & Best Regards.

Julien Nicoulaud

unread,
Oct 28, 2009, 10:46:48 AM10/28/09
to flex-...@googlegroups.com
I'd say not easily the way you described it, because it is hard to know in the Flex application what is happening in the iFrame, and even harder to modify the iFrame web page behaviour. You will have to handle those events with Javascript. You could take two approaches:
 -  Wrap your page in another page that would handle those events and prevent right click menu for example.
 -  Use the callIFrameFunction() method to insert the Javascript functions you need and call them.

2009/10/28 dragon2934 <drago...@gmail.com>

Long Zhou

unread,
Oct 28, 2009, 11:14:17 AM10/28/09
to flex-...@googlegroups.com
Thanks for your reply,
now the script like this:

<script language='JavaScript'>
var message="";
function clickIE()
{if (document.all){(message);return false;}}
 
function clickNS(e) {
if(document.layers||(document.getElementById&&!document.all))
{
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);document.  onmousedown=clickNS;
}else{
    document.onmouseup=clickNS;document.oncontextmenu  =clickIE;
}
 
document.oncontextmenu=new Function('return false')
//document.ondragstart=new Function("return false")
//document.onselectstart=new Function("return false")
</script>

how can I add it to the code?

Thanks
Reply all
Reply to author
Forward
0 new messages