YOUR FEEDBACK
SOA Feature Story: Real-Time SOA Starts with the Messaging Bus!
Gerardo Pardo-Castellote wrote: Regarding the previous comment about "TCP ...


2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
MXDJ TOP LINKS YOU MUST CLICK ON !


Ask the Expert
Basics of Flex explained

Digg This!

Page 2 of 4   « previous page   next page »

Object Orientation
Understanding of OOP (object oriented programming) is fundamental in being successful with the Flex framework and being able to get the most out of it. People without a computer science-related (or similar) background may not know much of the fundamental concepts that comprise OOP and how to apply them correctly, so here is a quick piece to help you out.

First, object-oriented programming is a programming paradigm where your code is organized into logical objects, and each object has properties and methods. Each object contains similar and/or related functionality, and is organized into classes that logically represent and logically organize its functionality.

For example: Let's say that we have a class "Automobile." This class would contain the information and functions necessary for our application to use the automobile class. We could have a numeric property for the number of wheels, the speed, and the direction (degrees on a compass). This class would also contain methods that control the actions of the Automobile object: accelerate, decelerate(break), turn, start engine, stop engine, etc. Our class would look something like this...

public class Automobile
{
    public var speed : Number;
    public var direction : Number;
    public var numWheels : Number;

    public function Automobile()
    { /* constructor */ }

    public function accellerate() : void
    { /* speed up the automobile */ }

    public function decellerate() : void
    { /* slow down the automobile */ }

    public function turn( direction : Number ) : void
    { /* turn the automobile */ }

    public function startEngine() : void
    { /* start the automobile engine */ }

    public function stopEngine() : void
    { /* stop the automobile engine */ }
}

Ok, now that we have a brief explanation of what object-oriented programming is, we can get into some more aspects of OOP: inheritance and interfaces.

Inheritance is a way to form new objects based on existing objects. When a class inherits from a base class, the new class can utilize public and protected properties and methods from the base class. Inheritance can be used to create different objects that utilize functions within the base class, so that the child classes all utilize the same code base. Inheritance can be used to extend the functionality of existing objects, and inheritance can also be used to override and/or change functionality from the base class.

In ActionScript 3.0, you can access the parent class of your class by using the "super" keyword. For instance, calling the constructor of the parent class would use "super()", where accessing a method of the parent class would use something like: "super.myMethodName()". If a property of the parent class is created with public or protected access, you can access that property in the child class directly by the property name (you would use this.propertyName, not super.propertyName).

Now, let's take our automobile example and apply it to inheritance. We already have a base Automobile class that covers the basic functionality. We can create child classes that extend the functionality of the automobile.

public class SportsCar extends Automobile
{
    public function SportsCar()
    {
       super();
    }
    override public function accellerate():void
    {
       /* we can override the accellerate function
         so that it accellerates faster than the base
         Automobile */
    }
}

public class Truck extends Automobile
{
    public function Truck()
    {
       super();
    }




public function tow() : void



{
       /* we can add a tow function that
         allows the Automobile class to tow
         items. */



}
}



Page 2 of 4   « previous page   next page »

About Andrew Trice
Andrew Trice is a consultant with Cynergy Systems in Washington, DC, where he specializes in development of Flex-based Rich Internet Applications. Andrew has over 5 years of proven experience in the RIA industry, including application design and development using Flex, Flash, ColdFusion, J2EE and .NET architectures.

LATEST FLEX STORIES & POSTS
Keys to Success When Load Testing Today's Flex Applications
In today's complex web application world, developers need to test applications that go beyond simple HTTP-based pages. They need to test Rich Internet Applications that incorporate complex technologies like Adobe's Flex. Adobe Flex applications may be different from applications you wo
Adobe's Kevin Lynch and Microsoft's Scott Guthrie to Keynote AJAX World RIA Conference & Expo
Two of the biggest launches in Rich Internet Application history took place in 2007/2008 when Adobe launched AIR 1.0 in February '08 and Microsoft launched Silverlight (September '07). At the 6th International AJAXWorld RIA Conference & Expo in October SYS-CON Events is delighted to be
Flex 4 SDK News
Yesterday, a new component architecture and feature specifications were provided to the Flex SDK open source developer community. The Flex team targets three primary teams: design in mind, developer productivity, and framework evolution.
Adobe Gives Yahoo & Google Special Flash Treatment
Adobe says it's going to 'dramatically improve' the search results of dynamic web content and rich Internet applications (RIAs) for Google and Yahoo by giving them optimized Flash Player technology. This new widgetry, which will read and index SWF files, is supposed to uncover informat
Food Dial, a Facebook RIA Application Written in Flex
Food Dial is not just a book of recipes. Here's the big idea - you came back home, tired and hungry. Start the Food Dial application and open the fridge. Here's the red pepper. Turn the dial with food categories...
DreamFace Interactive Delivers Mashup Kit: DreamFace-Fx for Adobe Flex
Following the private Beta release last month, DreamFace Interactive announced the general availability of the DreamFace-Fx Mashup Kit for Adobe Flex. As promised, DreamFace-Fx is the first Mashup Kit to reach developers in a comprehensive roadmap which will extend the DreamFace Open S
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE