Connecting Tech Pros Worldwide Forums | Help | Site Map

Onactivate Event for Flash object is not working in Firefox

Member
 
Join Date: Aug 2006
Posts: 32
#1: Feb 19 '07
Hi,

I am facing one problem in embed flash object.i am displaying the flash (.swf file) using embed tag<embed> in IE.i want to display the alert box when user click the mouse over the flash .i am able to display the alert box only when user double click the flash .but i want alert box need to display when single mouse click over flash.


my code:

[HTML]<script>

function kiosk(){ // fn will be called when user click mouse
alert(" i received the mouse click");
}

//-------------- creating the embed flash object
var picObj1 = document.createElement('EMBED');
picObj1.setAttribute('id',"aShow"); // Give id to it
picObj1.setAttribute('TYPE' , 'application/x-mplayer2');
picObj1.setAttribute('PLUGINSPAGE', 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112');
picObj1.setAttribute('play','true');
picObj1.setAttribute('wmode','opaque');
picObj1.setAttribute('width','100%');
picObj1.setAttribute('height','100%');
picObj1.setAttribute('src','02.swf');

//--------end
aShow.attachEvent("onmousedown",kiosk); // i am attaching "onmousedown" event

document.getElementById('displayarea').appendChild (picObj1);

</script>

<body>

<div id="displayarea"></div>

</body>[/HTML]
Please post in code tags - moderator

Member
 
Join Date: Aug 2006
Posts: 32
#2: Jul 13 '07

re: Onactivate Event for Flash object is not working in Firefox


Hi guys

I able to capture the mouse click in Flash object(.swf file) using 'onactivate' Event Handler.But it works fine in IE.But its not working in Firefox.I heard the 'onactivate event will support only IE.

Is there any mouse event to capture single mouse click in flash object for firefox
I am looking for some help from you guys

A.suresh
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: Jul 14 '07

re: Onactivate Event for Flash object is not working in Firefox


I don't work with Flash, but does a simple onclick not work?
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,136
#4: Jul 14 '07

re: Onactivate Event for Flash object is not working in Firefox


Quote:

Originally Posted by suresh_nsnguys

... But its not working in Firefox.I heard the 'onactivate event will support only IE. ...

that's correct ... have a look at the following link:

mouse events

may be it is of some help to you ...

kind regards
Member
 
Join Date: Aug 2006
Posts: 32
#5: Aug 4 '07

re: Onactivate Event for Flash object is not working in Firefox


Hi,

I able to capture single mouse click over flash(<Embed> object) using onactivate event handler.But it is supported by IE. i want some event in Firefox that will capture the mouse click over flash object.

i attached my code
Expand|Select|Wrap|Line Numbers
  1. var picObj = document.createElement('EMBED');  // --Create dynamically object tag
  2.  
  3. picObj.setAttribute('id','aShow'); // Give id to it
  4.  
  5. picObj.setAttribute('TYPE' , 'application/x-shockwave-flash');
  6.  
  7.  picObj.style.width = 100%;   // width
  8.  
  9. picObj.style.height = 100%;   // height
  10.  
  11. picObj.src = 01.swf; //--This is the Filename of the Flash ad.
  12.  
  13. // to capture onclick event for IE
  14.  
  15. //kiosk is the javascript function i am calling when an event accours
  16.  
  17. aShow.attachEvent("onactivate",kiosk);   // it is working fine 
  18.  
  19. // For Firefox,i tried 'onfocus' also
  20.  
  21. document.getElementById('aShow').addEventListener("focus",kiosk,true);  // not working

can any one help me to solve my problem



A.suresh
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#6: Aug 4 '07

re: Onactivate Event for Flash object is not working in Firefox


Suresh, please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

I will not ask you again.
Reply