The document discusses the process of compiling MXML source code into ActionScript and generating classes. It explains how an MXML Application subclass, SystemManager subclass, and other classes are generated. It then walks through the process of loading and running the SWF, including how the SystemManager initializes, loads resources and RSLs, instantiates mixins, and ultimately creates the application instance.
This document discusses skinning components in Flex 4. It defines skinning as changing a component's appearance by modifying its visual elements. It explains that Spark components in Flex 4 separate the component's logic from its appearance using a skinning model. The document outlines skinning contracts which define how a skin class specifies a component's host, states, and parts. It provides examples of creating and applying skins in MXML, CSS, and ActionScript.
This document discusses the component lifecycle in Flex 4. It begins with an overview of the three stages of the component lifecycle: construction, life, and death. It then provides more details on the key parts of the lifecycle, including configuration, attachment, initialization, invalidation, validation, and interaction. Key points made include that components defer work until validation, skins are also components, and the goal is to avoid duplicating work each frame.
The document discusses various ways to optimize Flex applications for performance, including:
1. Using runtime shared libraries (RSLs) to externalize shared assets and reduce SWF file size.
2. Optimizing object creation by delaying it until necessary or staggering creation.
3. Improving measurement and layout performance by reducing nested containers and using Box containers when possible.
This document provides an overview and outline of a course on using Windows Presentation Foundation (WPF) in Visual Studio 2010 and Expression Blend 4. The course is divided into modules that cover topics like creating WPF applications, building user interfaces using controls and layouts, data binding, and a final lab project. Specific lessons demonstrate how to create applications and add controls, define layouts using panels and grids, and build interfaces with content and items controls. The document includes code examples and lists features of WPF like XAML-based interfaces, 2D/3D graphics, and data binding capabilities.
This document discusses key XAML concepts including dependency properties, trees in XAML/WPF/Silverlight, routing events, and commanding. It defines dependency objects and properties, describes the visual and logical trees, and covers attached properties, custom dependency properties, traversing trees, and implementing commands using interfaces like ICommand and RelayCommand. Live demos are provided for many of these concepts.
The document discusses the Open Data Protocol (OData), which is an open specification that allows the creation of REST-based data services that support built-in operations like CRUD (Create, Read, Update, Delete) and querying capabilities. OData builds on fundamental web standards like HTTP, URI conventions, and XML or JSON for payloads to define a protocol that can be used for exposing and consuming data across systems via REST. The specification also covers addressing schemes, payloads, metadata, batching requests, and how OData can be implemented using technologies like WCF Data Services.
Professional JavaScript Development - Creating Reusable CodeWildan Maulana
The document discusses various techniques for organizing JavaScript code to make it reusable and maintainable when working with other programmers. It covers standardizing object-oriented code, different inheritance models like prototypal and classical inheritance, and libraries like Base and Prototype that provide object-oriented capabilities. Examples are given of how each technique works, such as extending built-in objects and creating class-like constructors.
The document discusses Flex 4 skinning best practices. It explains that components handle logic, layouts handle positioning of children, and skins are responsible for the entire look and feel. Skins use skin parts and states to communicate with components. Two examples are provided: a shopping list component with labels, buttons and a data group in its skin, and a clock component with digital and analog skins providing different clock faces through a skin part.
This document discusses skinning components in Flex 4. It defines skinning as changing a component's appearance by modifying its visual elements. It explains that Spark components in Flex 4 separate the component's logic from its appearance using a skinning model. The document outlines skinning contracts which define how a skin class specifies a component's host, states, and parts. It provides examples of creating and applying skins in MXML, CSS, and ActionScript.
This document discusses the component lifecycle in Flex 4. It begins with an overview of the three stages of the component lifecycle: construction, life, and death. It then provides more details on the key parts of the lifecycle, including configuration, attachment, initialization, invalidation, validation, and interaction. Key points made include that components defer work until validation, skins are also components, and the goal is to avoid duplicating work each frame.
The document discusses various ways to optimize Flex applications for performance, including:
1. Using runtime shared libraries (RSLs) to externalize shared assets and reduce SWF file size.
2. Optimizing object creation by delaying it until necessary or staggering creation.
3. Improving measurement and layout performance by reducing nested containers and using Box containers when possible.
This document provides an overview and outline of a course on using Windows Presentation Foundation (WPF) in Visual Studio 2010 and Expression Blend 4. The course is divided into modules that cover topics like creating WPF applications, building user interfaces using controls and layouts, data binding, and a final lab project. Specific lessons demonstrate how to create applications and add controls, define layouts using panels and grids, and build interfaces with content and items controls. The document includes code examples and lists features of WPF like XAML-based interfaces, 2D/3D graphics, and data binding capabilities.
This document discusses key XAML concepts including dependency properties, trees in XAML/WPF/Silverlight, routing events, and commanding. It defines dependency objects and properties, describes the visual and logical trees, and covers attached properties, custom dependency properties, traversing trees, and implementing commands using interfaces like ICommand and RelayCommand. Live demos are provided for many of these concepts.
The document discusses the Open Data Protocol (OData), which is an open specification that allows the creation of REST-based data services that support built-in operations like CRUD (Create, Read, Update, Delete) and querying capabilities. OData builds on fundamental web standards like HTTP, URI conventions, and XML or JSON for payloads to define a protocol that can be used for exposing and consuming data across systems via REST. The specification also covers addressing schemes, payloads, metadata, batching requests, and how OData can be implemented using technologies like WCF Data Services.
Professional JavaScript Development - Creating Reusable CodeWildan Maulana
The document discusses various techniques for organizing JavaScript code to make it reusable and maintainable when working with other programmers. It covers standardizing object-oriented code, different inheritance models like prototypal and classical inheritance, and libraries like Base and Prototype that provide object-oriented capabilities. Examples are given of how each technique works, such as extending built-in objects and creating class-like constructors.
The document discusses Flex 4 skinning best practices. It explains that components handle logic, layouts handle positioning of children, and skins are responsible for the entire look and feel. Skins use skin parts and states to communicate with components. Two examples are provided: a shopping list component with labels, buttons and a data group in its skin, and a clock component with digital and analog skins providing different clock faces through a skin part.
The PPTs from one of the event of iWillStudy.com - a leading start-up in the education space in India. This PPT is being used at an event where they taught iPhone programming and applications development.
This document discusses an MXM-based application for sharing protected content. It will integrate with the chillout application for content creation and use two media frameworks, VLC and GStreamer, for playback. The first alpha release is planned for the end of July. It also provides an overview of the MXM configuration file and engine architecture, and describes how to implement a basic MXM engine and use MXM APIs.
matmultHomework3.pdfNames of Files to Submit matmult..docxandreecapon
matmult/Homework3.pdf
Names of Files to Submit: matmult.s, knapsack.s, combs.s ReadMe.txt
• If you are working in a group ALL members must submit the assignment
• All programs should compile with no warnings when compiled with the -Wall option
• All prompts for input and all output must match my prompts/output. We use a program to grade
your work and tiny differences can cause your work to be marked as a 0.
◦ The best way to avoid being deducted points is to copy the prompt/unchanging portion of
the outputs into your code. Make sure to get the spaces as well.
• You must also submit a file called ReadMe.txt. Include the names of all partners and any
trouble you had on the assignment
• An example ReadMe.txt has been included with this assignment
• The input in the examples has been underlined to help you figure out what is input and what is
output
• Submit your work on Smartsite by uploading each file separately. Do not upload any folders or
compressed files such as .rar, .tar, .targz, .zip etc.
• If you have any questions please post them to Piazza
• RESTRICTIONS:
◦ For all programs in this homework you
▪ May not have a data section. If you need extra space you must use the stack.
▪ Not call any C functions that you write. You may make use of any of the library
functions.
1. (Time: 3.5 hours. Lines of Code 257) Write a program called matmult.s that implements matrix
multiplication in assembly. If you don't know how to do matrix multiplication your can find a
tutorial here.
1. This program should be callable from C and have the following signature:
1. int** matMult(int **a, int num_rows_a, int num_cols_a,
int** b, int num_rows_b, int num_cols_b);
2. This function should multiply matrices a and b together and return the result
3. You must allocate space for this new matrix by calling malloc
2. You have been given a C file called main.c that accepts as command line arguments the
names of two files that contain the matrices to be multiplied. main.c will read in these
matrices, call your function, and then display the result. After it has displayed the result it
will then free the space that has been malloced.
1. Your function must be callable by this file
3. You have also been given a makefile that should compile your program. Your program
MUST be able to be compiled by this makefile. For those of you running 64 bit versions of
Linux you may need to install the 32 bit binaries. I was able to do this on my machine by
installing multilib for gcc. To do this I clicked on the Ubuntu Software App and then
searched for multilib. I selected the one for gcc, installed it, and everything was good to go.
If that doesn't work for you, you might find this this post helpful. If neither solution works
for you please Google and see what you can find. If you find a solution that works for you
please post it to Piazza.
Example:
cat mata/0-test.txt
3
3
470 -192 -539
235 -814 -538
-503 -418 541
cat matb/0-test.txt
3
3
31 ...
Android development training programme , Day 3DHIRAJ PRAVIN
The document provides an overview and examples of background processing techniques in Android including threads, handlers, and AsyncTasks. It discusses how threads can be used to perform asynchronous tasks and how handlers or AsyncTasks allow updating the user interface from a background thread. Examples are given for using handlers to communicate between threads and an AsyncTask to download a web page in the background. The document also covers broadcast receivers and provides a list of platform broadcast events and an example receiver for phone call state changes.
I am Thanasis F. I am an Online C++ Homework Expert at cpphomeworkhelp.com. I hold a Masters in Programming from Harvard University. I have been helping students with their homework for the past 6 years. I solve homework related to Online C++.
Visit cpphomeworkhelp.com or email info@cpphomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with Online C++ Homework.
This document provides an introduction to using macros in Microsoft Access databases. It explains that macros allow non-programmers to automate tasks without learning VBA. The document outlines how to create a basic macro to filter a form, demonstrates copying database objects to back them up, and includes a link to download a full e-book on Access macros.
Flex Building User Interface ComponentsAhmad Hamid
design user interface components in flex is just like any other language. This presentation provides some guidelines as to how such components should be design and implemented with performance in mind.
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEHitesh Mohapatra
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS
CREATING AND MANAGING ACTIVE DIRECTORY OBJECTS
CONFIGURING NETWORK SETTINGS ON WINDOWS SERVER
CREATING A WEB SITE
SELECTING, SORTING, AND DISPLAYING DATA
FILTERING OBJECTS AND ENUMERATING OBJECTS
This document provides an overview of Rich Internet Applications (RIA) and the Adobe Flex software development kit. It discusses how Flex uses MXML and ActionScript to create RIA applications that interact with the Flash plugin. It also covers related technologies like Adobe AIR, BlazeDS, and LifeCycle Data Services that allow Flex applications to communicate with backend services. Examples of MXML code and Flex application architecture are provided.
Here is the JavaScript source code using functions and switch statements to return statements based on the favorite movie choice:
<script>
function favoriteMovieStatement(choice) {
switch(choice) {
case 1:
return "Not a bad choice";
break;
case 2:
return "No comment";
break;
case 3:
return "It has its moments";
break;
default:
return "I'm sure it was great";
}
}
var statement = favoriteMovieStatement(1);
console.log(statement);
</script>
This defines a function called favoriteMovieStatement that takes a choice as a parameter. It uses a switch statement to return different
The document provides tips for finding resources in the Eclipse workspace using a visitor. It describes creating a class that implements IResourceProxyVisitor and overriding the visit() method. This method would check each resource proxy for a match to the location string and return the resource if found. This allows recursively searching the workspace to locate a resource based on its path or other identifier.
The document provides an overview of ActionScript 3.0 fundamentals including the ActionScript Virtual Machine, data types, classes, inheritance, interfaces, and object-oriented programming concepts in ActionScript. It discusses topics such as variables, functions, conditional statements, loops, scope, packages, namespaces, and more. The document is intended as educational material for learning the basics of the ActionScript 3.0 programming language.
This document provides instructions for a tutorial on using tools for mobile Linux (TmL). It describes three hands-on sessions:
1. Using the Device Framework to integrate a puppy Linux emulator into Eclipse. This allows starting/stopping the emulator from Eclipse.
2. Using the VNC Viewer to visualize the emulator display in an Eclipse view. A new state is added to indicate connection to the viewer.
3. Using the Protocol Framework to implement an echo client/server protocol between the client and an echo server in the puppy Linux emulator.
The summaries provide a high-level overview of the key topics and goals covered in each hands-on session of the tutorial.
A class is a template that defines the form of an object. It specifies both the data and code that will operate on that data. Objects are instances of classes. The data and code that constitute a class are called members or instance variables. A class definition creates a new data type. Objects are created using the new operator, which dynamically allocates memory and returns a reference to the new object. Constructors initialize objects when they are created and can be used to assign initial values to data members. Methods manipulate the data defined by the class and can accept parameters. The garbage collector automatically reclaims memory occupied by objects no longer being used to prevent memory leaks.
This document provides an overview of XAML (eXtensible Application Markup Language) including its syntax, code-behind functionality, namespaces, and data binding. XAML is a declarative XML-based language used to define and initialize UI elements and objects. XAML elements map directly to CLR objects and attributes map to properties and events. XAML files can be created in Visual Studio, Expression Blend, or text editors. XAML separates UI definition from runtime logic by using code-behind files. It follows XML syntax and supports attributes, elements, and markup extensions for properties. Namespaces map XAML elements to custom classes in assemblies. Data binding in XAML displays and interacts with data
New client side features - Microsoft Dynamics CRM 2016Naveen Kumar
The document discusses new client side features in Microsoft Dynamics CRM 2016, including a new getValue method and keypress event methods (addOnKeyPress, removeOnKeyPress, fireOnKeyPress). The getValue method allows retrieving a field value as the user enters data. The keypress methods allow attaching, detaching, and firing functions on the keypress event. An example shows using these to format a telephone number field, removing invalid characters on keypress.
This document discusses events, delegates, multithreading, and garbage collection in VB.NET. It provides examples of how to handle events using delegates and the Handles keyword. It also describes how to create and manage threads for multithreading. Finally, it discusses how the .NET garbage collector automatically manages memory by collecting unused objects.
The document discusses various C# concepts related to classes and objects including constructors, inheritance, interfaces, properties, and auto-implemented properties. It provides examples of how to define classes with different types of constructors, use inheritance and overriding to extend classes, implement interfaces, and define public properties and auto-implemented properties to encapsulate data in a class.
The PPTs from one of the event of iWillStudy.com - a leading start-up in the education space in India. This PPT is being used at an event where they taught iPhone programming and applications development.
This document discusses an MXM-based application for sharing protected content. It will integrate with the chillout application for content creation and use two media frameworks, VLC and GStreamer, for playback. The first alpha release is planned for the end of July. It also provides an overview of the MXM configuration file and engine architecture, and describes how to implement a basic MXM engine and use MXM APIs.
matmultHomework3.pdfNames of Files to Submit matmult..docxandreecapon
matmult/Homework3.pdf
Names of Files to Submit: matmult.s, knapsack.s, combs.s ReadMe.txt
• If you are working in a group ALL members must submit the assignment
• All programs should compile with no warnings when compiled with the -Wall option
• All prompts for input and all output must match my prompts/output. We use a program to grade
your work and tiny differences can cause your work to be marked as a 0.
◦ The best way to avoid being deducted points is to copy the prompt/unchanging portion of
the outputs into your code. Make sure to get the spaces as well.
• You must also submit a file called ReadMe.txt. Include the names of all partners and any
trouble you had on the assignment
• An example ReadMe.txt has been included with this assignment
• The input in the examples has been underlined to help you figure out what is input and what is
output
• Submit your work on Smartsite by uploading each file separately. Do not upload any folders or
compressed files such as .rar, .tar, .targz, .zip etc.
• If you have any questions please post them to Piazza
• RESTRICTIONS:
◦ For all programs in this homework you
▪ May not have a data section. If you need extra space you must use the stack.
▪ Not call any C functions that you write. You may make use of any of the library
functions.
1. (Time: 3.5 hours. Lines of Code 257) Write a program called matmult.s that implements matrix
multiplication in assembly. If you don't know how to do matrix multiplication your can find a
tutorial here.
1. This program should be callable from C and have the following signature:
1. int** matMult(int **a, int num_rows_a, int num_cols_a,
int** b, int num_rows_b, int num_cols_b);
2. This function should multiply matrices a and b together and return the result
3. You must allocate space for this new matrix by calling malloc
2. You have been given a C file called main.c that accepts as command line arguments the
names of two files that contain the matrices to be multiplied. main.c will read in these
matrices, call your function, and then display the result. After it has displayed the result it
will then free the space that has been malloced.
1. Your function must be callable by this file
3. You have also been given a makefile that should compile your program. Your program
MUST be able to be compiled by this makefile. For those of you running 64 bit versions of
Linux you may need to install the 32 bit binaries. I was able to do this on my machine by
installing multilib for gcc. To do this I clicked on the Ubuntu Software App and then
searched for multilib. I selected the one for gcc, installed it, and everything was good to go.
If that doesn't work for you, you might find this this post helpful. If neither solution works
for you please Google and see what you can find. If you find a solution that works for you
please post it to Piazza.
Example:
cat mata/0-test.txt
3
3
470 -192 -539
235 -814 -538
-503 -418 541
cat matb/0-test.txt
3
3
31 ...
Android development training programme , Day 3DHIRAJ PRAVIN
The document provides an overview and examples of background processing techniques in Android including threads, handlers, and AsyncTasks. It discusses how threads can be used to perform asynchronous tasks and how handlers or AsyncTasks allow updating the user interface from a background thread. Examples are given for using handlers to communicate between threads and an AsyncTask to download a web page in the background. The document also covers broadcast receivers and provides a list of platform broadcast events and an example receiver for phone call state changes.
I am Thanasis F. I am an Online C++ Homework Expert at cpphomeworkhelp.com. I hold a Masters in Programming from Harvard University. I have been helping students with their homework for the past 6 years. I solve homework related to Online C++.
Visit cpphomeworkhelp.com or email info@cpphomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with Online C++ Homework.
This document provides an introduction to using macros in Microsoft Access databases. It explains that macros allow non-programmers to automate tasks without learning VBA. The document outlines how to create a basic macro to filter a form, demonstrates copying database objects to back them up, and includes a link to download a full e-book on Access macros.
Flex Building User Interface ComponentsAhmad Hamid
design user interface components in flex is just like any other language. This presentation provides some guidelines as to how such components should be design and implemented with performance in mind.
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEHitesh Mohapatra
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS
CREATING AND MANAGING ACTIVE DIRECTORY OBJECTS
CONFIGURING NETWORK SETTINGS ON WINDOWS SERVER
CREATING A WEB SITE
SELECTING, SORTING, AND DISPLAYING DATA
FILTERING OBJECTS AND ENUMERATING OBJECTS
This document provides an overview of Rich Internet Applications (RIA) and the Adobe Flex software development kit. It discusses how Flex uses MXML and ActionScript to create RIA applications that interact with the Flash plugin. It also covers related technologies like Adobe AIR, BlazeDS, and LifeCycle Data Services that allow Flex applications to communicate with backend services. Examples of MXML code and Flex application architecture are provided.
Here is the JavaScript source code using functions and switch statements to return statements based on the favorite movie choice:
<script>
function favoriteMovieStatement(choice) {
switch(choice) {
case 1:
return "Not a bad choice";
break;
case 2:
return "No comment";
break;
case 3:
return "It has its moments";
break;
default:
return "I'm sure it was great";
}
}
var statement = favoriteMovieStatement(1);
console.log(statement);
</script>
This defines a function called favoriteMovieStatement that takes a choice as a parameter. It uses a switch statement to return different
The document provides tips for finding resources in the Eclipse workspace using a visitor. It describes creating a class that implements IResourceProxyVisitor and overriding the visit() method. This method would check each resource proxy for a match to the location string and return the resource if found. This allows recursively searching the workspace to locate a resource based on its path or other identifier.
The document provides an overview of ActionScript 3.0 fundamentals including the ActionScript Virtual Machine, data types, classes, inheritance, interfaces, and object-oriented programming concepts in ActionScript. It discusses topics such as variables, functions, conditional statements, loops, scope, packages, namespaces, and more. The document is intended as educational material for learning the basics of the ActionScript 3.0 programming language.
This document provides instructions for a tutorial on using tools for mobile Linux (TmL). It describes three hands-on sessions:
1. Using the Device Framework to integrate a puppy Linux emulator into Eclipse. This allows starting/stopping the emulator from Eclipse.
2. Using the VNC Viewer to visualize the emulator display in an Eclipse view. A new state is added to indicate connection to the viewer.
3. Using the Protocol Framework to implement an echo client/server protocol between the client and an echo server in the puppy Linux emulator.
The summaries provide a high-level overview of the key topics and goals covered in each hands-on session of the tutorial.
A class is a template that defines the form of an object. It specifies both the data and code that will operate on that data. Objects are instances of classes. The data and code that constitute a class are called members or instance variables. A class definition creates a new data type. Objects are created using the new operator, which dynamically allocates memory and returns a reference to the new object. Constructors initialize objects when they are created and can be used to assign initial values to data members. Methods manipulate the data defined by the class and can accept parameters. The garbage collector automatically reclaims memory occupied by objects no longer being used to prevent memory leaks.
This document provides an overview of XAML (eXtensible Application Markup Language) including its syntax, code-behind functionality, namespaces, and data binding. XAML is a declarative XML-based language used to define and initialize UI elements and objects. XAML elements map directly to CLR objects and attributes map to properties and events. XAML files can be created in Visual Studio, Expression Blend, or text editors. XAML separates UI definition from runtime logic by using code-behind files. It follows XML syntax and supports attributes, elements, and markup extensions for properties. Namespaces map XAML elements to custom classes in assemblies. Data binding in XAML displays and interacts with data
New client side features - Microsoft Dynamics CRM 2016Naveen Kumar
The document discusses new client side features in Microsoft Dynamics CRM 2016, including a new getValue method and keypress event methods (addOnKeyPress, removeOnKeyPress, fireOnKeyPress). The getValue method allows retrieving a field value as the user enters data. The keypress methods allow attaching, detaching, and firing functions on the keypress event. An example shows using these to format a telephone number field, removing invalid characters on keypress.
This document discusses events, delegates, multithreading, and garbage collection in VB.NET. It provides examples of how to handle events using delegates and the Handles keyword. It also describes how to create and manage threads for multithreading. Finally, it discusses how the .NET garbage collector automatically manages memory by collecting unused objects.
The document discusses various C# concepts related to classes and objects including constructors, inheritance, interfaces, properties, and auto-implemented properties. It provides examples of how to define classes with different types of constructors, use inheritance and overriding to extend classes, implement interfaces, and define public properties and auto-implemented properties to encapsulate data in a class.
1. Page 0 of 59 Flex 4 Components from the Fire Hose Michael Labriola Senior Consultants Digital Primates twitter.com/mlabriola
2. Who am I? Michael Labriola Senior Consultant Digital Primates Client side architect specializing in Adobe Flex Architect and developer of Fluint Lead architect and developer of FlexUnit 4.x Team Mentor Co-Author of Flex Training from the Source Series Geek Page 2 of 59
4. What are we going to cover? We are going to start with MXML We are going to see what it looks like after it is compiled We are then going to walk through each class on the way from instantiation through display We will cover as much as we can before time runs out Page 3 of 59
5. Here is our source code Firehose.mxml is our main application file. It consists of the following pieces: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <s:Button id="btn" label="Click Me"/> </s:Application> Page 3 of 59
6. Generation This code turns into many generated files. Most important to us are: ActionScript version of your Application subclass ActionScript subclass of the system manager Getter/Setter generation for mxml properties Flex Init Mixin Styles, styles and more styles Page 3 of 59
7. Application Subclass The first piece of generated code is the Application subclass. When the application is subclassed, several important things occur: Frame metadata is specified Properties are created for MXML components in the document Factory functions are created for the MXML content The mxmlContentFactory is set Style declaration setup is deferred for a bit Page 3 of 59
8. Frame metadata Page 3 of 59 The following metadata is added to the application subclass: [Frame(extraClass="_Firehose_FlexInit")] [Frame(factoryClass="_Firehose_mx_managers_SystemManager")] The first line ensures the inclusion of the Firehose_FlexInitmixin The second line specifies that the Firehose_mx_managers_SystemManager is the bootstrapped root class for your swf
9. MXML Properties Page 3 of 59 A Bindable public property is created for the MXML instances so that you can refer to these by id in the Application [Bindable] public varbtn : spark.components.Button; Note this corresponds to the id of the object in the MXML <s:Button id="btn" label="Click Me"/>
10. Factory Functions Page 3 of 59 For each MXML tag, a factory function is created to build the corresponding object and set its properties private function _Firehose_Button1_i():Button { var temp : Button = new spark.components.Button(); temp.label = "Click Me"; temp.id = "btn"; if (!temp.document) temp.document = this; btn = temp; BindingManager.executeBindings(this, "btn", btn); return temp; }
11. Factory Functions Page 3 of 59 An Array of all of the components is then created invoking each of those methods and adding the result to the Array private function _Firehose_Array1_c() : Array { var temp : Array = [_Firehose_Button1_i()]; return temp; }
12. Multiple Controls Page 3 of 59 For example, if we had three buttons as peers, the code would like this: <s:Button id="btn1" label="Click Me"/> <s:Button id="btn2" label="Click You"/> <s:Button id="btn3" label="Click It"/> private function _Firehose_Array1_c() : Array { var temp : Array = [_Firehose_Button1_i(), _Firehose_Button2_i(), _Firehose_Button3_i()]; return temp; }
13. Non Skinnable Page 3 of 59 Flex 4 is full of new classes to learn. Let’s start by discussing an old favorite, UIComponent and a new addition Group. UIComponent is still the base class of all components and containers in Flex 4. Group is the base container class. It can hold an unknown number of elements which may be defined in MXML and is akin to a lighter-weight version of Container from the mx component set
14. Skinnable* Page 3 of 59 Two additional new classes in Flex 4 worth noting at this time: SkinnableComponent and SkinnableContainer The SkinnableComponent class is the base class for all components where the view has been separated from component logic through the use of a skin. It is a UIComponent subclass The SkinnableContainer class is a subclass of SkinnableComponent which allows for both a skin and unknown additional elements which may be defined in MXML
15. mxmlContentFactory Page 3 of 59 The goal of all of the work in the generated application code so far has been to set the mxmlContentFactory property of the Firehose class (Application subclass). This property is defined in SkinnableContainer and allows us to specify those unknown MXML children. This property is typed as an IDeferredInstance. this.mxmlContentFactory = new DeferredInstanceFromFunction(_Firehose_Array1_c);
16. IDeferredInstance Page 3 of 59 To be an IDeferredInstance a class must have a single method: public function getInstance():Object { ... return something; } An IDeferredInstance defers the creation of an object until its getInstance() method is called. Each subsequent call returns the originally created instance
17. DeferredInstanceFromFunction Page 3 of 59 Our generated code is simply a function and the mxmlContentFactory expects the IDeferredInstance. The DeferredInstanceFromFunction handles this issue this.mxmlContentFactory = new DeferredInstanceFromFunction(_Firehose_Array1_c); The DeferredInstanceFromFunction class takes a function as its first parameter. When its getInstance() method is called it invokes that method to create the component graph
18. Nested Controls Page 3 of 59 The factory functions generated change a bit when we have nested controls: <s:Button id="btn1" label="Click Me"/> <s:Group> <s:Button id="btn2" label="Click You"/> <s:Button id="btn3" label="Click It"/> </s:Group>
19. Nested Controls Generated Page 3 of 59 private function _Firehose_Array1_c() : Array { var temp : Array = [_Firehose_Button1_i(), _Firehose_Group1_c()]; return temp; } private function _Firehose_Button1_i() : Button { ... } private function _Firehose_Group1_c() : Group { var temp : Group = Group(); temp.mxmlContent = [_Firehose_Button2_i(), _Firehose_Button3_i()]; if (!temp.document) temp.document = this; return temp; }
20. Nested Group Page 3 of 59 In the case of the nested group, you may notice that the mxmlContent property is set, instead of the mxmlContentFactory. var temp : Group = Group(); temp.mxmlContent = [_Firehose_Button2_i(), _Firehose_Button3_i()]; Further, the property is set directly to the Array built by calling these methods. The mxmlContent property is the final home of all children. In this case they are created immediately instead of deferred
21. Application Subclass The next major piece of generated code is the SystemManager subclass. Several important things occur here: The subclass implements IFlexModuleFactory The subclass implements ISWFContext The create() method is overridden The info() method is overridden Page 3 of 59
22. IFlexModuleFactory Page 3 of 59 The newly created SystemManager subclass will implement IFlexModuleFactory and ISWFContext which requires a number of interesting methods. The most interesting ones to us at this moment are: function registerImplementation(interfaceName:String, impl:Object):void; function getImplementation(interfaceName:String):Object; function create(... parameters):Object; function info():Object;
23. registerImplementation() Page 3 of 59 This method allows the Flex framework, and you should you wish, to register Singletons that implement a specific interface. It is sort of a Dependency Injection registration meets singleton and had a baby scenario: public function registerImplementation(interfaceName:String, impl:Object):void; You call this method with an interface you wish to register and an implementing object.
24. getImplementation() Page 3 of 59 This method allows you to getImplementations that were previously registered. So, for example, if you wanted to register a given singleton you could then later retrieve it through the SystemManager public function getImplementation(interfaceName:String):Object
25. create() Page 3 of 59 The create() method is where the magic happens and your app will be instantiated: override public function create(... params):Object { ... varmainClassName:String = params.length == 0?"Firehose“:String(params[0]); varmainClass:Class = Class(getDefinitionByName(mainClassName)); if (!mainClass) return null; varinstance:Object = new mainClass(); if (instance is IFlexModule) (IFlexModule(instance)).moduleFactory = this; return instance; }
26. info() Page 3 of 59 The info() method returns a generic object filled with required and optional properties used to configure the system. Examples of data you may find in the object returned by info(): RSL data, compiled locales, resource bundle names, application domain, main class name, mixins and the correct preloader to use
27. info() Page 3 of 59 In this code snippet from info() you can see where the mixins are specified. This is the way in which Flex applies some of the additional generated code to the system manager. _info = { … mainClassName: "Firehose", mixins: [ "_Firehose_FlexInit", "_Firehose_Styles" ], preloader: mx.preloaders.SparkDownloadProgressBar }
28. Mixin Page 3 of 59 Mixin classes are decorated with the Mixin metadata and have a public static method named init() that takes a IFlexModuleFactory (SystemManager in this case) as an argument. The mixin effectively sets properties and instances on the SystemManager to create the StyleManager, register styles and more
29. Btn Binding Setup Page 3 of 59 Earlier I mentioned that Flex creates a public var for btn on the host component because we have an MXML control named btn. That was true then. However, this is Flex, and in Flex all MXML components are bindable, therefore, that public var actually becomes a getter and setter before we are done
30. Btn Binding Setup Page 3 of 59 [Bindable(event="propertyChange")] public function get btn():spark.components.Button { return this._97884btn; } public function set btn(value:spark.components.Button):void{ varoldValue:Object = this._97884btn; if (oldValue !== value) { this._97884btn = value; if (this.hasEventListener("propertyChange")) this.dispatchEvent( PropertyChangeEvent.createUpdateEvent( this, "btn", oldValue, value)); } }
31. Watcher Setup Page 3 of 59 If you add one Bindable properties to your application. You receive the following additons, which is the code watching for Bindable changes. <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:Script> <![CDATA[ [Bindable] public varlblMe:String; ]]> </fx:Script> <s:Button id="btn" label="{lblMe}"/> </s:Application>
32. lblMe Binding Setup Page 3 of 59 private function _Firehose_bindingsSetup():Array { varresult:Array = []; result[0] = new mx.binding.Binding(this, null, null, "btn.label" , "lblMe"); return result; }
33. lblMe Watcher Setup Page 3 of 59 public function setup(target:Object, propertyGetter:Function, staticPropertyGetter:Function, bindings:Array, watchers:Array):void { watchers[0] = new mx.binding.PropertyWatcher("lblMe", {propertyChange: true }, [bindings[0]], propertyGetter ); watchers[0].updateParent(target); } } }
36. SWF Load Page 3 of 59 You begin loading your SWF into the browser of your choice. However, you need to remember that SWF is a streaming format, so it arrives a frame at a time. Thanks to your frame metadata, you already told the SWF it should instantiate your SystemManager… so it does.
37. SystemManager Constructor Page 3 of 59 The SystemManager’s constructor is called where it does a few things like figure out if it is the top level or if it has been loaded into another SWF. If it is the top, it sets alignments and scale modes on the stage and then does something extremely important: stop(); We need to wait until we have loaded everything we need before we advance to the next frame and start the application
38. SystemManager Constructor Page 3 of 59 The final line in the SystemManager’s Constructor: if (root && root.loaderInfo) root.loaderInfo.addEventListener(Event.INIT, initHandler); It waits until an INIT event is broadcast from the loaderInfo object. This event is broadcast the moment once everything needed by this first frame is available and the SystemManager’sConnstructor finishes
39. init() Page 3 of 59 One the initHandler() is called, the world gets more interesting. This method does a little cleanup, removes the existing init event listener and some other pieces, however, the two critical things it does for this presentation: Adds another event listener for a method named docFrameListener which is called when the rest of the application is loaded Calls the initialize() method
40. initialize() Page 3 of 59 This method is responsible for creating the PreLoader. The PreLoader itself is a logical class, but it allows us to specify a display class which is displayed to the user to make a better user experience while we load the remainder of the app. This method also starts downloading any RSLs needed for your application… and some it doesn’t need Then we wait until the all of the RSLs are loaded and the remainder of the app is loaded
41. kickOff() Page 3 of 59 When both of these conditions are true (and they can happen in any order) either the preloader or the docFrameHandler catches this fact and ensures kickOff() is called. This method registers a ton of classes as singletons to support everything from fonts to drag and drop. It also instantiates all of those mixins we discussed in the pregame, adding those pieces to the system manager at this time
42. initializeTopLevelWindow() Page 3 of 59 This method does a lot of work to ensure we load correctly and size appropriately, however, the part that interests us most: childManager.initializeTopLevelWindow(w, h); ChildManager is an instance of a class that implements ISystemManagerChildManager, meaning that it has methods to handle the result of adding and removing children as well as the initialize method we call here. In this case, it is an instance of ChildManager
43. ChildManager() Page 3 of 59 Inside of ChildManager, the create() method that was overridden by the compiler is called, effectively creating the instance of your application. A creationComplete event handler is added to the application and the preloader is informed of the application’s existence so that it may leave gracefully when the application is ready Note, the application is created but not yet added to the System Manager… that will happen much later
44. ChildManager() cont Page 3 of 59 Inside of the ChildManager, the addingChild() method is called. This method sets the nestLevel for the new component (nestLevel increase as depth of the component increases) The childAdded() method is called next, which dispatches an ADD event for the child and calls the child’s initialize… And the fun begins
45. PreInitialize Page 3 of 59 The Application initializes several managers and the context menus before beginning the component initialization cycle. This starts by broadcasting FlexEvent.PREINITIALIZE. This is one of the most important events in all of Flex. It means the display object dispatching is initialized, however, it has yet to create any of its visual children. Anything that you want to do which will affect the number or type of children should be done NOW
46. createChildren() Page 3 of 59 Immediately after dispatching the event, the createChildren() method is called. The createChildren() method is responsible for creating all relatively static visual children of a component. In non-skinnable components this method created all visual children directly. In skinnable components, this method invokes validateSkinChange() (which is invoked now and when the skin changes at runtime)
47. validateSkinChange() Page 3 of 59 The validateSkinChange() checks for an existing skin and detaches it if it exists. It then performs the most important operation here, it calls attachSkin() .. if (skin) detachSkin(); attachSkin(); ..
48. attachSkin() Page 3 of 59 The attachSkin() method finds the correct skin for this component, instantiates it, and passes the result to the setSkin() method. In our application, this means creating an instance of the ApplicationSkin. ApplicationSkin is a Skin, which is just a Group and ultimately a UIComponent, so it will have this same life cycle recursively. The setSkin() method sets the _skin property of the class and dispatches a skinChanged event
49. attachSkin() Page 3 of 59 At this point, the owner and hostComponent of the skin are set. The hostComponent of a skin always refers to the object for which it is providing a visual display. Note, not the hostComponent and owner property is set after the class skin instantiated. You cannot access either of these properties during the skin’s construction
50. attachSkin() Page 3 of 59 After the skin is created, the styles of the component are passed to the skin for use. At this point, the skin is added to the component, kicking off its life cycle. The addingChild() method is called, followed by actually adding it via the player APIs. Then the childAdded() method is called. The childAdded method, much like it did for the application, causes the ApplicationSkin’s initialize method to be called
51. Skin PreInitialize Page 3 of 59 The skin now broadcasts its FlexEvent.PREINITIALIZE. It means the skin is initialized, however, it has yet to create any of its visual children. I reiterate, Anything that you want to do which will affect the number or type of children should be done NOW
52. Skin createChildren() Page 3 of 59 Immediately after dispatching the event, the createChildren() method is called. Within the skin, the setMXMLContent method is called. This method takes an array of MXML objects defined in the skin (much like the array you saw in the nested example). All old MXML elements are removed from the skin, and add all of the new elements, using a method named addElement()
53. addElement() Page 3 of 59 Immediately after dispatching the event, the createChildren() method is called. Within the skin, the setMXMLContent method is called. This method takes an array of MXML objects defined in the skin (much like the array you saw in the nested example). All old MXML elements are removed from the skin, and add all of the new elements. We use the word element here as the items we are adding or removing are of type IVisualElement
54. IVisualElement Page 3 of 59 IVisualElement is a new interface to spark which defines the properties that must be present on an object to be correctly sized, positioned and displayed in any type of spark container In spark, controls, containers and even graphic primitives can be IVisualElements. Using this interface is a key component to allowing spark to intermingle these classes
55. elementAdded() cont Page 3 of 59 As the new visual elements are added to the skin, the skin’s elementAdded() method is called. In this method, the elementAdded method of the layout object is also called to inform it of a change, and the invalidateLayering() method is called to inform the skin that the layering of objects may have changed. This invalidation eventually leads to a call to assignDisplayObjects() which reorders the objects
56. elementAdded() Page 3 of 59 In the case where the element is an IGraphicalElement (an interface that descends from IVisualElement to specifically handle the needs of graphics) a special method called addingGraphicalElement() is called and passed the element. IGraphicalElements are not displayObjects on their own like components. They are simply logic and state which draw onto a display object. This means that Flex must identify the correct display object for drawing.
57. elementAdded() Page 3 of 59 In all other cases, the element is assumed to be a displayObject and added to the display list via a method named addObjectToDisplayList() This method ensures the child reaches the display list at the appropriate location Any listeners are notified of the fact that a new element was added and the invalidateDisplayList() and invalidateSize() methods are called to ensure the skin is sized and repositioned
58. More Recursion Page 3 of 59 The addition of each of these elements to the display list causes their initialize() methods to be called. They go through the same process of either instantiating components or instantiating skins, which then instantiate components, which may have skins, with components, with skins….
59. Back Up Page 3 of 59 Starting from the deepest point on the stack of children, each child does the following operations: invalidateProperties() invalidateSize() invalidateDisplayList() sets processedDescriptors = true dispatches its FlexEvent.INITIALIZE event
60. Child Additions Page 3 of 59 Starting from the deepest point on the stack of children, each children performs the following operations: invalidateProperties() invalidateSize() invalidateDisplayList() sets processedDescriptors = true dispatches its FlexEvent.INITIALIZE event
61. FlexEvent.INITIALIZE Page 3 of 59 The initialize event is always broadcast by the inner most child first. It signifies that all of the visual children have been created, however, the children nor the component have been sized or positioned at this time. This is a great place to make visual modifications to children.
62. findSkinParts() Page 3 of 59 After each skin initializes, you return to the attachSkin() method where the skin was first added. We now execute a method named findSkinParts(). This method looks through the SkinParts defined via the [SkinPart] metadata in any SkinnableComponent subclass. If it finds an element with a matching id in the skin, it provided the variable annotated with the [SkinPart] metadata with a reference to that part in the skin
63. partAdded() Page 3 of 59 As each of these parts is identified and the reference provided, the partAdded() method of SkinnableComponent is called and provided both the string name of the skin part and a reference to it: if (this[id] != null && !(this[id] is IFactory)) partAdded(id, this[id]); It is common to override this method in your own components to configure each skin part as it is added. There is a parallel method called partRemoved() which is called with the same arguments if a part is removed.
64. partAdded() Page 3 of 59 The default behavior of the partAdded() method is to dispatch a SkinPartEvent.PART_ADDED event with the partName and instance which can also be used for configuration or other logic
65. SkinStates Page 3 of 59 After all parts are added, the invalidateSkinState() method is called. When you define a SkinnableComponent, you can specify required SkinStates that the skin must fulfill. Meaning it will have those states defined in the skin. [SkinState("up")] [SkinState("over")] --- --- --- --- --- --- <s:states> <s:State name="up" /> <s:State name="over" /> </s:states>
66. SkinStates Page 3 of 59 The invalidateSkinState() method informs the component that the skin needs to know its new visual state As a result of this call, the getCurrentSkinState() method of this component will be called asynchronously. It is expected to return a string that matches one of those valid states It can derive this information in any way it chooses and is not bound to the component state
67. Deferred Page 3 of 59 After all of the skins are attached, the stack returns to the createChildren() method Here it calls a method named createDeferredContentIfNeeded() This method looks for any items specified in the mxmlContentFactory that have not yet been instantiated and creates them now… starting yet another recursive cycle. Note, this is where the Flex compiler assigned our original content
68. Deferred Creation Page 3 of 59 This means initialize is a bit trickier. Skins for a class are created before MXML content, so for instance the ApplicationSkin will be created well before the Button creation begins This is consistent with the use of initialize but, depending on the complexity of the skin may seem strange at first glance
69. Recursion Complete Page 3 of 59 One all of the children are initialized from the inner most to the outer, you will be able to finish the initialize() method of the Application that we started many slides ago. Now we need to worry about invalidation.
70. Invalidation Page 3 of 59 All of this invalidation effectively adds each of these components to a priority queue. This priority queue sorts based on the nestLevel that we mentioned earlier. As these queues are resolved the outer most item toward the deepest have their validateProperties() method called. Then the deepest moving toward the outermost have their validateSize() method called. Finally, from the outer toward deepest, the validateDisplayList() method is called
71. Invalidation Page 3 of 59 After each component has had a chance to complete all necessary validation, it is marked as initialized. Not this is different than the INITIALIZE event Marking a component as Initialized does two important things. it sets the component to visible (if applicable) It dispatches a FlexEvent.CREATION_COMPLETE
72. creationComplete Page 3 of 59 The FlexEvent.CREATION_COMPLETE means that all layout, sizing and positioning is complete and the item can now be visible on the screen. It is just about the worst time to do anything, save for operations that need to know the size and position of a child
73. Application Visible Page 3 of 59 Once all of the children have broadcast their creationComplete event, the time for the application to complete is here The application broadcasts its creationComplete, which is a trigger to System Manager. The System Manager destroys the preloader and adds the Application as a child to the System Manager, making it visible.
74. Application Complete Page 3 of 59 The act of making the application a child of the system manager is among the last acts performed before the System Manager broadcasts a FlexEvent.APPLICATION_COMPLETE from the Application. This signals that the application is ready to be used.