Prev | Current Page 96 | Next

LordAlex Leon, Greg Goralski

"Foundation Flex for Designers"


If you are working with several files with a common goal, you will want to naturally organize them
somehow, perhaps grouping them into a folder or ???package??? (hence the name). This way, you can
share that group of files easily by transporting just one folder.
You would also like to give your package a descriptive and unique name, one that will give you a good
idea of what those files do and at the same time not conflict with another package. A good way to
137
ACTIONSCRIPT IN FLEX
avoid a name conflict is to use domain names, which are unique; for example, I own a domain name,
lordalex.org, and no one else can have that domain.
A name like myPackage would easily come in conflict with someone else??™s unless you use the domain
name. To use the domain name, create a directory named org. Inside that directory, create another
one (I use the name lordalex) and inside this folder place myPackage. Notice we use the domain in
reverse, i.e., org is before lordalex.
The nesting of folders is this fashion ensures that the files don??™t conflict with anyone else??™s. The resulting
structure looks like this:
org/lordalex/myPackage/MyClass.as
In ActionScript, to create a package you need to define it as shown in Figure 7-1.
Figure 7-1. Package definition
Classes and objects
Let??™s revisit the difference between classes and objects in a little more detail. A class is a fundamental
part of OOP; it is the blueprint for another entity we will become familiar with called an object.


Pages:
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
Turcja 1 mimre.benton.pl Biuro księgowe Lublin Fundusze Emerytalne petrozawodzkich.waw.pl