SlideShare uma empresa Scribd logo
1 de 120
Baixar para ler offline
Custom Components in Flex 4




          Mrinal Wadhwa
      http://www.mrinalwadhwa.com
What is a component ?
Composition
a squad ...
Squad.mxml
a legion ...
Legion.mxml
the architecture ...
in flex ...
Halo
the architecture of components in Flex 3 and before
Spark
the architecture of components in Flex 4
all components inherit from ...



mx.core.UIComponent
in Spark its more common to use ...


spark.components.supportClasses.SkinnableComponent
the lifecycle of a component ...
BIRTH
BIRTH




LIFE
BIRTH




 LIFE




DEATH
Why does a component need a life cycle?
Flex applications run in the Flash Player
What Flex can do is a subset of what the Flash Player
              can do, not a superset.
so to understand flex components better, lets take a deeper
           look at how the flash player works ...
Frames
Frames
everything is done in frames ...
Frame Rate
the number of frames processed per second (fps)
Frame Rate
you can suggest the player a frame rate you
      would like your swf to have ...
Frame Rate
[SWF(width=”800”,height=”600”,frameRate=”60”)]

                      OR
             stage.frameRate = 60;
                      OR
       <s:Application frameRate=”60” ... >
Frame Rate
the player tries its best to maintain the suggested
   frame rate, but there are no guarantees ...
Frame Rate
the actual framerate achieved may be lower or higher
              than what we suggested ...
Frame Rate
browsers can force a lower framerate on the
              flash player ...
Frame Rate
In Firefox and Safari, frame rate falls to about 10 if
      the Tab running the swf is out of focus ...
Frame Rate
In Safari if window is minimized,
    framerate falls to zero ..
now lets take a deeper look at what happens inside
                   each frame ..
code execution             rendering




                 1 frame




                               the length of the track represents the time taken by this frame
code execution             rendering               heavy code execution




                 1 frame                                1 frame




                               the length of the track represents the time taken by this frame
code execution             rendering               heavy code execution                          heavy rendering




                 1 frame                                1 frame                                     1 frame




                               the length of the track represents the time taken by this frame
Ted Patrick called this ...




code execution             rendering               heavy code execution                          heavy rendering




                 1 frame                                1 frame                                     1 frame




                               the length of the track represents the time taken by this frame
The Elastic Racetrack


code execution             rendering               heavy code execution                          heavy rendering




                 1 frame                                1 frame                                     1 frame




                               the length of the track represents the time taken by this frame
Sean Christmann did some more research on this ...
The Marshal
He proposed AVM2 is controlled by something he
             called the Marshal ..
The Marshal
the marshal is responsible for carving out time
                   slices ...
The Marshal
    the duration of a slice can vary based on your
                   OS,browser etc.

just for our discussion lets assume a slice is 20ms long ..
A Marshaled Slice
A Marshaled Slice




but all these actions may not happen on each slice ...
A Marshaled Slice




Flash Player’s Event.RENDER event is fired at this point
A Marshaled Slice




invalidate action and render action only happen in
             the last slice of a frame ..
with 20ms slices ...
with 20ms slices ...




code execution
with 20ms slices ...




                       render
with 20ms slices ...
with 20ms slices ...




code execution
with 20ms slices ...




render
with 20ms slices ...
Code can be executed more often than the
  times stuff is rendered on the screen ...
... this is the main reason a component needs a
                       lifecycle



             performance
BIRTH




 LIFE




DEATH
Construction

  Addition       BIRTH


Initialization




                  LIFE




                 DEATH
Construction

  Addition       BIRTH


Initialization


Invalidation
                  LIFE
 Validation

  Update


                 DEATH
Construction

  Addition       BIRTH


Initialization


Invalidation
                  LIFE
 Validation

  Update


  Removal        DEATH
StormTrooper.as
StormTrooperSkin.mxml
Constructor
Constructor
Construction

  Addition       BIRTH


Initialization


Invalidation
                  LIFE
 Validation

  Update


  Removal        DEATH
Construction

  Addition       BIRTH


Initialization


Invalidation
                  LIFE
 Validation

  Update


  Removal        DEATH
Invalidation
 invalidateProperties

     invalidateSize

 invalidateDisplayList




 Event.RENDER

                         LIFE
     Validation
  commitProperties

       measure

layoutChrome(optional)

   updateDisplayList




      Update
the lifecycle methods ...
Invalidation/Validation cycle (Life)

 invalidateProperties    commitProperties

 invalidateSize          measure

 invalidateDisplayList   updateDisplayList
defining states ...
defining skin parts ...
static ...


when the number of instances needed is known and small
dynamic ...
required ...
optional ...
partAdded and partRemoved
defining properties ...
Bindable properties
throwing events ...
.......
defining styles ...
?
Mrinal Wadhwa

http://www.mrinalwadhwa.com
http://twitter.com/mrinal

Mais conteúdo relacionado

Destaque

