Adobe 26001360 Scripting Guide - Page 18
Object classes, Object inheritance, graphic object-paths, text, meshes, etc.-belongs to its own class
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 18 highlights
18 Object model concepts Your house can also contain other objects. Just like your house can contain other objects, the objects within the house can also contain a number of smaller objects. Each room, for example, is an object in the house, while each window, door, or appliance is an object inside of the room. Each object can respond to various commands according to its capabilities. Windows and doors, for example, can open or close-but the floor and ceiling cannot. Using scripting, you can talk to each object directly, or you can talk to them as part of the house. You have to be very specific, though-you can't tell your house to open a window without telling it which window you want to open. So windows, just like all other objects, need names or at least a numbering system so you can refer to them specifically. For example, you might say "Tell the house to open the north window of the living room." Objects also have properties that describe specific details about them, like color and size. Imagine that the properties of objects in your house can be changed. You might say, "Door, paint yourself blue." Because your door can respond to the command "paint," you'll soon have a door of a different color. Now let's apply this object model idea to Illustrator. The Illustrator application is the house, its documents are the rooms, and the objects in your documents are the windows and doors. You can tell Illustrator documents to add and remove objects. You can ask objects to get or change their properties. Object classes Objects with the same properties and behaviors are grouped into "classes." In the house example, windows and doors belong to their own classes, since they have unique properties, like number of panes for windows or the door style for doors. In Illustrator, every type of graphic object-paths, text, meshes, etc.-belongs to its own class, each with its own set of properties and behaviors. Properties such as visible bounds, width, and height, for example, are common to all page items. Object inheritance Object classes may also "inherit," or share, the properties of a parent, or superclass. When an class inherits properties, we call that class a child, or subclass of the class from which it inherits properties. So in our house example, windows and doors are subclasses of an openings class, since they are both openings in a house. In Illustrator, path items, for example, inherit geometric properties like width and height from the page item class. Classes will often have properties that aren't shared with their superclass. In our house, both a window and door inherit an opened property from the opening class, but a window has 12 Aug 03