SlideShare une entreprise Scribd logo
1  sur  66
Télécharger pour lire hors ligne
Having fun with Flex 4 Layouts
Enrique Duvos
Xavi Beumala
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Speaker and session intro
Enrique Duvos
@eduvos
Group Manager,
EMEA Flash Platform Evangelism
http://www.duvos.com
Xavi Beumala
@xbeumala
Technical Architect, TXI
http://www.rialvalue.com
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Agenda
■
Speaker and Session intro
■
Reviewing Flex 3 Layouts
■
UIComponent lifecycle and the role of the LayoutManager class
■
Spark (Flex 4) layouts
■
What’s new
■
Assignable layouts
■
Virtualization
■
Pixel based scrolling
■
Transformations
■
Custom layouts
■
“Demotime”
■
Runtime layout control, scrolling, sizing, pre & post-layout transforms, virtualization
arbitrary 2D/3D transformations (Coverflow, Accordion3D, Carrowflow, Flip effect, etc)
■
Summary
■
Q&A
3
Thursday, 4 November 2010
Flex 3 Layouts
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Flex 3
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Flex 3
‣ UIComponent lifecycle remains intact as in Flex3
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Flex 3
‣ UIComponent lifecycle remains intact as in Flex3
‣ UIComponent lifecycle has been extended to support pluggable layouts
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Flex 3
Construction
Addition
Initialization
Invalidation
Validation
Update
Removal
BirthGrowth&
maturity
Death
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Invalidation - Validation Cycle
InvalidationValidation
invalidate properties
invalidate size
invalidate display list
commit properties
measure
layout chrome
Update
Layout Manager Render or EnterFrame event
Thursday, 4 November 2010
Spark Layouts
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Important concepts
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Important concepts
‣ UIComponent lifecycle remains intact as in Flex3
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Important concepts
‣ UIComponent lifecycle remains intact as in Flex3
‣ s:Group is the basis of the containment model in Spark
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Important concepts
‣ UIComponent lifecycle remains intact as in Flex3
‣ s:Group is the basis of the containment model in Spark
‣ s:Group can be seen as an mx:Container but with all the rarely used
functionality stripped away
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Important concepts
‣ UIComponent lifecycle remains intact as in Flex3
‣ s:Group is the basis of the containment model in Spark
‣ s:Group can be seen as an mx:Container but with all the rarely used
functionality stripped away
‣ Container components compute Layout through delegation
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Important concepts
‣ UIComponent lifecycle remains intact as in Flex3
‣ s:Group is the basis of the containment model in Spark
‣ s:Group can be seen as an mx:Container but with all the rarely used
functionality stripped away
‣ Container components compute Layout through delegation
‣ s:DataGroup is a data-driven Group with ItemRenderers. mx:Repeater
done right
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Assignable Layouts
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Assignable Layouts
‣ Layouts are assigned by composition and not inheritance
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Assignable Layouts
‣ Layouts are assigned by composition and not inheritance
vs.
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Assignable Layouts
‣ Layouts are assigned by composition and not inheritance
vs.
Benefits
‣ Number of container components is reduced
‣ Layout logic is decoupled from container components promoting
modularity and code reuse
‣ Interchangeable at runtime
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Assignable Layouts
Flex 3 Flex4
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Assignable Layouts
Flex 3 Flex4
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Assignable Layouts
Flex 3 Flex4Flex4
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Assignable Layouts
Flex 3 Flex4Flex4
‣ The most used combinations have been packaged as components by
themselves for commodity
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Virtualization
‣ Virtualization improves runtime performance by creating and recycling
item renderers only as they come into the visible content area of a
container (a.k.a Viewport).
‣ Built-in support on DataGroup or SkinnableDataContainer containers with
VerticalLayout, HorizontalLayout and TileLayout.
‣ Spark Lists are virtualised out-of-the-box
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Virtualization
‣ Virtualization improves runtime performance by creating and recycling
item renderers only as they come into the visible content area of a
container (a.k.a Viewport).
‣ Built-in support on DataGroup or SkinnableDataContainer containers with
VerticalLayout, HorizontalLayout and TileLayout.
‣ Spark Lists are virtualised out-of-the-box
Benefits
‣ Improved performance
‣ Number of itemRenderers instances reduced to the minimum
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Virtualization
Flex3
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Virtualization
Flex4
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Transformations
‣ 2D & 3D Transformations
The LayoutBase and ILayoutElement interfaces are designed with 3D support in mind
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Transformations
‣ Post-layout transforms
Properties like x, y, rotate or scale on individual renderers can be modified without
affecting the layout
Layout reflows when changing the size
Layout is not affected by the size transformation
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Transformations
‣ Post-layout transforms
Properties like x, y, rotate or scale on individual renderers can be modified without
affecting the layout
1. spark.effects.AnimateTransform.applyChangesPostLayout (value : Boolean )
2. mx.core.UIComponent.postLayoutTransformOffsets( value : TransformOffsets)
3. mx.core.UIComponent.transformAround(...)
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Depth Order
‣ IVisualElement.depth
‣ Controls the order in which items inside containers are rendered
‣ Depth can be changed dynamically to overlap elements as needed
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Custom Layouts
‣ Quick and established way to create custom layouts extending
LayoutBase and implementing ILayoutElement
‣ Knowledge reuse to instantiate and use the layouts. No new component
APIs
Thursday, 4 November 2010
Demos
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Demo I
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Demo I
‣ Changing the layout at runtime
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Demo I
‣ Changing the layout at runtime
‣ Adding animations when changing the layout
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Demo I
‣ Changing the layout at runtime
‣ Adding animations when changing the layout
‣ http://evtimmy.com/2010/04/two-examples-of-layout-animations/
Thursday, 4 November 2010
Building a
Custom Layout
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: The Basics
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: The Basics
‣ Layouts extend LayoutBase
‣ LayoutBase is not a UIComponent but it has some familiar methods
‣ measure ()
‣ updateDisplayList()
‣ The invalidation - validation pattern is driven by the host component. To
invalidate the layout we have to invalidate the target component
‣ The host component invokes these methods by delegation during its
validation - invalidation cycle
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: The Basics
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: The Basics
‣ Extending LayoutBase
‣ Using ILayoutElement interface
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: ILayoutElement
‣ element.setLayoutBounds( width : Number, height : Number,
postLayout : Boolean )
‣ element.getLayoutBoundsHeight()
‣ element.getLayoutBoundsWidth()
‣ element.transformAround()
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: Scrolling
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: Scrolling
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: Scrolling
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: Sizing
‣ What happens if we don’t specify the width or height of the container
‣ Nothing will be displayed
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: 2D Layout transforms
‣ IVisualElement.setLayoutMatrix( )
‣ IVisualElement.transformAround( )
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: 2D Layout transforms
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: 3D Layout transforms
‣ IVisualElement.setLayoutMatrix3D( )
‣ IVisualElement.transformAround( )
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: 3D Layout transforms
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Custom layout: Virtualization
‣ LayoutBase.useVirtualLayout
‣ Instead of using target.getElementAt use target.getVirtualElementAt
‣ Using the scroll position IViewPort.horizontalScrollPosition and
IViewPort.verticalScrollPosition find out the visual items within the
ViewPort
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Spark layouts: Misc
‣ UIComponent.IncludeInLayout
‣ Elements with includeInLayout=false are not sized or positioned
‣ Useful to reduce the amount of nested containers and thus the
performance under some situations
‣ GroupBase.autoLayout
‣ When true, measurement and layout are done when the position or
size of a child is changed
‣ The new layout mechanism allows smooth pixel-perfect scrolling
Thursday, 4 November 2010
Demos
More Layouts
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
WheelLayout
by Evtim Georgiev
http://evtimmy.com/2009/06/wheellayout-source-and-quick-mashup/
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
TimeMachine Layout
by Gilles Guillemin
http://www.flexstuff.co.uk/2009/11/06/flex-4-animated-timemachine-layout/
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Fan Layout
by Miti Pricope
http://miti.pricope.com/2009/05/29/playing-with-custom-layout-in-flex-4/
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Coverflow
by Xavi Beumala
http://www.rialvalue.com/blog/2010/03/30/flex4-coverflow-layout/
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Accordion3DLayout
by Xavi Beumala
http://
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Carroflow Layout
by Xavi Beumala
http://www.rialvalue.com/blog/2010/04/14/carroflow-another-3d-layout-for-flex4/
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Summary
■
UIComponent lifecycle remains intact
■
Spark based layouts are decoupled from containers and assigned by
composition
■
New containers and APIs enables richer and more creative layouts ( 2D/
3D, Pixel based scrolling, Virtualization, pre and post-transforms
■
Links:
■
www.rialvalue.com
■
www.duvos.com
■
http://www.evtimmy.com/
■
www.adobe.com/devnet/flex/articles/spark_layouts.html
■
www.oreilly.com/flex/excerpts/flex-4-cookbook/layout.html
■
http://www.ryancampbell.com/
■
http://www.flexstuff.co.uk/
45
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Summary
■
More Links:
■
http://opensource.adobe.com/wiki/display/flexsdk/Spark+Virtualization
■
Item Renderers: http://help.adobe.com/en_US/flex/using/
WS03d33b8076db57b9-23c04461124bbeca597-8000.html#WS5ED0A932-
BA59-4a77-9A9D-3745FE21D1E9
46
Thursday, 4 November 2010
Q&A
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Thanks
■
Thanks to Evtim Georgiev Flex SDK Engineer for reviewing the
presentation
48
Thursday, 4 November 2010
©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Thursday, 4 November 2010

Contenu connexe

Tendances

Flex vs HTML5
Flex vs HTML5Flex vs HTML5
Flex vs HTML5Ray Wong
 
Open Source examples from Adobe : Oscon kiosk
Open Source examples from Adobe : Oscon kioskOpen Source examples from Adobe : Oscon kiosk
Open Source examples from Adobe : Oscon kioskDave McAllister
 
Flex vs. HTML5 for RIAS
Flex vs. HTML5 for RIASFlex vs. HTML5 for RIAS
Flex vs. HTML5 for RIASPamela Fox
 
Flex 4 Overview
Flex 4 OverviewFlex 4 Overview
Flex 4 OverviewRJ Owen
 
Adobe flex an overview
Adobe flex  an overviewAdobe flex  an overview
Adobe flex an overviewSubin Sugunan
 
Apache Flex: Overview
Apache Flex: OverviewApache Flex: Overview
Apache Flex: OverviewTarun Telang
 
Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.Joseph Labrecque
 
Better Drupal Interaction Design with Flex
Better Drupal Interaction Design with FlexBetter Drupal Interaction Design with Flex
Better Drupal Interaction Design with FlexChris Charlton
 
A Brief Intro to Adobe Flex
A Brief Intro to Adobe FlexA Brief Intro to Adobe Flex
A Brief Intro to Adobe FlexChad Udell
 
The Evolution of the Flash Platform
The Evolution of the Flash PlatformThe Evolution of the Flash Platform
The Evolution of the Flash PlatformPeter Elst
 
WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...Denise Williams
 
Adobe Max 2009 - Learnings
Adobe Max 2009 -  LearningsAdobe Max 2009 -  Learnings
Adobe Max 2009 - Learningsziblu
 
FileMaker Scripting Best Practices
FileMaker Scripting Best PracticesFileMaker Scripting Best Practices
FileMaker Scripting Best PracticesDB Services
 
AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )senthil0809
 

