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

The Archive Base Latest Questions

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

I am trying to get some code working from an example I came across.

  • 0

I am trying to get some code working from an example I came across. most of the functionality works but it is failing when it tries to dispatch a custom event. At the moment the code that is trying to dispatch the event is inside a class that handles amf remoting.

the example has this line in it for the dispatch:

Application.application.dispatchEvent(new  
RemoteResultEvent(RemoteResultEvent.USER_UPDATE_COMPLETE,"test"));

but that fails as it does not know what application.application is “Multiple markers at this line:
-Access of undefined property application”

I assume that this is because this was not written for a mobile app. I tried changing the dispatcher to EventDispatcher

EventDispatcher(
new RemoteResultEvent(RemoteResultEvent.USER_UPDATE_COMPLETE, "worked"));

but I then get this error:

TypeError: Error #1034: Type Coercion failed: cannot convert events::RemoteResultEvent@18337731 to flash.events.EventDispatcher.

This is the code in the custom event RemoteResultEvent.as :

package events
{

import flash.events.Event;
public class RemoteResultEvent extends Event {

    public static var USER_UPDATE_COMPLETE:String = "UserUpdateComplete";
    public var message:String;

    public function RemoteResultEvent(eventType:String, message:String) {
        super(eventType, false, false);
        this.message = message;
    }

}
}

I am bumbling around in the dark as I am new to flex and this type of development so I could well be doing something really dumb. Any help would be gratefully received.

Thanks

JaChNo

  • 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-26T16:54:45+00:00Added an answer on May 26, 2026 at 4:54 pm

    You seem confused about event dispatching in general.

    Events can be dispatched in any Flex class that extends, or has a, EventDispatcher. Most Flex Components, including Application extend EventDispatcher. To dispatch the event, you are on the right track just do:

    dispatchEvent(new RemoteResultEvent(RemoteResultEvent.USER_UPDATE_COMPLETE,"test"));
    

    That will dispatch the event from your current class. Not that all Flex UI Components, including those made in MXML can be considered a class.

    What you are trying to do is dispatch the event on the main level application; which is a horrible encapsulation breach, but doable. You have to cast it as an Application so you do not get a generic object. Like this:

    (Application.application as Application).dispatchEvent(new RemoteResultEvent(RemoteResultEvent.USER_UPDATE_COMPLETE,"test")); 
    

    This approach is deprecated since Flex 4; and you use the FlexGlobals.topLevelApplication instead:

    (FlexGlobals.topLevelapplication as Application).dispatchEvent(new RemoteResultEvent(RemoteResultEvent.USER_UPDATE_COMPLETE,"test"))
    

    You don’t say, but you allude to the fact that you are in a Mobile Project. If so, I would not expect the mx Application class to be available unless you explicitly added the SWC w/ MX Components to your class. You’ll have to access the Spark Application, which does not have an Application property. That could be why you are getting the error.

    Be sure to import the proper application you want to use:

    import spark.components.Application 
    

    More info on Spark Application class.

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

Sidebar

Related Questions

I'm trying to get some code working that a previous developer has written. Yep,
Ok, so I'm trying to get some UDP code working and I'm barely green
I am trying to get some form data from POST method. Here's the code
Trying to get comfortable with jQuery and I have encountered some sample code that
I'm trying to write some C# code to get to a specific folder in
I'm having some problems trying to get the code below to output the data
I am trying to get some XML data with LINQ, but running into a
I have been working with the example code from the ExecutorCompletionService and put together
According to my previous post I am trying to get back some information from
Im trying to get some checkbox with a specific name document.getElementsByName(test); Unfortunatley i cant

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.