Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There seems to be nothing wrong with the way your listeners are assigned and removed in the code you've shown. I would suspect one of the following:</p> <p>a) Standard UI elements in Flash use the <a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/events/Event.html#CHANGE" rel="nofollow"><code>Event.CHANGE</code></a> constant to propagate changes, which resolves to the string "change", while your listeners are all assigned to "Changed". If just once you've added a listener to the native "change", your event listeners would correctly be called whenever the value changes, but <code>removeEventListener ("Changed",...)</code> would never work. In any case, you should always use string constants instead of character sequences when you assign or remove listeners, to avoid spelling mishaps.</p> <p>b) Your <code>event.target</code> does not resolve to the actual slideBar object, but to some nested <code>DisplayObject</code> using a <a href="http://www.rubenswieringa.com/blog/eventbubbles-eventcancelable-and-eventcurrenttarget" rel="nofollow">bubbling</a> event.</p> <p>c) The stage instances of your slideBars are not the same objects referenced in _sb1 and _sb2. This could happen if you create a new instance of the slideBar at some point, but never update the item's variables. To avoid this, you could use <code>event.target.removeEventListener()</code> instead of addressing _sb1 or _sb2 explicitly.</p> <p>d) Something is wrong with your logic. Are you certain the <code>removeEventListener</code> calls are ever made? Perhaps the if statements never evaluate to true? This could be the case, if either side of the comparison is <code>NaN</code>, or if the slideBar values are miscalculated.</p> <p>I also do not understand why you would want to remove the listeners at all - it seems you are creating some sort of filter mechanism, and while it makes sense to set <code>this._active</code> to <code>false</code> if the item is not in the specified range, you'd still have to listen for slideBar changes to reactivate it at a later time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload