调整包含路径的组大小时出现问题
我一直在尝试为通用应用程序构建一个非常简单的页脚,当用户将鼠标悬停在其上并适应应用程序的宽度时,该页脚会“增长”。这个简单的代码片段似乎可以解决问题:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"
currentState="normal">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
private const _lipWidth:Number = 8.64;
]]>
</fx:Script>
<s:states>
<s:State name="other"/>
<s:State name="normal"/>
</s:states>
<s:Group width="100%" bottom="0" rollOut="currentState = 'normal'" rollOver="currentState = 'other'">
<s:Path id="LargeRibbon" x="0" bottom="0" width="100%" includeIn="other"
data="M {width - _lipWidth} 0 L {_lipWidth} 0 C 3.951 0 0.149 3.721 0 8.363 L 0 40 L {width} 40 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
<s:fill>
<s:SolidColor color="blue"/>
</s:fill>
</s:Path>
<s:Path id="SmallRibbon" width="100%" x="0" y="0" includeIn="normal"
data="M {width - _lipWidth} 0 L 8.629 0 C 3.951 0 0.149 3.72 0 {_lipWidth} L 0 20 L {width} 20 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
<s:fill>
<s:SolidColor color="gray"/>
</s:fill>
</s:Path>
</s:Group>
</s:Application>
但是,如果我尝试向 LargeRibbon 路径添加阴影,
<s:filters>
<s:DropShadowFilter alpha="0.15" angle="-90" blurX="2" blurY="2" distance="1" quality="2"/>
</s:filters>
事情就会停止工作 - 更具体地说,如果您启动应用程序,将鼠标悬停在页脚上,放大应用程序,然后再次将鼠标悬停在页脚上LargeRibbon 似乎无法正确调整大小。我很想知道为什么会这样,更一般地说,我会喜欢您能提供的关于这个组/路径组合是否有意义的任何建议。
谢谢
I've been trying to build a very simple footer for a generic app that "grows" when the user hovers over it and adapts to the app's width. This simple snippet seems to do the trick:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"
currentState="normal">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
private const _lipWidth:Number = 8.64;
]]>
</fx:Script>
<s:states>
<s:State name="other"/>
<s:State name="normal"/>
</s:states>
<s:Group width="100%" bottom="0" rollOut="currentState = 'normal'" rollOver="currentState = 'other'">
<s:Path id="LargeRibbon" x="0" bottom="0" width="100%" includeIn="other"
data="M {width - _lipWidth} 0 L {_lipWidth} 0 C 3.951 0 0.149 3.721 0 8.363 L 0 40 L {width} 40 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
<s:fill>
<s:SolidColor color="blue"/>
</s:fill>
</s:Path>
<s:Path id="SmallRibbon" width="100%" x="0" y="0" includeIn="normal"
data="M {width - _lipWidth} 0 L 8.629 0 C 3.951 0 0.149 3.72 0 {_lipWidth} L 0 20 L {width} 20 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z">
<s:fill>
<s:SolidColor color="gray"/>
</s:fill>
</s:Path>
</s:Group>
</s:Application>
However, if I try to add a shadow to the LargeRibbon path
<s:filters>
<s:DropShadowFilter alpha="0.15" angle="-90" blurX="2" blurY="2" distance="1" quality="2"/>
</s:filters>
things stop working - more specifically if you start the app, hover over the footer, enlarge the app, and then hover over the footer again LargeRibbon does not seem to properly resize. Would love to know why this is and more generally would love any advice you can spare on whether this group / path combination makes sense or not.
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这段代码工作正常:
为什么它不能直接将过滤器放置在LargeRibbon中,我建议这是某种位图缓存问题。
This code works fine:
What about the reason why it is not working with placing filter in
LargeRibbon
directly I suggest it is some kind of bitmap caching issue.