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

  • Home
  • SEARCH
  • 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 7634463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:10:55+00:00 2026-05-31T07:10:55+00:00

I read a lot about dispatching events and still cant get it to work.

  • 0

I read a lot about dispatching events and still cant get it to work. I have a class and want it events to be visible for other classes which using this one. Main class:

import special.proxy.ProxyStream;
public class testproxy extends Sprite
{
    var textspace:TextField=new TextField();
    var proxydata:*;

    public function testproxy()
    {
        textspace.autoSize="left";
        textspace.text="ready";
        addChild(textspace);
        try
        {
        proxydata=new ProxyStream();
        addChild(proxydata);
        proxydata.load(proxyurl_string, fileurl_string);
        proxydata.addEventListener("COMPLETE", complete);
        proxydata.addEventListener(Event.COMPLETE, complete);
        }
        catch(e:*){textspace.text=String(e);}
        setTimeout(checkProgress, 2000);            
    }

    function checkProgress(){textspace.text=proxydata.progressstate;}

    function complete(){textspace.text="loaded";}
}

Class which dispatching event for main class:

import flash.events.*;
public class ProxyStream extends Sprite {

    public var progressstate:String="0";
    //[Event(name="complete", type="flash.events.Event")]
    [Event(name="complete",  type="flash.events.Event.COMPLETE")] 

    private function complete(e:Event):void {
        progressstate="1";
        dispatchEvent(e);
        dispatchEvent(new Event("COMPLETE", true, true));
        //dispatchEvent(new Event(Event.COMPLETE, true, true));
        //dispatchEvent(new DataEvent("COMPLETE", false, false, e.target.data));
    }
}

As we can see, proxy data is added to display list. And yes, function complete firing, because when I check progressstate after 2 seconds, it has value 1. I tried many different ways of dispatching event. I still cant get this class event in my main class. I also want to be able to send data with this event if its possible without making additional own event class. Thanks for any help.

  • 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-31T07:10:57+00:00Added an answer on May 31, 2026 at 7:10 am

    Your complete event lister does not have the correct parameters. It should be complete(event:Event):void, not complete()

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

Sidebar

Related Questions

I have read a lot about this issue but mine still seems to be
I have read a lot about the Java class loading process lately. Often I
I read a lot about handling rotation in android applications, but I still have
I have read a lot about unit testing, but I still haven't found any
Even though I have read a lot about it I can't get my head
Recently I have read a lot about different NoSQL databases and how they are
I have heard a lot about anti patterns and would like to read a
I've read a lot about Mercurial and branching in it, however, I am still
I have googled a lot and read a lot about the leaks issue with
This should be something simple, I have read a lot about the organization browser

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.