Framework Fundamentals - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Framework Fundamentals

Description:

The Surprise Attack on Pearl Harbor. 1940 Japanese secret code ... Pearl Harbor. Within 2 hours, 18 ships were sunk and 2,400 Americans were killed ... – PowerPoint PPT presentation

Number of Views:100
Avg rating:3.0/5.0
Slides: 20
Provided by: and3
Category:

less

Transcript and Presenter's Notes

Title: Framework Fundamentals


1
Framework Fundamentals
  • Web 2.0 and Rich Internet Applications
  • Prof. Suthikshn Kumar

2
Flex Framework Fundamentals
  • Understanding the Flex Application Life Cycle
  • Differentiating between Flash Player and
    Framework
  • Bootstrapping Flex Applications
  • Loading on Flex Application into another Flex
    Application
  • Understanding Application Domains
  • Understanding the Preloader

3
Flex Application Life Cycle
  • A good understanding of the Flex Application Life
    cycle will enable you to build better
    applications because you will know where to
    optimally run the code.
  • Example If you need to ensure that some code
    runs during a preloader, you need to know where
    to place the code for that event.
  • An understanding of the application life cycle
    helps you to create applications that will
    deliver an optimal user experience.

4
SystemManager
  • Flex applications are basically Flash
    applications that use the Flex Framework
  • The root of a Flex application is typically
    SystemManager, which is a subclass of
    flash.display.MovieClip, a Flash player object
    type.
  • A movie clip is a display object type that
    supports frames, which are units of a timeline.
  • SystemManager has two frames.
  • The .swf format is a progressive download format
    which means that Flash player can access content
    on frames as they download without having to wait
    for the entire file to download.

5
Basic Application Startup Event FLow
SystemManager
timeline
Frame1 Preloader
Frame2 Application framework used by application
6
SystemManager First Frame
  • The first frame is used to display a progress
    indicator while the application loads.
  • This frame is lightweight in terms of file size
    so that it can download and run almost
    immediately, and it does not house much of the
    flex framework.

7
Second Frame
  • The second frame is the one in which the
    application itself housed.
  • It contains the majority of the Flex Framework
    utlized by the application.
  • Once the SystemManager instance for a Flex
    application has advanced to second frame, it
    creates an instance of the main application class
    for the flex application.

8
Internal Life cycle events
  • Preinitialize The application has been
    instantiated but has not yet created any child
    components.
  • Initialize The application has created child
    components but has not yet laid out those
    components.
  • creationComplete The application has been
    completely instantiated and has laid out all
    components.

9
SystemManager
  • The systemManager instance for the Flex
    application instance is initialized and runs
    through its own startup procedure.
  • Once the application has completed its internal
    startup procedure, it notifies SystemManager
    which dispatches an applicationComplete event.
  • From that point, application is ready to run.
  • SystemManager also manages all things that are
    displayed in front of the application content.
    This means all pop ps, cursors, and tool tips are
    placed within the SystemManager instance.
  • SystemManager has property called
    topLevelSystemManager. This is a reference to the
    SystemManager instance that is at the root of
    everything running in Flahs Player at that time.

10
Differentiating between Flash Player and Framework
  • Flash player is a runtime environment for Flash
    and Flex applications.
  • It can run .swf file which contains the bytecode
    that communicate with flash player, instructing
    to perform operations such as loading images,
    drawing graphics, making HTTP requests and so
    on.
  • Flash and Flex application can do only what Flash
    player allows them to do.
  • Flex consists of compiler that is capable of
    compiling MXML and ActionScript. It provides a
    layer of abstraction.
  • The Flex Framework consists of many thousands of
    line of code, all of which ultimately run
    instructions that Flash player can understand.
  • Compiler will include necessary libraries in the
    .swf file.
  • Thus you can rapidly develop applications.
  • The tradeoff of using the framework is that the
    file size of the .swf increases.

11
Differntiation between Flash player and Flex
Framework classes
  • If the class is in a package starting with flash
    ( ex flash.net.URLLoader), it is a part of flash
    player
  • If the class is in a package starting with
    letters mx ( ex mx.controls.Button), it is a part
    of flex framework
  • MXML tags almost always correspond to Flex
    Framework classes.

12
Bootstrapping Flex Applications.
  • Default root object is mx.managers.SystemManager
  • Flash.display.Movieclip class is a display object
    type which allows you to programmatically work
    with timeline.
  • Timelines are a feature used in flash
    applications because Flash authoring.
  • Timelines are not used frequently in Flex
    applications

13
Timeline
  • A timeline is composed of frames
  • Frame represents a point in time during the
    playback of timeline.
  • SystemManager consists of two frames.
  • The Flex application to have a preloader that
    indicates download progress to the user
  • The preloader must exist in the first frame and
    Flex application must exist in the second.
  • Flex automatically handles all the bootstrapping,
    and initialization.

14
Loading One Flex application into Another.
  • What is the path to the loaded application
    relative to the SWFLoader used to load the
    application?
  • When has the loaded application actually
    initialized?
  • Init event
  • Event listener for applicationComplete event for
    the SystemManager

15
Application Domain
  • They are critically important to how Flex
    applications function.
  • An application domain is the partition within
    which an application runs in Flash player.
  • If one application is running, there is one
    application domain.
  • When additional .swf files are loaded into an
    existing application, you create additional
    application domains.

16
When .swf is loaded
  • The loaded application runs in a new application
    domain that is completely partitioned from all
    other application domains.
  • The loaded .swf runs in a new application domain
    that is a child of an existing application
    domain.
  • The loaded .swf runs in an existing application
    domain.

17
Application domains.
  • All flex and flash applications are composed of
    collections of classes
  • An application domain holds the collections of
    classes for an application (s)
  • When you load an additional .swf file, there is
    more possibility that it will contain a
    definition for a class by the same name as one
    that is already loaded from another .swf file.
  • An application domain ensures that within the
    domain, there is only one definition for each
    class.
  • Therefore it has a set of rules for determining
    how to choose between conflicting definitions if
    such a scenerio presents itself.

18
Preloader
  • Preloader provides progress bar
  • This preloader is a lightweight class that is
    created on the first frame of the systemManager
  • The preloader dispatches a series of events that
    the progress bar then handles.
  • Typically the progress bar registers one or more
    listeners for events dispatched by the preloader
    object.
  • Once the complete event occurs, SystemManager
    progresses to second frame.

19
Events for Preloaders
  • Progress Indicates download progress
  • Complete
  • rslError indicates that a runtime shared library
    could not load
  • rslProgress indicates download progress for rsl
  • rslComplete
  • initProgress indicates that the application is
    initializing
  • initComplete indicates that the application has
    initialized.
Write a Comment
User Comments (0)
About PowerShow.com