Tendances (17)

Flex vs HTML5
Flex vs HTML5Flex vs HTML5
Flex vs HTML5
 
Open Source examples from Adobe : Oscon kiosk
Open Source examples from Adobe : Oscon kioskOpen Source examples from Adobe : Oscon kiosk
Open Source examples from Adobe : Oscon kiosk
 
Flex vs. HTML5 for RIAS
Flex vs. HTML5 for RIASFlex vs. HTML5 for RIAS
Flex vs. HTML5 for RIAS
 
Flex 4 Overview
Flex 4 OverviewFlex 4 Overview
Flex 4 Overview
 
Adobe flex an overview
Adobe flex  an overviewAdobe flex  an overview
Adobe flex an overview
 
Apache Flex: Overview
Apache Flex: OverviewApache Flex: Overview
Apache Flex: Overview
 
Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.
 
Better Drupal Interaction Design with Flex
Better Drupal Interaction Design with FlexBetter Drupal Interaction Design with Flex
Better Drupal Interaction Design with Flex
 
A Brief Intro to Adobe Flex
A Brief Intro to Adobe FlexA Brief Intro to Adobe Flex
A Brief Intro to Adobe Flex
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
 
An Overview Of Wpf
An Overview Of WpfAn Overview Of Wpf
An Overview Of Wpf
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
 
