Tuesday, July 6, 2010

Loading Data From External Files


In AS2.0 "LoadVars" class was used, in AS3.0 it has been replaced by a much richer and more powerful set of classes.
In AS3.0 the first thing you do is create an instance of a "URLRequest" class.

For that flash.net.* Package is used.

To just go to another webpage use flash.net.navigateToURL(URLRequest Object);

GET is used when Data is to be send in address bar and POST is  used when its hidden in the actual HTTP request.

Method of Sending is set by the "method" property of "URLRequest" class. i.e.

var request : URLRequest = new URLRequest("http://server.com");
request.method = "GET";

For sending the data ,"data" property of "URLRequest" class is used.
i.e.
request.data = "name=josh&login=true";

What is difference between AS2.0 and AS3.0 ?

In AS2.0 Display types can't Implement the Polymorphism and they always had a fixed parent-child relationship with other instances.

In AS3.0 All Display types inherit from flash.display.DisplayObject.

AS3.0 provides runtime errors.

Strict typing is preserved at runtime in AS3.0, data mismatches are reported as errors.

AS3.0 has Intrinsic Event Model.

Regular Expressions has been added in AS3.0

E4X i.e. ECMA Script for XML is used in AS3.0 in place of DOM of AS2.0

What is OOPS ?

OOPS: Object Oriented Programming System or Structure, it is  an way of coding which closely resembles the property of evolution in nature.



It constitutes of Class and Objects also called Instances, and it implements three properties, Polymorphism, Encapsulation and Inheritence using the four access controls in ActionScript 3.0, which are:
  1. Public: Open to All.
  2. Private: Reserved for the Class.
  3. Protected: The Class and Subclass or Childclass can use it.
  4. Internal: All the classes in the package can access it.
There is one fifth control too called Final. It is used when we don't want that somebody can extend our class.


Let us consider the example of tyre. It extends the Class Rubber hence Inheritence, how the tyre is made from rubber we don't know hence Encapsulation, now we can create tyre of different types like cycle or car tyre etc which is only possible through polymorphism.