views:

57

answers:

3

Is there not an event that occurs only when there has been some sort of visual change to an object. So for example if it were a video or animated object it would be firing as often as EnterFrame. However, if it were some sort of input control just sitting there doing nothing visually, then the event wouldn't fire until the visual state changed as a result of some sort of user input for example.

I've tried dozen's of events and none of them seem to fire this way.

A: 

For visual components about the closest you're going to get is FlexEvent.UPDATE_COMPLETE which will fire after an object has it's commitProperties(), measure() and updateDisplayList() called. If you're subclassing the component, then overriding updateDisplayList() and handling (or throwing you're own event) in there would ensure that you're only getting the event when something visual changes.

For video, you'll want to listen to VideoEvent.PLAYHEAD_UPDATE

daniel.reicher
A: 

(to daniel.reicher)

FYI - FlexEvent.UPDATE_COMPLETE, and UpdateDisplayList don't do anything, I just tried them.

Currently I'm having to use EnterFrame which just fires every 1/60 of a second or something regardless of whether there has been a change or not. I want to add my own custom visual changes if there has been any visual changes to the object on its own, but using ENTER_FRAME for this seems excessive.

The above two events are not working at all. The control in question is an SWFLoader with a loaded SWF application.

Mark
A: 

This is just a follow up because this question has not actually been resolved yet. The thing I failed to mention orginally, is that these are SWFLoaders with loaded swf's that I need to know which one has changed visually. I did come up with a partial solution actually:

If I have say five SwfLoaders scattered throughout a page, and one becomes invalid, it will cause a render event to be broadcast, but I still don't know how to find out which one is actually invalid so basically I have to redraw my custom changes to all of the SWFLoaders that are visible, when only one becomes invalid (still better though than just firing on EnterFrame).

The problem is, I don't know how to monitor events in a sub application (i.e a loaded swf in an swf loader). I don't know if its a security issue or what, but I am unable to do so. I think there must be events in an actual swf in an swfloader which would indicate if it was the one that actually needed to be redrawn, but I can't monitor those events. I set TrustContent to true, and also tried running through a web server, but I can't seem to stumble upon the correct syntactic formula to access those events (getDefinitionByName? etc.) I'm thinking updateComplete or something coming from one of these loaded SWF would indicate it has changed. (Somehow or another though, the message that one of the SWFLoaders has changed is reaching the main Application.) If detecting something like this is trivial perhaps someone can provide me the method.

Thanks.

Mark