`
diding
  • 浏览: 81259 次
  • 性别: Icon_minigender_1
  • 来自: 四川
社区版块
存档分类
最新评论

Flex 4.5 – Using Mobile View Transitions

    博客分类:
  • Flex
阅读更多
收录的一篇文章:
原文地址:http://devgirl.org/2011/05/12/flex-4-5-using-mobile-view-transitions/

While navigating through a Flex mobile application from view to view (screen to screen), there is a default transition (animation or effect) that occurs by default and can be customized. It’s called a view transition in Flex mobile lingo, and there are 4 different classes available in the spark.transitions package for you to use out of the box in Flex 4.5:

    * SlideViewTransition
    * CrossFadeViewTransition
    * FlipViewTransition
    * ZoomViewTransition

You can use any of these transition classes with their default properties or set the direction, duration and mode (for some) to cause a different effect such as shown in the following code snippet:
var flipTrans:FlipViewTransition = new FlipViewTransition();
flipTrans.direction = ViewTransitionDirection.UP;
flipTrans.mode = FlipViewTransitionMode.CUBE; //or CARD mode
navigator.pushView(SampleZoom,null,null,flipTrans);
 
var zoomTrans:ZoomViewTransition = new ZoomViewTransition();
zoomTrans.direction = ViewTransitionDirection.RIGHT;
zoomTrans.mode = ZoomViewTransitionMode.IN; //or OUT mode
navigator.popToFirstView(zoomTrans);
 
var slideTrans:SlideViewTransition = new SlideViewTransition();
slideTrans.direction = ViewTransitionDirection.DOWN;
slideTrans.mode = SlideViewTransitionMode.UNCOVER;  //or COVER and PUSH modes
navigator.pushView(SampleZoom,null,null,slideTrans);
 
var fadeTrans:CrossFadeViewTransition = new CrossFadeViewTransition();
fadeTrans.direction = ViewTransitionDirection.LEFT;
// no modes are available for CrossFadeViewTransition
navigator.pushView(SampleZoom,null,null,fadeTrans);


var flipTrans:FlipViewTransition = new FlipViewTransition();
flipTrans.direction = ViewTransitionDirection.UP;
flipTrans.mode = FlipViewTransitionMode.CUBE; //or CARD mode
navigator.pushView(SampleZoom,null,null,flipTrans);

var zoomTrans:ZoomViewTransition = new ZoomViewTransition();
zoomTrans.direction = ViewTransitionDirection.RIGHT;
zoomTrans.mode = ZoomViewTransitionMode.IN; //or OUT mode
navigator.popToFirstView(zoomTrans);

var slideTrans:SlideViewTransition = new SlideViewTransition();
slideTrans.direction = ViewTransitionDirection.DOWN;
slideTrans.mode = SlideViewTransitionMode.UNCOVER;  //or COVER and PUSH modes
navigator.pushView(SampleZoom,null,null,slideTrans);

var fadeTrans:CrossFadeViewTransition = new CrossFadeViewTransition();
fadeTrans.direction = ViewTransitionDirection.LEFT;
// no modes are available for CrossFadeViewTransition
navigator.pushView(SampleZoom,null,null,fadeTrans);

By default the SlideViewTransition (push mode with direction of left) is used for the pushing/popping of all views. It causes the view to slide into place when you are navigating between views. You can change the default transition used for all navigation by setting navigator.defaultPushTransition (when a new view is pushed onto the stack) and navigator.defaultPopTransition (when the view is popped off the view stack so the view beneath it is shown) to an instance of another transition class such as in the code snippet below:

navigator.defaultPushTransition = new FlipViewTransition();
navigator.defaultPopTransition = new FadeViewTransition();


You can set these properties on any navigator within the main ViewNavigatorApplication or TabbedViewNavigatorApplication or View class itself. However if you want it to apply for the entire application you would set it in the root application code.

I recently built a sample using each of these transitions to show how they work, including how to use the modes that might be available (for instance on the FlipViewTransition you can specify card or cube mode), and how applying an easing function such as Bounce or Elastic might affect how it plays (fun stuff )! Here is a screenshot of the sample application:


And below is a short video clip I recorded of it running on my iPod Touch. It’s nothing fancy but you can see the different effects played when the 4 different view transition types are used including what the easing effect might do:

All of the ViewTransition classes extend ViewTransitionBase. The ViewTransitionBase class (and all that extend it) will dispatch a FlexEvent.TRANSITION_START and FlexEvent.TRANSITION_END event when the transition starts and ends respectively. You can create your own custom transitions extending ViewTransitionBase. If you plan to do so though, there’s a lot of information you should first review in the Flex 4.5 ViewTransition specification located here. Note that this is the original specification and some names of properties, events etc have changed.
The source, Flex project (fxp), .ipa and .apk (for iOS and Android) for the recorded sample above can be downloaded here!
分享到:
评论

相关推荐

    transition_ViewTransitions

    《过渡动画:ViewTransitions详解》 在Android开发中,ViewTransitions是UI交互中一个重要的组成部分,它赋予了界面动态、平滑的过渡效果,极大地提升了用户体验。本篇文章将深入探讨ViewTransitions的相关知识点,...

    IOS应用源码——ViewTransitions.rar

    【标题】"IOS应用源码——ViewTransitions.rar"揭示了这个压缩包是关于iOS平台上的视图转换动画实现的源代码。在iOS开发中,视图转换是用户体验中的重要一环,它涉及到用户界面元素从一个状态平滑地过渡到另一个状态...

    flex4.5.1.chm flex4API文档

    11. **移动开发支持**:Flex 4.5版本开始,增加了对移动设备的支持,能够创建运行在iOS和Android上的应用程序。 这个CHM文件包含了所有这些特性和更多内容的详细文档,包括类、方法、属性、事件的描述,示例代码,...

    Flex4权威指南源代码

    12. **Mobile支持**:Flex 4扩展到了移动领域,Flex 4.5引入了针对Android和iOS设备的Air SDK,允许开发者创建跨平台的移动应用。 通过《Flex4权威指南》的源代码,开发者可以学习到如何有效地运用这些技术,从简单...

    ios viewTransitions

    "ios viewTransitions"是一个官方示例项目,旨在演示如何在iOS应用中实现视图的平滑切换,包括上、下、左、右四个方向的动画效果。这个项目对于理解iOS中的视图控制器(UIViewController)和动画编程非常有帮助。 ...

    Using_Flex_4.rar

    综上所述,Using_Flex_4.pdf文档很可能是关于如何利用Flex 4开发高级Web应用的指南,涵盖了Flex 4的核心特性、最佳实践以及常见问题的解决方案。通过深入学习这份文档,开发者将能熟练掌握Flex 4的精髓,打造出富有...

    FLEX4_Flex4教程 - FLEX4从入门到精通,挺不错的值得一看

    4. **States和Transitions**:Flex4中的States和Transitions机制允许开发者轻松管理UI的不同状态,比如在不同视图之间切换,以及添加平滑的动画效果,提高用户体验。 5. **数据绑定**:Flex4的数据绑定功能使得UI...

    Flex4_Tutorials中文版

    9. **移动开发支持**:Flex 4.5引入了Flash Builder 4.5,开始支持移动设备开发,允许开发者创建适用于Android、iOS等平台的应用程序。 10. **Flex SDK和Flash Builder**:Flex 4教程通常会涵盖Flex SDK的使用,它...

    flex 官方文档 中文教程

    Flex是由Adobe公司开发的一种开放源码的富互联网应用程序(RIA)框架,主要用于构建和部署跨平台、跨浏览器的互动用户界面。本教程基于Flex官方文档,旨在为开发者提供中文版的详细学习指南,帮助理解并掌握Flex的...

    Python有限状态机——transitions

    Python中的有限状态机库——`transitions`是一个强大的工具,用于在对象之间管理状态转换。这个库使得在Python代码中实现复杂的状态逻辑变得简洁而直观。`transitions`库不仅适用于简单的状态切换,还能处理条件触发...

    flex4 学习资料

    5. **_states_ 和 _transitions_**:Flex4中新增的状态管理机制,使得组件在不同状态间切换更加平滑,可以定义过渡效果(transitions)来实现动态视觉效果。 6. **Graphical Asset Creation**:包括位图、矢量图...

    FLEX教程码源集合

    - **动画和效果**:通过Flex的Animate类和Transitions API,开发者可以轻松创建动态效果,增强用户体验。 总之,这份"FLEX教程码源集合"是一个全面的学习资源,无论你是初学者还是有经验的开发者,都能从中找到有...

    Flex 简单的几个实例 

    在本篇文章中,我们将深入探讨Flex中的"States Transitions"概念,并通过一个登录切换状态的实例来帮助你理解这一功能。 一、Flex简介 Flex为开发者提供了强大的组件库,可以轻松构建具有丰富用户界面的应用程序。...

    FLEX特效包

    5. **Scene3D** 和 **Sprite3D**:这些是Flex 4.5(Gumbo)引入的新类,用于更复杂的3D场景构建。Scene3D作为3D渲染的容器,而Sprite3D则作为3D场景中的对象。 6. **Away3D** 和 **Papervision3D**:这两个是第三方...

    Android代码-Transitions-Everywhere

    Transitions Everywhere Backport of Android Transitions API. Animations backported to Android 4.0 . API compatible with Android 2.2 ... View.VISIBLE : View.GONE); Article and sample ap

    web版切水果(flex开发)

    在“切水果”中,水果的落下、切割效果、分数的飞涨等都可以通过Flex的Animate类和Transitions API来实现,让游戏更加生动有趣。 此外,Flex支持数据绑定和Model-View-Controller(MVC)设计模式,这有助于代码组织...

    前端开源库-glsl-transitions

    "前端开源库-glsl-transitions"就是这样一个资源,专为前端开发者提供了一套在Web上实现视觉过渡效果的GLSL着色器。 GLSL(OpenGL Shading Language)是一种编程语言,用于编写图形处理单元(GPU)上的着色器。在...

    导航折叠特效(flex3)

    4. ** 动画效果**:为了让折叠过程更加平滑,可以使用Flex3的Animate类或Transitions类添加过渡效果。这些效果可以控制组件在展开和折叠时的速度、方向和其他视觉属性。 5. ** 图片和视觉元素**:在提供的压缩包中...

    Flex4开发实践PPT

    Flex4,全称为Adobe Flex 4,是Adobe公司推出的一款强大的富互联网应用程序(RIA)开发框架,主要用于构建具有丰富用户体验的Web应用。本PPT详细讲述了Flex4的开发实践,旨在帮助开发者从基础到实践全面掌握这一技术...

    Flex4中文快速入门

    Flex4,全称为Adobe Flex 4,是Adobe公司推出的一款用于构建富互联网应用程序(Rich Internet Applications,RIAs)的框架,主要基于ActionScript和MXML。这个框架在2010年发布,提供了更为强大的图形渲染能力,以及...

Global site tag (gtag.js) - Google Analytics