【问题标题】:Flex 4.6 Zoom EventFlex 4.6 缩放事件
【发布时间】:2012-12-14 01:52:02
【问题描述】:

我刚刚在 Flex 4.6 中为移动应用程序启动一个新项目,需要一些帮助来决定如何继续。

嗯,基本上该应用程序会显示一个 15x15 的棋盘,就像拼字游戏一样。因此,每个图块的宽度将由一个取决于设备最大宽度的公式给出,因此每行将自动调整 15 个图块。

问题是我需要添加一些事件,例如 ZOOM,范围从 x1 到 x2 和 MOVE,如果 ZOOM 大于 x1,用户可以在其中拖动板。

完成这个项目的更好方法是什么?

我有以下代码:

<s:BorderContainer width="100%" height="60%" id="board_holder">
    <s:TileGroup width="100%" requestedColumnCount="15" requestedRowCount="15">
        <s:Rect radiusX="{radio_tile}" radiusY="{radio_tile}" width="{_ancho_tile}" height="{_ancho_tile}">
            <s:fill>
                <s:SolidColor color="#FB2A27" alpha="0.75" />
            </s:fill>
        </s:Rect>

        <s:Rect radiusX="{radio_tile}" radiusY="{radio_tile}" width="{_ancho_tile}" height="{_ancho_tile}">
            <s:fill>
                <s:SolidColor color="#FB2A27" alpha="0.75" />
            </s:fill>
        </s:Rect>

        <s:Rect radiusX="{radio_tile}" radiusY="{radio_tile}" width="{_ancho_tile}" height="{_ancho_tile}">
            <s:fill>
                <s:SolidColor color="#FB2A27" alpha="0.75" />
            </s:fill>
        </s:Rect>


               ....... he there are more tiles till complete the whole 15x15 board tiles

    </s:TileGroup>
</s:BorderContainer>

【问题讨论】:

  • ...您是否在 mxml 中声明了所有 225 个图块?
  • 是的,我正在为每个图块放置 Rect 组件。
  • 如果它们相同,为什么不在循环中创建和添加 then?

标签: actionscript-3 apache-flex flex4.5


【解决方案1】:

您可能想要 GESTURE_SWIPEGESTURE_ZOOM - 请参阅 Adob​​e 的文档 Touch, multitouch and gesture input

【讨论】:

  • 这里的问题是当板子缩放并且它比屏幕宽时如何限制平移区域,所以当您移动板子时,顶部边框和左边框在到达屏幕轮廓时停止移动.
  • 这是滚动条提供的标准功能
猜你喜欢
  • 2013-06-20
  • 2014-07-14
  • 1970-01-01
  • 2012-06-13
  • 1970-01-01
  • 2012-05-09
  • 2011-03-09
  • 2021-10-11
  • 2020-04-13
相关资源
最近更新 更多