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 7177607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:44:59+00:00 2026-05-28T16:44:59+00:00

I have written code as follows. Problem is that I can’t remove Event.COMPLETE event

  • 0

I have written code as follows.
Problem is that I can’t remove Event.COMPLETE event listener and when I call the loadData function twice or more, it works 2 times or more. Sorry for my bad english and worse explanation but I need to fix it today and I don’t know what to do.
I think the code is pretty obvious. please help!

var ldr:URLLoader = new URLLoader();

function loadData(text_place, scrollbar, fileURL:String):void {
    text_place.wordWrap = true;
    var f:TextFormat = new TextFormat();
    f.align = TextFormatAlign.RIGHT;
    text_place.setTextFormat(f);
    ldr.dataFormat = URLLoaderDataFormat.TEXT;
    ldr.load(new URLRequest(fileURL));
    ldr.addEventListener(Event.COMPLETE, function ldr_complete(evt:Event){ 
        initText(text_place, ldr.data, scrollbar);
    });
    ldr.addEventListener(IOErrorEvent.IO_ERROR, loadError);
}

function initText(text_place:TLFTextField, fileContent, scrollbar):void {
    ldr.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
    text_place.htmlText = "";
    text_place.tlfMarkup = fileContent;
    scrollbar.update();
    trace("Data loaded");
}

function loadError(e:IOErrorEvent):void {
    trace("Error loading an external file.");
}
  • 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-05-28T16:45:00+00:00Added an answer on May 28, 2026 at 4:45 pm

    if you want to stop listening for an event after it triggered, you can unregister the anonymous listener in itself:

    ldr.addEventListener(Event.COMPLETE, function(event:Event):void
    {
         event.target.removeEventListener(event.type, arguments.callee);
         // ... do whatever you need to do here
    });
    

    But if you also want to stop listening for other events from the same dispatcher when it completes, such as your IOErrorEvent.IO_ERROR listener, you’d still need a reference to that listener to remove it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically my problem can be written in pseudo-code as follows: split the line
I have written code that automatically creates CSS sprites based on the IMG tags
I have written code that opens 16 figures at once. Currently, they all open
I have written this code to join ArrayList elements: Can it be optimized more?
I have written some code to ensure that items on an order are all
I use UIActivityIndicator in my app. I have written code for it as follows:
I have written some code in Java that will decode a SHOUTcast stream and
I have some code (written by another developer) that is doing AJAX page loading
I have written code in Java to access web cam,and to save image... I
I have written some code in my VB.NET application to send an HTML e-mail

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.