El Cos Humà
El Cos HumàEl Cos Humà
El Cos Humà
Irisat
 
2009外文讲义4
2009外文讲义42009外文讲义4
2009外文讲义4
Deep Deep
 
The production process and promotion of video in UCD Library, integrating Web...
The production process and promotion of video in UCD Library, integrating Web...The production process and promotion of video in UCD Library, integrating Web...
The production process and promotion of video in UCD Library, integrating Web...
UCD Library
 

Destaque (20)

Mg Tweek7
Mg Tweek7Mg Tweek7
Mg Tweek7
 
Sin transparencia no hay democracia
Sin transparencia no hay democraciaSin transparencia no hay democracia
Sin transparencia no hay democracia
 
OpenData: Una oportunidad para bibliotecarios y documentalistas.
OpenData: Una oportunidad para bibliotecarios y documentalistas.OpenData: Una oportunidad para bibliotecarios y documentalistas.
OpenData: Una oportunidad para bibliotecarios y documentalistas.
 
El Cos Humà
El Cos HumàEl Cos Humà
El Cos Humà
 
Presentation2
Presentation2Presentation2
Presentation2
 
Altmetrics and Social Media: Publicising, Discovering, Engaging
Altmetrics and Social Media: Publicising, Discovering, EngagingAltmetrics and Social Media: Publicising, Discovering, Engaging
Altmetrics and Social Media: Publicising, Discovering, Engaging
 
Power Cam 5 特色
Power Cam 5 特色Power Cam 5 特色
Power Cam 5 特色
 
Nordlys Magnus
Nordlys MagnusNordlys Magnus
Nordlys Magnus
 
Graphis Feature
Graphis FeatureGraphis Feature
Graphis Feature
 
Reality of pune metro presentation 2012 पुणे मेट्रो नको, बस हवी
Reality of pune metro presentation 2012 पुणे मेट्रो नको, बस हवी Reality of pune metro presentation 2012 पुणे मेट्रो नको, बस हवी
Reality of pune metro presentation 2012 पुणे मेट्रो नको, बस हवी
 
Ie 20203
Ie 20203Ie 20203
Ie 20203
 
Mg Tweek5
Mg Tweek5Mg Tweek5
Mg Tweek5
 
What Is LibGuides?
What Is LibGuides?What Is LibGuides?
What Is LibGuides?
 
E-Learning in UCD Library: Collaboration Across the University
E-Learning in UCD Library: Collaboration Across the UniversityE-Learning in UCD Library: Collaboration Across the University
E-Learning in UCD Library: Collaboration Across the University
 
2009外文讲义4
2009外文讲义42009外文讲义4
2009外文讲义4
 
Open data licensing : Trojan horse or sunken treasure? Authors: Caleb Derven,...
Open data licensing : Trojan horse or sunken treasure? Authors: Caleb Derven,...Open data licensing : Trojan horse or sunken treasure? Authors: Caleb Derven,...
Open data licensing : Trojan horse or sunken treasure? Authors: Caleb Derven,...
 
The production process and promotion of video in UCD Library, integrating Web...
The production process and promotion of video in UCD Library, integrating Web...The production process and promotion of video in UCD Library, integrating Web...
The production process and promotion of video in UCD Library, integrating Web...
 
Presentació de Web 2.0 a l'Ajuntament de Barcelona
Presentació de Web 2.0 a l'Ajuntament de BarcelonaPresentació de Web 2.0 a l'Ajuntament de Barcelona
Presentació de Web 2.0 a l'Ajuntament de Barcelona
 
Customer connected company v2
Customer connected company v2Customer connected company v2
Customer connected company v2
 
iCity Project Presentation in Project Management Institute
iCity Project Presentation in Project Management InstituteiCity Project Presentation in Project Management Institute
iCity Project Presentation in Project Management Institute
 

Semelhante a Custom Components In Flex 4

Making a game with Molehill: Zombie Tycoon
Making a game with Molehill: Zombie TycoonMaking a game with Molehill: Zombie Tycoon
Making a game with Molehill: Zombie Tycoon
Jean-Philippe Doiron
 
Advanced Silverlight
Advanced SilverlightAdvanced Silverlight
Advanced Silverlight
rsnarayanan
 
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Paul Irish
 

Semelhante a Custom Components In Flex 4 (20)

Dynamic Wounds on Animated Characters in UE4
Dynamic Wounds on Animated Characters in UE4Dynamic Wounds on Animated Characters in UE4
Dynamic Wounds on Animated Characters in UE4
 
CHAPTER – 6 Video
CHAPTER – 6    VideoCHAPTER – 6    Video
CHAPTER – 6 Video
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled Cucumbers
 
Making a game with Molehill: Zombie Tycoon
Making a game with Molehill: Zombie TycoonMaking a game with Molehill: Zombie Tycoon
Making a game with Molehill: Zombie Tycoon
 