The Evolution of the Flash Platform
The Evolution of the Flash PlatformThe Evolution of the Flash Platform
The Evolution of the Flash Platform
 
WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...
 
Adobe Max 2009 - Learnings
Adobe Max 2009 -  LearningsAdobe Max 2009 -  Learnings
Adobe Max 2009 - Learnings
 
FileMaker Scripting Best Practices
FileMaker Scripting Best PracticesFileMaker Scripting Best Practices
FileMaker Scripting Best Practices
 
AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )
 

Similaire à Max 2010: Having Fun Flex4 Layouts

Bootstrap4XPages
Bootstrap4XPagesBootstrap4XPages
Bootstrap4XPagesTeamstudio
 
Drupal and-flex-drupal camp
Drupal and-flex-drupal campDrupal and-flex-drupal camp
Drupal and-flex-drupal campClaudiu Cristea
 
Adobe FrameMaker Workshop TC Camp 2015
Adobe FrameMaker Workshop TC Camp 2015Adobe FrameMaker Workshop TC Camp 2015
Adobe FrameMaker Workshop TC Camp 2015Maxwell Hoffmann
 
Soirée Flex/RIA au Nantes jug
Soirée Flex/RIA au Nantes jugSoirée Flex/RIA au Nantes jug
Soirée Flex/RIA au Nantes jugFrançois Le Droff
 
Flash and Flex in an HTML5 / App Store World
Flash and Flex in an HTML5 / App Store WorldFlash and Flex in an HTML5 / App Store World
Flash and Flex in an HTML5 / App Store WorldEffectiveUI
 
Afik Gal @alphageeks: Flex Intro
Afik Gal @alphageeks: Flex IntroAfik Gal @alphageeks: Flex Intro
Afik Gal @alphageeks: Flex IntroAlphageeks
 
Ria Development With Flex And PHP
Ria Development With Flex And PHPRia Development With Flex And PHP
Ria Development With Flex And PHPJohn Coggeshall
 
SNIA SDC 2010 Scality SCOP Launch
SNIA SDC 2010 Scality SCOP LaunchSNIA SDC 2010 Scality SCOP Launch
SNIA SDC 2010 Scality SCOP LaunchMarc Villemade
 
Introducing ofgodpaperframework
Introducing ofgodpaperframeworkIntroducing ofgodpaperframework
Introducing ofgodpaperframeworkyangbo zhou
 
Developing for Mobile with the Flex Framework
Developing for Mobile with the Flex FrameworkDeveloping for Mobile with the Flex Framework
Developing for Mobile with the Flex FrameworkMatthew Fabb
 
Mobile Development With Flash Platform
Mobile Development With Flash PlatformMobile Development With Flash Platform
Mobile Development With Flash PlatformMihai Corlan
 
Maximize Your oXygen Usage - oXygen XML, Syncro Soft
Maximize Your oXygen Usage - oXygen XML, Syncro SoftMaximize Your oXygen Usage - oXygen XML, Syncro Soft
Maximize Your oXygen Usage - oXygen XML, Syncro SoftIXIASOFT
 
