Monday, May 5, 2008

Event Handling in action script 3

Many people ask what is event handling, the answer is that it is the technique in which we specify action that should performed on the occurrence of particular event. In Action Script 3 the event handling contains the following three elements:
Event Source: It is the element which actually receives the event. For example a button could be event source which may receive the event click. It is also called as event target as it is targeted by Flash Player and where the event actually occurs.
The Event: Event is the action, to which you want to respond to. It may be rollover, rollout etc...
Event response: Event response are the list of actions which are performed in response to the above mention event.
The Model could be like this:
function The_response( eventObject:EventType)
{
// list of actions
}
eventSource.addEventListener(EventType:EVENT_NAME, The_response);
The code has two sections: The first is the function which we have defined to contain series of actions that are to be performed in response to the event. Here The_response is the function name. This function has the parameter. Specifying the parameters is just like declaring variable. Here we have declared the parameter. There is always a class associated with the events. These classes work as a data type for the parameters of function. In between the opening and closing braces we write code which is the series of actions that are to be performed in response to the event.
After defining the function we can now evoke this function by using event source( may be a button) on the occurrence particular event. We accomplish this by defining addEventListener() method. We have to use events name as the first parameter and the method name without parenthesis as the second parameter.

Saturday, May 3, 2008

Data Types In Action Script

Action Script in a Object Oriented Programming language that comes with Flash Software. Every programming language has data types. Data types, as the name suggests are the types of data used in the code. The type of data may be string of characters, numbers or boolian. In Action Script data types can be divided into two main categories:

1) Primitive Data Type

2) Complex Data Type

The primitive Data type variables are stored at lower level of abstraction which means operations on this types of data type is faster. Primitive data type includes null, undefined, boolean, string and number. In contrast to the Primitive data type, complex data type is slower in the operation. This data type includes array, functions, Date, Movie Clip, void, Error and XML.

The Boolean data type has two values -true and false. The default value of a boolean variable is false. Null data types means the variable has the value null which means no value. void is a complex data Type and is generally used for the functions which returnes no value.

Friday, May 2, 2008

Classes In Flash Action Script

Flash is a software for creating high end web application. Action Script is a Object Oriented Programming Language packed with Flash. Classes are the main feature of any OOP language. A class contains data(properties) and methods(behaviours). After defining a class we create an object of that class. This oject hass all the properties in the class. The defined object is said to be of that class's data type. In action Script class can be built in or custom. There are 65 built in classes in action script. In the example below employee is a class. This class contains the variables age, name and salary and a class function info. The variables age, name and salary are said to be the properties of the class employee and info is the method or behaviour in the class.

class employee

{

public var age:number;

public var name:string;

private var salary:number;

public function info():string

{

// method

}

}

Thursday, May 1, 2008

Flash CS3 Professional

Flash CS3 Professional is software for developing interactive websites, games, mobile applications etc.CS3 is the latest iteration of the flash software launch by Adobe after acquiring Macromedia. Flash creates graphics in vector format, means the graphics can be scaled to any size without the loss of quality. It can also work with raster graphics. SWF(Shock Wave File) is the output version of the Flash File(FLA). The swf file can be viewable in web browser as an object if flash player plug-in is installed. The Flash Player is a run time environment. Flash has a programming language known as ActionScript. ActionScript is executed by AVM(ActionScript Virtual Machine). The AVM is a part of flash player. The current version is ActionScript 3. We can create interactive applications, games etc by using action script.