Monday 2007/10/22
10:50 AM

Categories: Flash/Actionscript, Technology's Betrayal

Flash CS3 Components and WMode

I recently ran into an issue with the Flash CS3 ComboBox component – it doesn’t render when you set the wmode for the movie to transparent. I was at a loss for a solution until I saw Sex Panzer’s comment on this post.

Following his advice I added a stage.dispatchEvent(new Event(Event.RENDER)) line to my code, which basically kicks the code in the pants and gets it to render the component properly.

I tested a few other components and they all seem to be affected by the wmode bug, so hopefully the solution above works for all of them.


Responses


Tom

Tuesday 2008/09/02 8:00 PM

hi just wondering whereabouts you add the stage.dispatchEvent(new Event(Event.RENDER)) to..

im trying to apply it to when the datagrid component get’s its visibility but it’s returning a null object reference


ds

Wednesday 2008/09/03 9:52 AM

Tom-

I haven’t used it with the datagrid component before, so there may be something else going on. I was using the combobox in a custom form component. I had added the component in my class constructor, and added a stage event listener for when the form was added to stage, at which point I made the stage.dispatchEvent() call. You may be seeing a case where the stage is null because the object containing the datagrid has not been added to the stage yet.

So in my form’s constructor I had:

addEventListener(Event.ADDEDTOSTAGE, onAddedToStage);

and then:

private function onAddedToStage(event: Event): void { removeEventListener(Event.ADDEDTOSTAGE, onAddedToStage); stage.dispatchEvent(new Event(Event.RENDER)); }


Leave a Response