문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top