Effects-, fade for image . For that put the <mx:fade id= "fade" duration="5000" /> above an image tag<mx:image>
and in image tag add " : ---> onCreationCompleteEffect="{fade}"
Sunday, January 9, 2011
Friday, January 7, 2011
Simple mvc-my first mvc code
Model
The model contains the actual data, and for our example it should a class that hold list values. As I pointed out earlier we could use an ArrayCollection to store the list. For this we make an actionscript class named ListModel
The view should display model's changes and for this we mark the model class as [Bindable]. This is nice feature of ActionScript, no such thing in Java Swing.
Now, to add a new item in the list we simply nee an addElement function. In this example we make the model a singleton. This means that if we make more than one list they will share the same data.
01 | package org.bserban.flex.simplemvc.model |
02 | { |
03 | import mx.collections.ArrayCollection; |
04 | /** |
05 | * Model class used to store list data and to |
06 | * provide access to the list content. |
07 | * |
08 | * For demo purposes, we have only addElement. |
09 | */ |
10 | [Bindable] |
11 | public class ListModel |
12 | { |
13 | public var items :ArrayCollection = new ArrayCollection(); |
14 | private static var instance:ListModel; |
15 | public function ListModel(){ |
16 | instance=this; |
17 | } |
18 | /** |
19 | * For this demo we treat this class as singletone. |
20 | * If list is reused the component that reuse it |
21 | * must keep reference to model and controler. |
22 | */ |
23 | public static function getInstance():ListModel{ |
24 | if(instance == null){ |
25 | instance = new ListModel(); |
26 | } |
27 | return instance; |
28 | } |
29 |
30 | /** |
31 | * Add a new element to the list, the model is bindable, |
32 | * no further actions are required, the view |
33 | * is notified automatically. |
34 | */ |
35 | public function addElement(itm:String): void{ |
36 | items.addItem(itm); |
37 | trace(" item added, now we have:"+items.length); |
38 | } |
39 | } |
40 | } |
Controller
The controller is responsible for the interaction between view and model. In our case will make the validation of the text, it doesn't allow the view to add empty text into the list. Let's make a new class named Controller. As an exercise add also a sort function.
The controller holds a reference to the model and provides functions to the view. In a more advanced implementation the Controller would listen for events from the view and the decides what action should do.
01 | package org.bserban.flex.simplemvc.controller |
02 | { |
03 | import org.bserban.flex.simplemvc.model.ListModel |
04 | import mx.utils.StringUtil; |
05 |
06 | public class Controller{ |
07 |
08 | private var model:ListModel = ListModel.getInstance(); |
09 | /** |
10 | * Glue the interaction between view and model. |
11 | */ |
12 | public function Controller(){ |
13 | } |
14 | /*** add a new item into the list model.*/ |
15 | public function addPerson(name:String):void{ |
16 | if(name==null || StringUtil.trim(name).length==0){ |
17 | trace("emptyname"); |
18 | }else{ |
19 | model.addElement(name); |
20 | } |
21 | } |
22 | } |
23 | } |
24 | |
View
The view is the graphical representation of the component. Usually it is a an mxml file but it can be also an actions script file for advanced programmers. It binds his data to the model and use the controller to process the view events. Let's name it SimpleAirMVC.mxml. I added Air to its name because i decided to make an air project in Flex Builder.
01 | <?xml version="1.0" encoding="utf-8"?> |
02 | <mx:WindowedApplication |
03 | xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" |
04 | height="226" width="235"> |
05 | <mx:Script> |
06 | <![CDATA[ |
07 | import mx.controls.List; |
08 | import org.bserban.flex.simplemvc.model.ListModel; |
09 | import org.bserban.flex.simplemvc.controller.Controller; |
10 | [Bindable] |
11 | private var model:ListModel = ListModel.getInstance(); |
12 | private function clickHandler():void |
13 | { |
14 | var controler:Controller = new Controller(); |
15 | controler.addPerson(personTxt.text); |
16 | personTxt.text=""; |
17 | } |
18 | ]]> |
19 | </mx:Script> |
20 | <mx:TextInput x="10" y="10" id="personTxt" text="" |
21 | width="145"/> |
22 | <mx:Button x="163" y="10" label="Add" id="btnAdd" |
23 | click="clickHandler()"/> |
24 | <mx:List x="10" y="40" width="218" |
25 | dataProvider="{model.items}"></mx:List> |
26 | </mx:WindowedApplication> |
This is a simple way to implement a MVC in a small application. Things can become more complicated if the application is big. If this is the case then you should look over Pure MVC framework or Cairngorm. They eliminate the dependencies between MVC layer by using events. It is an event driven approach.
You may download the source code here SimpleAirMVC
Certification Adobe Flex
Flex 4 ACE Exam - References - Topic objective-wise
[Ctrl+Click on item to navigate to topic]
FIAW refer Flex in a Week video training
Docs mostly refer Using Flex 4
Download this document to local to view mouse over on each of the Doc links for reference path if accessed through Adobe Community Help application.
1. Creating a User Interface (UI)
• Identify and describe the basic UI controls used in a Flex application. (UI controls include: NumericStepper, TextInput, CheckBox, RadioButton).
Refer Actionscript API for TextInput, Numeric Stepper, CheckBox, RadioButton, RadioButtonGroup, Button, DataGrid, Image, RichEditableText, TextArea, ScrollBar
• Identify the purpose of UI containers and when to use them. (UI containers include: Group, SkinnableContainer, Application)
[Covered in next topic]
• Change the look and feel of a design by using API styles, style sheets, Spark skins, filters
and blends, and visual customizations by using Halo.
FIAW: Styling the visual display
• Dynamically change the look of an application by using Spark view states, transitions and effects.
FIAW: Animating components and states
• Position UI elements by using constraint-based layout.
FIAW: Using constraints to control component layout
• Implement application navigation by using navigator containers.
FIAW: Creating and navigating "pages" in a UI
• Customize list-based controls. (Customizing includes: using editors, renderers, label
functions)
FIAW: Displaying data with the DataGroup container
FIAW: Displaying data with List-based control
• Given a layout type, explain the differences and when to use that layout type. (Layout types include: percentage based, constraints based, and custom)
• Create a custom layout. (Including understanding the differences between container
and layout)
Book: Flex 4 Cookbook, Chapter 3.7 Create a Custom Layout
• Create and use custom components by using MXML and ActionScript.
FIAW: Creating MXML custom components with ActionScript properties
• Transfer data within an MXML component by using data bindings. (Including two way
binding)
FIAW: Generating an email address using data binding
FIAW: Using a two-way binding
• Create, handle, and dispatch events, including developer created event classes that extend the Event class.
FIAW: Understanding event-driven development
• Identify and describe the implementation and purpose of common software design patterns that are used in Flex. (Design patterns include: Observer, Command, and Data transfer)
• Understand the skinning architecture and the role of the SkinnableContainer class.
FIAW: Skinning Spark components
• Given a method in the component lifecycle explain the purpose of and when to use that
method. (Methods include: CreateChildren, UpdateDisplayList)
• Explain how modules are used in the development of a Flex application.
• Explain the use case and development workflow for building a custom preloader.
• Define and extend an ActionScript class.
• Implement an ActionScript interface.
• Use access modifiers with classes and class members.
• Implement data transfer objects.
• Implement accessor methods in ActionScript. (Methods include: explicit and implicit getter and setter)
[Currently link to original document is broken, so I uploaded it in Google Docs]
• Use an ArrayCollection to sort, filter, and provide data.
• Implement data validation.
• Manipulate XML data by using E4X.
• Implement events that function properly in the Flex event framework. (Including:
extends the Event class, call super(), override clone())
FIAW: Understanding event-driven development
FIAW: Extending events
• Implement real-time messaging by using producers and consumers.
• Explain the importance of and implement data paging on data sets.
[References needed]
• Understand synchronization and online/offline use cases using data management.
[References needed]
• Interact with remote data and services by using Remote Procedure Call (RPC) services.
(Services include: HTTPService, WebService, RemoteObject, URLRequest)
FIAW: Sending remote data
Refer Actionscript API for URLRequest
• Read, write, and upload local files from the local file system by using Flash Player 10 API.
(Including: the use of file filters)
Refer Actionscript API for FileReference, FileReferenceList, FileFilter
AIR Doc references can be obtained from http://help.adobe.com/en_US/AIR/1.5/devappsflex/index.html
There is no difference in actual content apart from formatting.
Doc link from Adobe Developer Connection / AIR Developer Center / Adobe AIR documentation http://help.adobe.com/en_US/air/build/index.html is not comphrehensive.
• Given a scenario, compile and export a release build of an AIR application. (Scenarios
include: Using Flex Builder, from the command line)
• Create, populate, and delete files and directories on a local file system.
Developing AIR applications with Flex / Files and data / Working with the file system
• Create and customize native windows and menus.
Developing AIR applications with Flex / Windows, menus, and taskbars / Working with native windows, Working with native menus
• Adding drag-and-drop functionality to and from the desktop.
Developing AIR applications with Flex / Files and data / Drag and Drop
• Install, uninstall, and update an AIR application.
Developing AIR applications with Flex / Distributing and updating applications
• List and describe the AIR security contexts.
Developing AIR applications with Flex / Application development essentials / AIR security
• Create, connect to, and define a local database.
• Add, update, and remove records from local database.
Developing AIR applications with Flex / Files and data / Working with local SQL databases
6. Other references:
[Helpful in solving questions from Attest]
Thursday, January 6, 2011
blogs i visited for flex
http://blog.saurabhnarula.com/
super blog for flex ....
http://sdflex.org/blog/category/flex/page/2
need to have a lot to read...........
http://blog.binaryneuron.com/samples/flex/video-player/
got examples for flex
http://weblog.mrinalwadhwa.com/2009/12/01/custom-components-in-flex-4/
mrinal-custom components
http://debabrataa.blogspot.com/
lot of books and materials i found
http://www.jamesward.com/
a very good blog from where i got paint application in flex :)
http://blog.anupamshah.net/
http://saumyaray.wordpress.com/2009/12/12/flex-basics-difference-and-similarities-with-flash/
from where i got link to make a page to pdf
JAN-15-2011
graphics
dEGRAFA
http://www.juanchez.com/2010/07/30/using-spark-skins-for-flex-3-components/
graphics
wave
http://www.senthilvelan.com/apps/FlexWave/FlexWave.html
spotlit
http://www.senthilvelan.com/apps/SpotLight/SpotLight.html
super blog for flex ....
http://sdflex.org/blog/category/flex/page/2
need to have a lot to read...........
http://blog.binaryneuron.com/samples/flex/video-player/
got examples for flex
http://weblog.mrinalwadhwa.com/2009/12/01/custom-components-in-flex-4/
mrinal-custom components
http://debabrataa.blogspot.com/
lot of books and materials i found
http://www.jamesward.com/
a very good blog from where i got paint application in flex :)
http://blog.anupamshah.net/
http://saumyaray.wordpress.com/2009/12/12/flex-basics-difference-and-similarities-with-flash/
from where i got link to make a page to pdf
JAN-15-2011
graphics
dEGRAFA
http://www.juanchez.com/2010/07/30/using-spark-skins-for-flex-3-components/
graphics
wave
http://www.senthilvelan.com/apps/FlexWave/FlexWave.html
spotlit
http://www.senthilvelan.com/apps/SpotLight/SpotLight.html
Quotes!!!!!!!!!!! Listen
Failure is an option, but fear is not!
curiosity is the most powerful thing you own.imagination is the force that can manifest the reality.
respect of your team is more important than all the laurels in the world.
do not put limitations on yourself, others will do it for you, dont do it to yourself, take risk.
failure is not an option?, failure has to be an option, in art and exploration coz its a leap of faith, no important endeavorer involving innovation has been done without taking a risk, you hav to be willing to take risk.
Monday, December 27, 2010
OUR LIFE
When the journey began the eyes of my mind was so small it could not forsee waht is going t o happen next .
But i was happy ........,iam happy nw because i know hat ever hapens in my life its because of my thoughts ,
what i thinks most will definitely come to our life , no had came to my life .
life is a strange mystery but that statemet itself is foolish ......why i say is life is like a folded thing but we can make it open in our way ,use your heart to open your way of life........
my heart my soul decides where i belongs i had done mistakes but that also is a part of my life... i love it i love it.... i am loving me i love me alot . do you love your self if not you cannot love anything any one.......
Stay alive enjoy this life........
But i was happy ........,iam happy nw because i know hat ever hapens in my life its because of my thoughts ,
what i thinks most will definitely come to our life , no had came to my life .
life is a strange mystery but that statemet itself is foolish ......why i say is life is like a folded thing but we can make it open in our way ,use your heart to open your way of life........
my heart my soul decides where i belongs i had done mistakes but that also is a part of my life... i love it i love it.... i am loving me i love me alot . do you love your self if not you cannot love anything any one.......
Stay alive enjoy this life........
Subscribe to:
Posts (Atom)
