Flash combobox appearance bug when using a system that blocks access to stage

I am developing SWFs for a platform which blocks the code from accessing the stage for security sandbox reasons (and also accepts SWFs built for Flash Player 9 only).

I am trying to add the default Flash component combobox. While going through this component's class code I see Adobe coders have already set up try and catch blocks internally for deallying with these stage access scenarios, and indeed when I test this component I don't get any errors.

BUT

These components appear wrong. When playing them on the stage-blocking platform they look like this (showing two comboboxes closed, one with a prompt):

when they should look like this and indeed look like this when tested locally:

Let me clarify that they work as expected only constantly display this white-textinput-box on top of the combobox. This surely has to do with stage access and focus problems (looks like the component is always kind of in focus).

I would like to alter this components code so that they appear right. Any ideas?


I have found the same issue. My Combobox is in external SWF loaded by AIR application and displays exactly like your screencaps show. While I haven't figured out exactly why this occurs, I have developed this workaround:

  function normalizedComponentTf(component:Sprite):void {
    for (var i:int = 0; i < component.numChildren; i++) {
        component.getChildAt(i).alpha = 0;
        if( component.getChildAt(i) is TextField )
        {
            component.getChildAt(i).alpha = 1;
        }
    }
}

Then simply call this function by passing in the textField property of the Combobox component like this:

normalizedComponentTf( comboBoxInstance.textField ); // 

If you don't have access to the code in the child SWF containing the Combobox, then in the parent MovieClip iterate through the children of the child SWF per the process described here: AS3 - Adding item to a combobox in a loaded swf

Hope this helps.

链接地址: http://www.djcxy.com/p/17738.html

上一篇: 如何访问Flash CS3中的组成员

下一篇: 使用禁止访问舞台的系统时,Flash组合框出现错误