SlideShare une entreprise Scribd logo
1  sur  120
Télécharger pour lire hors ligne
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

Contenu connexe

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Plus 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
 

Plus 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
 

Dernier

Dernier (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Custom Components In Flex 4