为什么 Flex Viewstack 会“闪烁”在视图之间切换时?
我正在开发一个应用程序,我希望视图堆栈在某些事件上切换视图。我让它们正确切换,但当视图之间发生变化时,似乎有轻微的“闪烁”。我尝试过 creationPolicy="all" 但这并不能解决问题。 “闪烁”如此明显的原因是视图堆栈中的视图具有不同的宽度/高度。有没有办法阻止 viewstack 视图切换上的这种“闪烁”效果?
这是发生视图切换的代码:
function show(value:String):void {
switch(value) {
case "ShapeObject":
viewstack.selectedIndex = 2;
break;
case "AssetObject":
viewstack.selectedIndex = 0;
break;
}
}
这是视图堆栈的 mxml:
<mx:ViewStack id="viewstack" resizeToContent="true" clipContent="false" creationPolicy="all" mouseDown="stopPropagationClick(event)" click="stopPropagationClick(event)">
<mx:HBox id="shapeMenu" width="250" height="44" verticalAlign="middle" horizontalAlign="center" horizontalGap="0">
<mx:Image source="@Embed(source='assets/objectTools_greyBack_left.png')" height="100%" width="10"/>
<mx:HBox verticalAlign="middle" horizontalAlign="center" backgroundSize="100%" height="100%" width="100%" styleName="contextualCenterBkg">
<ui:HTMLLabelButton id="ConstrainShape" name="{_appData.textXML.designer.toolbars.shapeControlEditor.proportionalResize.@tooltip}" styleName="btnContextualConstrain" click="{btnClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<mx:ColorPicker name="{_appData.textXML.designer.toolbars.shapeControlEditor.shapeColorPicker.@tooltip}" close="onColorPickerClose(event)" change="{onShapeColorPickerChange(event)}" open="onColorPickerOpen(event)" click="stopPropagationClick(event)" mouseDown="stopPropagationClick(event)" focusEnabled="false" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.bringForward.@tooltip}" styleName="btnContextualSendForward" click="{onSendToFrontClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.sendBackward.@tooltip}" styleName="btnContextualSendBack" click="{onSendToBackClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.deleteControl.@tooltip}" id="DeleteShape" styleName="btnContextualDelete" click="{btnClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
</mx:HBox>
<mx:Image source="@Embed(source='assets/objectTools_greyBack_right.png')" height="100%" width="10"/>
</mx:HBox>
<mx:HBox id="multiMenu" width="250" height="44" verticalAlign="middle" horizontalAlign="center" horizontalGap="0">
<mx:Image source="@Embed(source='assets/objectTools_greyBack_left.png')" height="100%" width="10"/>
<mx:HBox verticalAlign="middle" horizontalAlign="center" backgroundSize="100%" height="100%" width="100%" styleName="contextualCenterBkg">
<ui:HTMLLabelButton id="ConstrainShapeMulti" name="{_appData.textXML.designer.toolbars.shapeControlEditor.proportionalResize.@tooltip}" styleName="btnContextualConstrain" click="{btnClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.bringForward.@tooltip}" styleName="btnContextualSendForward" click="{onSendToFrontClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.sendBackward.@tooltip}" styleName="btnContextualSendBack" click="{onSendToBackClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.deleteControl.@tooltip}" id="DeleteShapeMulti" styleName="btnContextualDelete" click="{btnClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
</mx:HBox>
<mx:Image source="@Embed(source='assets/objectTools_greyBack_right.png')" height="100%" width="10"/>
</mx:HBox>
</mx:ViewStack>
I'm working on an app in which I want the viewstack to switch views on certain events. I have them switching correctly but there appears to be a slight "blink" when the change between views occurs. I've tried creationPolicy="all" but that doesn't fix the problem. The reason the "blink" is so noticeable is the fact that the views in the viewstack are different width/heights. Is there a way to stop this "blinking" effect on viewstack view switch?
Here is the code in which the view switch happens:
function show(value:String):void {
switch(value) {
case "ShapeObject":
viewstack.selectedIndex = 2;
break;
case "AssetObject":
viewstack.selectedIndex = 0;
break;
}
}
Here is the mxml for the viewstack:
<mx:ViewStack id="viewstack" resizeToContent="true" clipContent="false" creationPolicy="all" mouseDown="stopPropagationClick(event)" click="stopPropagationClick(event)">
<mx:HBox id="shapeMenu" width="250" height="44" verticalAlign="middle" horizontalAlign="center" horizontalGap="0">
<mx:Image source="@Embed(source='assets/objectTools_greyBack_left.png')" height="100%" width="10"/>
<mx:HBox verticalAlign="middle" horizontalAlign="center" backgroundSize="100%" height="100%" width="100%" styleName="contextualCenterBkg">
<ui:HTMLLabelButton id="ConstrainShape" name="{_appData.textXML.designer.toolbars.shapeControlEditor.proportionalResize.@tooltip}" styleName="btnContextualConstrain" click="{btnClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<mx:ColorPicker name="{_appData.textXML.designer.toolbars.shapeControlEditor.shapeColorPicker.@tooltip}" close="onColorPickerClose(event)" change="{onShapeColorPickerChange(event)}" open="onColorPickerOpen(event)" click="stopPropagationClick(event)" mouseDown="stopPropagationClick(event)" focusEnabled="false" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.bringForward.@tooltip}" styleName="btnContextualSendForward" click="{onSendToFrontClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.sendBackward.@tooltip}" styleName="btnContextualSendBack" click="{onSendToBackClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.deleteControl.@tooltip}" id="DeleteShape" styleName="btnContextualDelete" click="{btnClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
</mx:HBox>
<mx:Image source="@Embed(source='assets/objectTools_greyBack_right.png')" height="100%" width="10"/>
</mx:HBox>
<mx:HBox id="multiMenu" width="250" height="44" verticalAlign="middle" horizontalAlign="center" horizontalGap="0">
<mx:Image source="@Embed(source='assets/objectTools_greyBack_left.png')" height="100%" width="10"/>
<mx:HBox verticalAlign="middle" horizontalAlign="center" backgroundSize="100%" height="100%" width="100%" styleName="contextualCenterBkg">
<ui:HTMLLabelButton id="ConstrainShapeMulti" name="{_appData.textXML.designer.toolbars.shapeControlEditor.proportionalResize.@tooltip}" styleName="btnContextualConstrain" click="{btnClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.bringForward.@tooltip}" styleName="btnContextualSendForward" click="{onSendToFrontClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.sendBackward.@tooltip}" styleName="btnContextualSendBack" click="{onSendToBackClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
<ui:HTMLLabelButton name="{_appData.textXML.designer.toolbars.shapeControlEditor.deleteControl.@tooltip}" id="DeleteShapeMulti" styleName="btnContextualDelete" click="{btnClick(event)}" mouseOver="_tips.tip(event);" mouseOut="_tips.tip(event);"/>
</mx:HBox>
<mx:Image source="@Embed(source='assets/objectTools_greyBack_right.png')" height="100%" width="10"/>
</mx:HBox>
</mx:ViewStack>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
flex-blog.com/flex-effects-example-in-a-viewstack
谢谢 www.Flextras.com
首先制作一个视图堆栈:
然后进行一些过渡:
然后应用过渡:
flex-blog.com/flex-effects-example-in-a-viewstack
Thanks www.Flextras.com
First make a viewstack:
Then make some transitions:
Then apply the transitions:
http://tv.adobe.com/watch/codedependent/ flex-4-states-and-transitions/ <== 好了
http://tv.adobe.com/watch/codedependent/flex-4-states-and-transitions/ <== There ya go