Spark Pipelines in the Cloud with Alluxio by Bin Fan
Spark Pipelines in the Cloud with Alluxio by Bin FanSpark Pipelines in the Cloud with Alluxio by Bin Fan
Spark Pipelines in the Cloud with Alluxio by Bin FanData Con LA
 
Flash Professional CC: The Future of Animation
 Flash Professional CC: The Future of Animation Flash Professional CC: The Future of Animation
Flash Professional CC: The Future of AnimationFITC
 
Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
 Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-HornsteinYandex
 
Adobe jax2010 1_dashboard
Adobe jax2010 1_dashboardAdobe jax2010 1_dashboard
Adobe jax2010 1_dashboardguest9776673
 

Similaire à Max 2010: Having Fun Flex4 Layouts (20)

Bootstrap4XPages
Bootstrap4XPagesBootstrap4XPages
Bootstrap4XPages
 
Drupal and-flex-drupal camp
Drupal and-flex-drupal campDrupal and-flex-drupal camp
Drupal and-flex-drupal camp
 
Adobe FrameMaker Workshop TC Camp 2015
Adobe FrameMaker Workshop TC Camp 2015Adobe FrameMaker Workshop TC Camp 2015
Adobe FrameMaker Workshop TC Camp 2015
 
flex_4_tutorials
flex_4_tutorialsflex_4_tutorials
flex_4_tutorials
 
flex_4_tutorials
flex_4_tutorialsflex_4_tutorials
flex_4_tutorials
 
Soirée Flex/RIA au Nantes jug
Soirée Flex/RIA au Nantes jugSoirée Flex/RIA au Nantes jug
Soirée Flex/RIA au Nantes jug
 
Flash and Flex in an HTML5 / App Store World
Flash and Flex in an HTML5 / App Store WorldFlash and Flex in an HTML5 / App Store World
Flash and Flex in an HTML5 / App Store World
 
Afik Gal @alphageeks: Flex Intro
Afik Gal @alphageeks: Flex IntroAfik Gal @alphageeks: Flex Intro
Afik Gal @alphageeks: Flex Intro
 
Site Manager rocks!
Site Manager rocks!Site Manager rocks!
Site Manager rocks!
 
Ria Development With Flex And PHP
Ria Development With Flex And PHPRia Development With Flex And PHP
Ria Development With Flex And PHP
 
SNIA SDC 2010 Scality SCOP Launch
SNIA SDC 2010 Scality SCOP LaunchSNIA SDC 2010 Scality SCOP Launch
SNIA SDC 2010 Scality SCOP Launch
 
Introducing ofgodpaperframework
Introducing ofgodpaperframeworkIntroducing ofgodpaperframework
Introducing ofgodpaperframework
 
Developing for Mobile with the Flex Framework
Developing for Mobile with the Flex FrameworkDeveloping for Mobile with the Flex Framework
Developing for Mobile with the Flex Framework
 
Mobile Development With Flash Platform
Mobile Development With Flash PlatformMobile Development With Flash Platform
Mobile Development With Flash Platform
 
Maximize Your oXygen Usage - oXygen XML, Syncro Soft
Maximize Your oXygen Usage - oXygen XML, Syncro SoftMaximize Your oXygen Usage - oXygen XML, Syncro Soft
Maximize Your oXygen Usage - oXygen XML, Syncro Soft
 
Spark Pipelines in the Cloud with Alluxio by Bin Fan
Spark Pipelines in the Cloud with Alluxio by Bin FanSpark Pipelines in the Cloud with Alluxio by Bin Fan
Spark Pipelines in the Cloud with Alluxio by Bin Fan
 
Flash Professional CC: The Future of Animation
 Flash Professional CC: The Future of Animation Flash Professional CC: The Future of Animation
Flash Professional CC: The Future of Animation
 
Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
 Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
Building Quality Code That Lasts: A Dropbox Story. Ashley Nelson-Hornstein
 
Adobe Flex
Adobe FlexAdobe Flex
Adobe Flex
 
