Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9260641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:56:41+00:00 2026-06-18T12:56:41+00:00

I cant remove Event of rute_button, rute_button.removeEventlistener is not work. is there something wrong

  • 0

I cant remove Event of rute_button, rute_button.removeEventlistener is not work.
is there something wrong about function tampil_rute(t) ? thanks..

function tampil(t)
{
    rute_button.addEventListener(MouseEvent.CLICK, tampil_rute(t));
    //tampil_rute(t);
    var _loadertampil:URLLoader = new URLLoader();
    var _datatampil:XML = new XML();
    _loadertampil.addEventListener(Event.COMPLETE, readXMLtampil);
    _loadertampil.load(new URLRequest("http://localhost/mall_baru/tampil2.php?id="+t));
    function readXMLtampil(evttampil:Event)
    {
    _datatampil = new XML(evttampil.target.data);
    var tampilanx = _datatampil..tenant_name;
    tampilan.text = String(tampilanx);
    trace("tampilan ="+tampilanx);
    }
}
function tampil_rute(t)
{
    return function( f:MouseEvent ) 
    {
    var c = t.split("_", 2);
    var d:String = String(c[0]);
    var e:Number = Number(c[1]);
    for(var i:Number=1; i<=e; i++)
    {
        tambahan_tampil_rute(d,i);
    }
        rute_button.removeEventListener(MouseEvent.CLICK, tampil_rute(t));
    }
}
function tambahan_tampil_rute(d, i)
{
    this["rute_"+d+"_"+i].visible=true;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:56:42+00:00Added an answer on June 18, 2026 at 12:56 pm

    The problem is in the returned function by tampil_rute(t), each time you call this function this is returning a new object of type Function, if you want to remove the event listener, you must be sure to pass the same object (Function) to the removeEventListener function.

    You can fix it as follow:

    function tampil_rute(t)
    {
        var listener:*; // create a variable to store your listener reference
    
        listener = function( f:MouseEvent ) 
        {
            var c = t.split("_", 2);
            var d:String = String(c[0]);
            var e:Number = Number(c[1]);
            for(var i:Number=1; i<=e; i++)
            {
                tambahan_tampil_rute(d,i);
            }
    
            rute_button.removeEventListener(MouseEvent.CLICK, listener); // Put the reference here
        }
    
        return listener; // Return the listener here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created this example The remove function doesn't work, and I can't figure out
On the first attempt I wrote this.collection.each(function(element){ element.destroy(); }); This does not work, because
I can't seem to find the function to remove a shape or path from
Cant get this script to work with my menu really have tried everything any
Hey i've set a toggle event on an element and i wish to remove
Whenever you add a delegate to an event handler, you should remove it later,
In the documentation of the event args of NotifyCollectionChangedEventArgs, there is an action called
Is it possible to remove all the spans or event the element styling from
How can you bind a change (or add/remove) event to a object or collection
I'm trying to add & remove an event handler from a Silverlight FrameworkElement, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.