简体   繁体   中英

Flash Builder 4.6 - ComboBox set to visible on underlying component MouseOver, but flickers when MouseOver of ComboBox

I have a ComboBox that is set to be visible when a component that lies beneath it is hovered, my problem is that when I hover over the ComboBox it starts flickering because I am leaving the underlying component.

My code is:

<fx:Script>
    <![CDATA[
        private function videoRollOut():void
        {
            controls.visible=false;
        }
        private function videoRollOver():void
        {
            controls.visible=true;
        }   
    ]]>
</fx:Script>

<mx:Canvas width="100%" height="46%">
    <mx:VideoDisplay id="localVideoDisplay" top="0" right="0" bottom="0" left="0" height="100%" width="100%" rollOver="videoRollOver()" rollOut="videoRollOut()"/>  
    <s:VGroup id="controls" bottom="10" right="0" left="0" horizontalAlign="center" visible="false" mouseOver="videoRollOver()" mouseOut="videoRollOut()">
        <s:HGroup verticalAlign="middle">
            <s:Label color="0xFFFFFF" text="Audio: "/>
            <s:ComboBox id="micSelection" change="micChanged(event)"
            dataProvider="{micNames}"/>
        </s:HGroup>
        <s:HGroup verticalAlign="middle">
            <s:Label color="0xFFFFFF" text="Video: "/>
            <s:ComboBox id="cameraSelection" change="cameraChanged(event)"
            dataProvider="{cameraNames}"/>
        </s:HGroup>
    </s:VGroup>
</mx:Canvas>

I attempted to add the same mouseOver and mouseOut functions to the ComboBox, and while I could now hover over the ComboBox without it flickering, when I tried to hover over some of the options it would leave both the ComboBox and the VideoDisplay, making the ComboBox once again invisible however keeping the options of the ComboBox visible.

I attempted to add a mouseEnabled="false" mouseChildren="false" to the ComboBox, however the ComboBox was then unusable.

If anyone has any advice that would be great!

您可以在videoRollOut方法中使用类似的方法

controls.visible=controls.getBounds(this).contains(mouseX,mouseY)?true:false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM