开发者

Flash CS4 combobox not showing when embedded

开发者 https://www.devze.com 2022-12-15 21:30 出处:网络
I have a Flash CS4 movie that uses a standard Flash combobox. This works fine, as long as I don\'t use the resulting SWF embedded on a HTML page. When I do embed it, the combobox doesn\'t show up, doe

I have a Flash CS4 movie that uses a standard Flash combobox. This works fine, as long as I don't use the resulting SWF embedded on a HTML page. When I do embed it, the combobox doesn't show up, doesn't dispatch mouse events, it's just as if it doesn't exist. However, if I switch to fullscreen, the combobox appears and functions normally, even if I switch back from fullscreen.

I think this is a bug in the component, Flash CS4 or the Flash player itself, since it also happens on an empty movie with just the combobox there. All I've found when I googled开发者_如何学Go is someone with the same problem, but no solution.

Can anyone suggest a fix or workaround?


I have found that setting the wmode attribute in the <embed> tag to window (it was set to transparent before) solves the problem. Why this causes problems with the combobox (and just the combobox, afaict), I have no idea, but I'm glad I solved this problem.

EDIT: I've found a workaround in code, so I'm still able to use the transparent wmode. Apparently, the problem is that Flash player doesn't dispatch Event.RENDER events when it's in wmode transparent. The trick is to dispatch that event manually, on key moments. This is my solution:

private function renderStage(e:Event=null){
 stage.dispatchEvent(new Event(Event.RENDER));
}

myComboBox.addEventListener(ListEvent.ITEM_CLICK, renderStage);
myComboBox.addEventListener(ListEvent.ITEM_DOUBLE_CLICK, renderStage);
myComboBox.addEventListener(ListEvent.ITEM_ROLL_OUT, renderStage);
myComboBox.addEventListener(ListEvent.ITEM_ROLL_OVER, renderStage);
myComboBox.addEventListener(Event.CHANGE, renderStage);

This appears to work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号