Adobe jax2010 1_dashboard
Adobe jax2010 1_dashboardAdobe jax2010 1_dashboard
Adobe jax2010 1_dashboard
 

Max 2010: Having Fun Flex4 Layouts

  • 1. Having fun with Flex 4 Layouts Enrique Duvos Xavi Beumala Thursday, 4 November 2010
  • 2. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Speaker and session intro Enrique Duvos @eduvos Group Manager, EMEA Flash Platform Evangelism http://www.duvos.com Xavi Beumala @xbeumala Technical Architect, TXI http://www.rialvalue.com Thursday, 4 November 2010
  • 3. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Agenda ■ Speaker and Session intro ■ Reviewing Flex 3 Layouts ■ UIComponent lifecycle and the role of the LayoutManager class ■ Spark (Flex 4) layouts ■ What’s new ■ Assignable layouts ■ Virtualization ■ Pixel based scrolling ■ Transformations ■ Custom layouts ■ “Demotime” ■ Runtime layout control, scrolling, sizing, pre & post-layout transforms, virtualization arbitrary 2D/3D transformations (Coverflow, Accordion3D, Carrowflow, Flip effect, etc) ■ Summary ■ Q&A 3 Thursday, 4 November 2010
  • 4. Flex 3 Layouts Thursday, 4 November 2010
  • 5. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Flex 3 Thursday, 4 November 2010
  • 6. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Flex 3 ‣ UIComponent lifecycle remains intact as in Flex3 Thursday, 4 November 2010
  • 7. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Flex 3 ‣ UIComponent lifecycle remains intact as in Flex3 ‣ UIComponent lifecycle has been extended to support pluggable layouts Thursday, 4 November 2010
  • 8. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Flex 3 Construction Addition Initialization Invalidation Validation Update Removal BirthGrowth& maturity Death Thursday, 4 November 2010
  • 9. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Invalidation - Validation Cycle InvalidationValidation invalidate properties invalidate size invalidate display list commit properties measure layout chrome Update Layout Manager Render or EnterFrame event Thursday, 4 November 2010
  • 10. Spark Layouts Thursday, 4 November 2010
  • 11. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Important concepts Thursday, 4 November 2010
  • 12. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Important concepts ‣ UIComponent lifecycle remains intact as in Flex3 Thursday, 4 November 2010
  • 13. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Important concepts ‣ UIComponent lifecycle remains intact as in Flex3 ‣ s:Group is the basis of the containment model in Spark Thursday, 4 November 2010
  • 14. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Important concepts ‣ UIComponent lifecycle remains intact as in Flex3 ‣ s:Group is the basis of the containment model in Spark ‣ s:Group can be seen as an mx:Container but with all the rarely used functionality stripped away Thursday, 4 November 2010
  • 15. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Important concepts ‣ UIComponent lifecycle remains intact as in Flex3 ‣ s:Group is the basis of the containment model in Spark ‣ s:Group can be seen as an mx:Container but with all the rarely used functionality stripped away ‣ Container components compute Layout through delegation Thursday, 4 November 2010
  • 16. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Important concepts ‣ UIComponent lifecycle remains intact as in Flex3 ‣ s:Group is the basis of the containment model in Spark ‣ s:Group can be seen as an mx:Container but with all the rarely used functionality stripped away ‣ Container components compute Layout through delegation ‣ s:DataGroup is a data-driven Group with ItemRenderers. mx:Repeater done right Thursday, 4 November 2010
  • 17. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Assignable Layouts Thursday, 4 November 2010
  • 18. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Assignable Layouts ‣ Layouts are assigned by composition and not inheritance Thursday, 4 November 2010
  • 19. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Assignable Layouts ‣ Layouts are assigned by composition and not inheritance vs. Thursday, 4 November 2010
  • 20. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Assignable Layouts ‣ Layouts are assigned by composition and not inheritance vs. Benefits ‣ Number of container components is reduced ‣ Layout logic is decoupled from container components promoting modularity and code reuse ‣ Interchangeable at runtime Thursday, 4 November 2010
  • 21. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Assignable Layouts Flex 3 Flex4 Thursday, 4 November 2010
  • 22. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Assignable Layouts Flex 3 Flex4 Thursday, 4 November 2010
  • 23. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Assignable Layouts Flex 3 Flex4Flex4 Thursday, 4 November 2010
  • 24. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Assignable Layouts Flex 3 Flex4Flex4 ‣ The most used combinations have been packaged as components by themselves for commodity Thursday, 4 November 2010
  • 25. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Virtualization ‣ Virtualization improves runtime performance by creating and recycling item renderers only as they come into the visible content area of a container (a.k.a Viewport). ‣ Built-in support on DataGroup or SkinnableDataContainer containers with VerticalLayout, HorizontalLayout and TileLayout. ‣ Spark Lists are virtualised out-of-the-box Thursday, 4 November 2010
  • 26. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Virtualization ‣ Virtualization improves runtime performance by creating and recycling item renderers only as they come into the visible content area of a container (a.k.a Viewport). ‣ Built-in support on DataGroup or SkinnableDataContainer containers with VerticalLayout, HorizontalLayout and TileLayout. ‣ Spark Lists are virtualised out-of-the-box Benefits ‣ Improved performance ‣ Number of itemRenderers instances reduced to the minimum Thursday, 4 November 2010
  • 27. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Virtualization Flex3 Thursday, 4 November 2010
  • 28. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Virtualization Flex4 Thursday, 4 November 2010
  • 29. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Transformations ‣ 2D & 3D Transformations The LayoutBase and ILayoutElement interfaces are designed with 3D support in mind Thursday, 4 November 2010
  • 30. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Transformations ‣ Post-layout transforms Properties like x, y, rotate or scale on individual renderers can be modified without affecting the layout Layout reflows when changing the size Layout is not affected by the size transformation Thursday, 4 November 2010
  • 31. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Transformations ‣ Post-layout transforms Properties like x, y, rotate or scale on individual renderers can be modified without affecting the layout 1. spark.effects.AnimateTransform.applyChangesPostLayout (value : Boolean ) 2. mx.core.UIComponent.postLayoutTransformOffsets( value : TransformOffsets) 3. mx.core.UIComponent.transformAround(...) Thursday, 4 November 2010
  • 32. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Depth Order ‣ IVisualElement.depth ‣ Controls the order in which items inside containers are rendered ‣ Depth can be changed dynamically to overlap elements as needed Thursday, 4 November 2010
  • 33. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Custom Layouts ‣ Quick and established way to create custom layouts extending LayoutBase and implementing ILayoutElement ‣ Knowledge reuse to instantiate and use the layouts. No new component APIs Thursday, 4 November 2010
  • 35. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Demo I Thursday, 4 November 2010
  • 36. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Demo I ‣ Changing the layout at runtime Thursday, 4 November 2010
  • 37. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Demo I ‣ Changing the layout at runtime ‣ Adding animations when changing the layout Thursday, 4 November 2010
  • 38. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Demo I ‣ Changing the layout at runtime ‣ Adding animations when changing the layout ‣ http://evtimmy.com/2010/04/two-examples-of-layout-animations/ Thursday, 4 November 2010
  • 40. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: The Basics Thursday, 4 November 2010
  • 41. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: The Basics ‣ Layouts extend LayoutBase ‣ LayoutBase is not a UIComponent but it has some familiar methods ‣ measure () ‣ updateDisplayList() ‣ The invalidation - validation pattern is driven by the host component. To invalidate the layout we have to invalidate the target component ‣ The host component invokes these methods by delegation during its validation - invalidation cycle Thursday, 4 November 2010
  • 42. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: The Basics Thursday, 4 November 2010
  • 43. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: The Basics ‣ Extending LayoutBase ‣ Using ILayoutElement interface Thursday, 4 November 2010
  • 44. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: ILayoutElement ‣ element.setLayoutBounds( width : Number, height : Number, postLayout : Boolean ) ‣ element.getLayoutBoundsHeight() ‣ element.getLayoutBoundsWidth() ‣ element.transformAround() Thursday, 4 November 2010
  • 45. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: Scrolling Thursday, 4 November 2010
  • 46. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: Scrolling Thursday, 4 November 2010
  • 47. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: Scrolling Thursday, 4 November 2010
  • 48. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: Sizing ‣ What happens if we don’t specify the width or height of the container ‣ Nothing will be displayed Thursday, 4 November 2010
  • 49. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: 2D Layout transforms ‣ IVisualElement.setLayoutMatrix( ) ‣ IVisualElement.transformAround( ) Thursday, 4 November 2010
  • 50. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: 2D Layout transforms Thursday, 4 November 2010
  • 51. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: 3D Layout transforms ‣ IVisualElement.setLayoutMatrix3D( ) ‣ IVisualElement.transformAround( ) Thursday, 4 November 2010
  • 52. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: 3D Layout transforms Thursday, 4 November 2010
  • 53. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom layout: Virtualization ‣ LayoutBase.useVirtualLayout ‣ Instead of using target.getElementAt use target.getVirtualElementAt ‣ Using the scroll position IViewPort.horizontalScrollPosition and IViewPort.verticalScrollPosition find out the visual items within the ViewPort Thursday, 4 November 2010
  • 54. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Spark layouts: Misc ‣ UIComponent.IncludeInLayout ‣ Elements with includeInLayout=false are not sized or positioned ‣ Useful to reduce the amount of nested containers and thus the performance under some situations ‣ GroupBase.autoLayout ‣ When true, measurement and layout are done when the position or size of a child is changed ‣ The new layout mechanism allows smooth pixel-perfect scrolling Thursday, 4 November 2010
  • 56. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. WheelLayout by Evtim Georgiev http://evtimmy.com/2009/06/wheellayout-source-and-quick-mashup/ Thursday, 4 November 2010
  • 57. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. TimeMachine Layout by Gilles Guillemin http://www.flexstuff.co.uk/2009/11/06/flex-4-animated-timemachine-layout/ Thursday, 4 November 2010
  • 58. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Fan Layout by Miti Pricope http://miti.pricope.com/2009/05/29/playing-with-custom-layout-in-flex-4/ Thursday, 4 November 2010
  • 59. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Coverflow by Xavi Beumala http://www.rialvalue.com/blog/2010/03/30/flex4-coverflow-layout/ Thursday, 4 November 2010
  • 60. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Accordion3DLayout by Xavi Beumala http:// Thursday, 4 November 2010
  • 61. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Carroflow Layout by Xavi Beumala http://www.rialvalue.com/blog/2010/04/14/carroflow-another-3d-layout-for-flex4/ Thursday, 4 November 2010
  • 62. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Summary ■ UIComponent lifecycle remains intact ■ Spark based layouts are decoupled from containers and assigned by composition ■ New containers and APIs enables richer and more creative layouts ( 2D/ 3D, Pixel based scrolling, Virtualization, pre and post-transforms ■ Links: ■ www.rialvalue.com ■ www.duvos.com ■ http://www.evtimmy.com/ ■ www.adobe.com/devnet/flex/articles/spark_layouts.html ■ www.oreilly.com/flex/excerpts/flex-4-cookbook/layout.html ■ http://www.ryancampbell.com/ ■ http://www.flexstuff.co.uk/ 45 Thursday, 4 November 2010
  • 63. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Summary ■ More Links: ■ http://opensource.adobe.com/wiki/display/flexsdk/Spark+Virtualization ■ Item Renderers: http://help.adobe.com/en_US/flex/using/ WS03d33b8076db57b9-23c04461124bbeca597-8000.html#WS5ED0A932- BA59-4a77-9A9D-3745FE21D1E9 46 Thursday, 4 November 2010
  • 65. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Thanks ■ Thanks to Evtim Georgiev Flex SDK Engineer for reviewing the presentation 48 Thursday, 4 November 2010
  • 66. ©2010 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Thursday, 4 November 2010