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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:14:20+00:00 2026-05-15T20:14:20+00:00

Is it possible to grab an event, hold it in a class property, do

  • 0

Is it possible to grab an event, hold it in a class property, do some action, then, when that action is complete, dispatch an event and then retrieve the original event.target in the listener?

I am trying to avoid using a custom event for now, as it is giving me massive amounts of heartburn when dispatching it from a loaded SWF.

Here is some code (that doesn’t work) that hopefully will help to understand what I am attempting to do:

package
{
    import fl.transitions.easing.Regular;
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.net.URLLoader;
    import flash.net.URLRequest;

    public class Document extends MovieClip
    {
        protected var _event:Event;

        public function Document():void
        {
            initLoader();
        }

        protected function initLoader():void
        {
            var loader:URLLoader = new URLLoader();
            loader.load(new URLRequest('some_url.xml'));
            loader.addEventListener(Event.COMPLETE, intermediaryHandler);
        }

        protected function intermediaryHandler(event:Event):void
        {
            _event = event;
            doSomeAction();
        }

        protected function doSomeAction():void
        {
            var tween:Tween = new Tween(someObject, "alpha", Regular.easeIn, 0, 1, 5);
            tween.addEventListener(TweenEvent.MOTION_FINISH, tweenHandler);
        }

        protected function tweenHandler(event:TweenEvent):void
        {
            /*
             * Imagine some object is listening to this class for Event.COMPLETE.
             * I would like to retrieve the event.target that I could have retrieved
             * in the `intermediaryHandler()` method, in the listener to the following
             * event being dispatched:
             */
            dispatchEvent(_event);
        }
    }
}

I am able to stash the event in a class variable, and then access it later, but the cherry on the icing would be to get it from the event fired withing tweenHandler() in my example above.

Edit
Well, it doesn’t look possible (thanks @bhups for the explanation). I am currently storing the retrieved event in a property _event and then getting it at a later time when I need it. This seems to work, but isn’t wonderful.

  • 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-15T20:14:21+00:00Added an answer on May 15, 2026 at 8:14 pm

    I am afraid it is not possible. Whenever you are re-dispatching an Event, then Flash Runtime makes a clone of it and dispatches it into the Event Flow. And once Event goes to the Event Flow then, its properties can not be altered. target and currentTarget are read-only properties of an Event object. So without using a CustomEvent it is not possible to achieve what you are trying to do.
    What problem exactly you’re facing when using Custom Event?

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

Sidebar

Related Questions

I am not sure if this is even possible, with that said... below is
I'm creating a Windows service that makes use of a FileSystemWatcher to monitor a
Possible Duplicate: Is there a way to create a SQL Server function to "join"
Possible Duplicate: Is there a way to create a SQL Server function to "join"
I'm making my own commentbox control that inherits from a winforms textbox. One of
I'm currently developing an application that interacts directly with a puzzle game in C#.
I have a stored procedure that adds an object to the database and returns
This is probably a simple question but i've been unable to find a quick
I've been writing a Greasemonkey script for Chrome (drags and drops as an extension)
I want to group my data by the hour/day possibly even to the quarter

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.