Question

I want to override flash.display.Loader and to dispatch my own Event with a my own target.content

How can i override Event.target? "Property is read only"

Or use some other way to unit test the loading sequence

tnx Hed

Was it helpful?

Solution

The target is always set to the object that dispatches the event. The proper way to unit test loading sequence is to mock the loaders - this unit test should test the logic used for loading sequentially, not the file system or network connection.

Wrap your loader into a custom class implementing a custom loader interface that extends IEventDispatcher. Use that interface to create a mock loader, and dispatch the event from the mock object.

OTHER TIPS

You can't override target property. Though you can trick flash with special custom extended event but that will get ugly very soon.

What you need to do is to create a mock loader which contains a Loader instance, catches its event and dispatches a new one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top