Flex4 Component Lifecycle
Flex4 Component LifecycleFlex4 Component Lifecycle
Flex4 Component Lifecycle
 
Flex4 Component Lifecycle
Flex4 Component LifecycleFlex4 Component Lifecycle
Flex4 Component Lifecycle
 
FrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteFrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in Frostbite
 
UplinQ - qualcomm® snapdragon™ processors a super gaming platform
UplinQ - qualcomm® snapdragon™ processors a super gaming platformUplinQ - qualcomm® snapdragon™ processors a super gaming platform
UplinQ - qualcomm® snapdragon™ processors a super gaming platform
 
Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Snapdragon Processors: A Super Gaming Platform Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Snapdragon Processors: A Super Gaming Platform
 
Introduction to 360 Video
Introduction to  360 VideoIntroduction to  360 Video
Introduction to 360 Video
 
You suck at Memory Analysis
You suck at Memory AnalysisYou suck at Memory Analysis
You suck at Memory Analysis
 
Gamedev mixer Юрко Дячишин "How deep the rabbit hole goes" (про гру Epic Arena)
Gamedev mixer Юрко Дячишин "How deep the rabbit hole goes" (про гру Epic Arena)Gamedev mixer Юрко Дячишин "How deep the rabbit hole goes" (про гру Epic Arena)
Gamedev mixer Юрко Дячишин "How deep the rabbit hole goes" (про гру Epic Arena)
 
Virtual Reality & Sim Racing in Assetto Corsa - Romagnoli
Virtual Reality & Sim Racing in Assetto Corsa - RomagnoliVirtual Reality & Sim Racing in Assetto Corsa - Romagnoli
Virtual Reality & Sim Racing in Assetto Corsa - Romagnoli
 
Advanced Silverlight
Advanced SilverlightAdvanced Silverlight
Advanced Silverlight
 
Making Security Invisible
Making Security InvisibleMaking Security Invisible
Making Security Invisible
 
Introduction of Plasma Chamber at EDCON 2019
Introduction of Plasma Chamber at EDCON 2019 Introduction of Plasma Chamber at EDCON 2019
Introduction of Plasma Chamber at EDCON 2019
 
PG Day Us: Animations for Web & Hybrid
PG Day Us: Animations for Web & HybridPG Day Us: Animations for Web & Hybrid
PG Day Us: Animations for Web & Hybrid
 
Combining the strength of erlang and Ruby
Combining the strength of erlang and RubyCombining the strength of erlang and Ruby
Combining the strength of erlang and Ruby
 
Combining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and RubyCombining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and Ruby
 
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
 

Mais de Mrinal Wadhwa

Introduction to Rich Internet Applications, Flex, AIR
Introduction to Rich Internet Applications, Flex, AIRIntroduction to Rich Internet Applications, Flex, AIR
Introduction to Rich Internet Applications, Flex, AIR
Mrinal Wadhwa
 

Mais de Mrinal Wadhwa (9)

SF IoT Meetup - Decentralized Identifiers & Verifiable Claims
SF IoT Meetup - Decentralized Identifiers & Verifiable ClaimsSF IoT Meetup - Decentralized Identifiers & Verifiable Claims
SF IoT Meetup - Decentralized Identifiers & Verifiable Claims
 
Edge Computing and Machine Learning for a better Internet of Things
Edge Computing and Machine Learning for a better Internet of ThingsEdge Computing and Machine Learning for a better Internet of Things
Edge Computing and Machine Learning for a better Internet of Things
 
Considerations for a secure internet of things for cities and communities
Considerations for a secure internet of things for cities and communitiesConsiderations for a secure internet of things for cities and communities
Considerations for a secure internet of things for cities and communities
 
Austin Smart City Readiness Workshop - Viability and Sustainability of IoT Sm...
Austin Smart City Readiness Workshop - Viability and Sustainability of IoT Sm...Austin Smart City Readiness Workshop - Viability and Sustainability of IoT Sm...
Austin Smart City Readiness Workshop - Viability and Sustainability of IoT Sm...
 
Better Parking. Better Communities.
Better Parking. Better Communities.Better Parking. Better Communities.
Better Parking. Better Communities.
 
Bits, Bytes and Blobs
Bits, Bytes and BlobsBits, Bytes and Blobs
Bits, Bytes and Blobs
 
Transport Layer Security - Mrinal Wadhwa
Transport Layer Security - Mrinal WadhwaTransport Layer Security - Mrinal Wadhwa
Transport Layer Security - Mrinal Wadhwa
 
An Introduction To Rich Internet Apllications
An Introduction To Rich Internet ApllicationsAn Introduction To Rich Internet Apllications
An Introduction To Rich Internet Apllications
 
Introduction to Rich Internet Applications, Flex, AIR
Introduction to Rich Internet Applications, Flex, AIRIntroduction to Rich Internet Applications, Flex, AIR
Introduction to Rich Internet Applications, Flex, AIR
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

Custom Components In Flex 4