addeventlistener

Correct usage of addEventListener() / attachEvent()?

Hi guys! I'm wondering how to use "addEventListener" resp. "attachEvent" correctly!? window.onload=function(myFunc1){ // do something } function myFunc2(){ // do something } if (window.addEventListener){ window.addEventListener('load', myFunc2, false); } else if (window.attachEvent){ window.attachEvent('onload', myFunc2); } ... or ...

AS3: Weak Listener References Not Appropriate During Initialization?

as i currently understand, if an event listener is added to an object with useWeakReference set to true, then it is eligible for garbage collection and will be removed if and when the garbage collection does a sweep. public function myCustomSpriteClass() //constructor { this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownList...

addEventListener gone after appending innerHTML

Okay, so i have the following html added to a site using javascript/greasemonkey. (just sample) *a id='abc'*HEllo*/a* *a id='xyz'*Hello*/a* (excuse me, i've had to replace the '<' '>' with * since hyperlinks for new users aren't allowed!) and i've also added a click event listener for the elements. All works fine up to this point, ...

Trouble using Titanium's webview to fire an API event

I'm trying to fire an event from an external HTML page opened inside of Titanium's webview. app.js file... var group, now, tab, view, window; now = new Date(); view = Titanium.UI.createWebView({url: 'http://MYWEBSITE.com/index.htm?time=' + now.getTime()}); window = Titanium.UI.createWindow({tabBarHidden: true, navBarHidden: true}); w...

Eclipse progress view stop button listener

Hi! I develop an eclipse plugin, and I created an progress view which indicates where the work runs. Everything works correctly, but I have a question. When I made this view an stop button appeared on it. But I haven't found any listener to control this. But the best should be that if there is an pause button within the view insted of t...

Add an event to HTML elements with a specific class.

Hello everybody, I'm working on a modal window, and I want to make the function as reusable as possible. Said that, I want to set a few anchor tags with a class equals to "modal", and when a particular anchor tag is clicked, get its Id and pass it to a function that will execute another function based on the Id that was passed. This is w...

adding listener to div tag to watching innerHtml content

I have a div tag and i'm changing its innerHtml attribute. And i want to add listener to this div tag to show/hide when its innerHtml changed. ...

Android registerListener and battery life

In reviewing this post http://stackoverflow.com/questions/2317428/android-i-want-to-shake-it, the highest rated answer says you should unregister and reregister the listener for the accelerometer onStop and onResume to conserve battery life. My question is how do we know which listeners we need to stop/resume to minimize our application...

javascript - eventlistener

var Button = createInputButton("checkbox", index); Button.name = "farmAtivada_"+index; FM_log(3,"checkboxFarm "+(index)+" = "+Button.checked); Button.checked = GM_getValue("farmAtivada_"+index, true); Button.addEventListener("click", function() { FM_log(3,"checkboxFarmClick "+(index)+" = "+Button.checked); GM_setValue("f...

Load external swf from a button in external swf and unload self?

Hello, I am an uber n00b to flash AS3. And it is not my intention to sound like a complete moron, but honestly, I have had a hard enough time figuring out just how to load an external .swf into my main file! And now my friend is asking me if I could please add a button within the external .swf which will unload itself and load a new on ...

Adding an ActionScript eventListener that takes the whole sprite

Hello, I have a very simple constructor in ActionScript as the following: public function ButtonTest() { this.addEventListener(MouseEvent.CLICK, browseFiles); } My problem is that when I open the SWF file itself, the window is not full size and the whole area responds to the mouse click. If I expand the window to full size, a margin ...

How to add event listeners in C#?

How to add event listeners in C#? ...

Custom event listener on Android app

Hi everybody, I need to set up a simple event listener to refresh a listview from once in a while. The problem is I don't know how could I generate an event. I know that for events like key or button pressing I just need to implement the handler. But in this specific case I actually need to generate the event, which will be fired everyt...

How do I add and remove an event listener using a function with parameters?

Sorry if this is a common question, but I couldn't find any answers that seemed pertinent through searching. If I attach an event listener like this: window.addEventListener('scroll', function() { check_pos(box); }, false); it doesn't seem to work to try to remove it later, like this: window.removeEventListener('scroll', function() ...

Flash AS3: position loaded images from loop based on image height

I'm trying to dynamically stack images that are being pulled in via an xml file. Below is what I'm doing, and it almost works. The problem is that it only seems to fire off the event complete function on the very last one, instead of going for all of them. Is there a way to make it run the even.complete function for each image? function...

HTML5 / JS storage event handler

Hi all, I'm using safari webkit's engine together with HTML5 and JS to create an offline application now I'm using the sessionStorage array to store status of my application(simulation). the storage data works fine with the inspector the functions work fine it's the event handler that isn't responding the test preformd by Anurag at ht...

Flash, ActionScript 3: how do you give a the EventListener a function With parameters?

I am trying to to attach a function with parameters to the timer but it says "unrelated type function" is there any way to get around this?? code example: var redoTimer:Timer = new Timer(50); redoTimer.addEventListener(TimerEvent.TIMER, saySomething("helloo")); redoTimer.start(); this wont seem to work but is there a way to pass on ...

Obtaining svg element 'id' attribute dynamically (Google SVG web)

(using http://code.google.com/p/svgweb/) window.onsvgload = function() { function onEnter(e) { var targ; if (!e) var e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode; alert(targ.hasAt...

Way to get element user is currently typing in within designMode iframe?

I have an iframe with designMode set to 'on'. In it, there are multiple divs, and because the iframe is editable, the user is able to type in and edit any one of those divs. I need to disable the ability for the user to edit one of the divs. I can prevent the user from clicking on the div like this: document.getElementById('mydiv').add...

Create Listener similar to MouseListener

I want to create a listener that works like mouselistener, but it must be a component: F.e. i have two JComponents (One is a button, and second is MyComponent), and i want to do following: button.addMyComponentListener(listener); And if MyComponent for example has moved above button, it must fires an event, or if MyComponent has change ...