以编程方式更改 Scroller 容器的位置(通过 HGroup 索引)
我正在尝试更改事件上 Scroller 容器的可见索引。 Scroller 包含一个带有图像的 HGroup,因此在发生事件时我想通过指定 HGroup 索引来更改哪些图像在 Scroller 中可见。这可能吗?
容器代码:
<s:Scroller id="test" includeIn="startState" x="53" y="20" width="170"
height="200" depth="2" scrollSnappingMode="leadingEdge">
<s:HGroup gap="0" width="170" height="200">
<s:Image id="BrigadeEmblem1" width="170" height="200" smooth="true"
smoothingQuality="high" source="assets/1st Stryker Brigade.png"
verticalAlign="middle"/>
<s:Image id="BrigadeEmblem4" width="170" height="200" smooth="true"
smoothingQuality="high" source="assets/4th Stryker Brigade.png"
verticalAlign="middle"/>
</s:HGroup>
</s:Scroller>
因此,例如,如果“BrigadeEmblem1”在滚动条中可见,我想在听到特定事件时以编程方式将可见图像更改为“BrigadeEmblem4”。
I am trying to change the visible index of a Scroller container on an event. The Scroller contains an HGroup with Images, so on an event I want to change which of the Images is visible in the Scroller by specifying an HGroup index. Is this possible?
Container code:
<s:Scroller id="test" includeIn="startState" x="53" y="20" width="170"
height="200" depth="2" scrollSnappingMode="leadingEdge">
<s:HGroup gap="0" width="170" height="200">
<s:Image id="BrigadeEmblem1" width="170" height="200" smooth="true"
smoothingQuality="high" source="assets/1st Stryker Brigade.png"
verticalAlign="middle"/>
<s:Image id="BrigadeEmblem4" width="170" height="200" smooth="true"
smoothingQuality="high" source="assets/4th Stryker Brigade.png"
verticalAlign="middle"/>
</s:HGroup>
</s:Scroller>
So, for example, if "BrigadeEmblem1" is visible in the Scroller, I want to programmatically change the visible image to "BrigadeEmblem4" if a specific event is heard.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正是如此!
Exactly That!
是的,实际上这是可能的。
我通过扩展 Scroller 类并创建此方法来完成此操作:
因此,当您想要第二个图像时:
Yes, actually this is possible.
I've done it by extending the Scroller-class and creating this method:
So when you want the second image:
答案有点晚了,但我希望这对某人有用。我编写了一些自动滚动
Scroller
的代码,以便聚焦的组件完全可见。您可以用它来解决您的问题It is a little bit late for the answer but I hope this could be useful for someone. I have written some code that automatically scrolls the
Scroller
so the focused component is completely visible. You can use it to solve your problem