Top Level

# Object - AS3

Package | Top Level
Class | public dynamic class Object
Subclasses | ABRUtils, AbstractMessage, AbstractSearchFilterVO, AbstractStage, AbstractTarget, AccConst, Accessibility, AccessibilityImplementation, AccessibilityProperties, AccessPrivileges, ActionBarDefaultButtonAppearance, ActionScriptVersion, AdjustColor, AdvancedDataGridBaseSelectionData, AdvancedDataGridEventReason, AdvancedDataGridHeaderInfo, AdvancedDataGridRendererDescription, AdvancedDataGridRendererProvider, AggregatingToken, AirDragManagerAutomationHandler, AirFunctionsHelper, AlertFormatter, AlignmentArea, AllRuntimeSparkControls, Animation, AnimatorFactoryBase, AntiAliasType, ApplicationConstants, ApplicationDomain, ApplicationDomainTarget, ApplicationListItem, ApplicationSpecifier, ApproverStatus, ApproverStatus, arguments, Array, ArrayUtil, ArrowDirection, Asset, AssetAction, AssetAction, AssetExplorerServiceDelegate, AssetPropertyDescriptor, AssetPropertyDescriptor, AssetQueryServiceDelegate, AssetTypeDescriptor, AssetTypeDescriptor, AssetValidationFaultType, AssetVO, Assignment, AssignmentConstants, AsyncResponder, AsyncTokenWrapper, AttachmentCommand, AttachmentInfo, AttachmentLoader, AttachmentPermissions, Attribute, AudioDecoder, AudioPlaybackMode, AuditLevel, Auditor, AuthenticationMethod, AuthFailureCode, AuthOptions, AuthorStatus, AuthResult, AuthStatus, AutoCapitalize, Automation, AutomationClass, AutomationEventDescriptor, AutomationHelper, AutomationID, AutomationIDPart, AutomationMethodDescriptor, AutomationPropertyDescriptor, AvailablePropertyIterator, AverageAggregator, AVNetworkingParams, AVTagData, AxisLabel, AxisLabelSet, AXMAccordionItemVO, Back, Back, Back, BackgroundColor, Base64Decoder, Base64Encoder, BaseEntityVO, BaselineOffset, BaselineShift, BaseUser, BaseVO, BezierEase, BezierSegment, BinaryOperator, BindingElement, BindingUtils, BitmapData, BitmapDataChannel, BitmapEncodingColorSpace, BitmapFillMode, BitmapFilter, BitmapFilterQuality, BitmapFilterType, BitmapScaleMode, BitmapSmoothingQuality, BitmapUtil, BlendMode, BlockProgression, Boolean, Bounce, Bounce, Bounce, Bounce, BoundedValue, BoxDirection, BreakOpportunity, BrowserManager, BundleConstants, BundleContext, ButtonLabelPlacement, ButtonLabelPlacement, ByteArray, CachePolicy, CalloutPosition, CameraPosition, CameraRollBrowseOptions, Capabilities, CapsStyle, CartesianCanvasValue, CatalogConstants, CatalogListItem, CatalogSpecifier, Category, CategoryType, CDMAssignment, CellPosition, CellRegion, CertificateStatus, CFFHinting, ChangedItems, ChangeWatcher, CharacterUtil, ChartData, ChartSeries, ChartState, Circular, Circular, Class, ClassFactory, ClearFloats, Clipboard, ClipboardFormats, ClipboardTransferMode, Collator, CollatorMode, CollectionEventKind, CollectionFunc, ColorCorrection, ColorCorrectionSupport, ColorTransform, ColorUtil, ColumnAlign, ColumnState, Comment, CommentManager, ComparisonOperator, ComponentDescriptor, CompositionAttributeRange, CompoundTransform, CompressionAlgorithm, Concurrency, Condition, Config, ConfigModel, Configuration, ConfigUtil, Conflict, ConflictDetector, ContainerController, ContainerCreationPolicy, ContainerDestructionPolicy, ContainerLayout, ContainerLayout, ContentBackgroundAppearance, ContentDomainFactory, ContentElement, ContentServiceProvider, Context3DBlendFactor, Context3DBufferUsage, Context3DClearMask, Context3DCompareMode, Context3DFillMode, Context3DMipFilter, Context3DProfile, Context3DProgramType, Context3DRenderMode, Context3DStencilAction, Context3DTextureFilter, Context3DTextureFormat, Context3DTriangleFace, Context3DVertexBufferFormat, Context3DWrapMode, ContextData, ContextMenuBuiltInItems, ContextMenuClipboardItems, ConversionFunc, ConversionType, ConverterBase, CountAggregator, CreatedAtType, CreatedAtType, CreditCardValidatorCardType, CSMSettings, CSSCondition, CSSConditionKind, CSSSelector, Cubic, Cubic, CuePointManager, CuePointType, CuePointType, CurrencyFormatter, CurrencyParseResult, CurrencyValidatorAlignSymbol, CursorBookmark, CursorManager, CursorManagerPriority, CustomAction, CustomActions, CustomAttribute, CustomEase, DataCaptureUIControlFactory, DataChangeType, DataDescription, DataDictionary, DataDictionaryElement, DataDictionaryElementSubType, DataDictionaryElementType, DataDictionaryReference, DataDictionarySearchFilter, DataDictionaryType, DataDictionaryUtil, DataDownload, DataGridColumn, DataGridEventReason, DataGridEventReason, DataManager, DataModelFactory, DataModule, DataServiceAdapter, DataServiceOfflineAdapter, DataStoreEventDispatcher, Date, DateBase, DateChooserEventDetail, DateRange, DateRangeUtilities, DateSelectorDisplayMode, DateTimeFormatter, DateTimeFunc, DateTimeNameContext, DateTimeNameStyle, DateTimeStyle, DCTServiceProvider, DCTServiceProviderImpl, DDExtendedPropertiesConstants, DefaultDataDescriptor, DefaultExpressionLoader, DefaultResponder, DefaultResponder, DefaultSummaryCalculator, Deferred, DeferredInstanceFromClass, DeferredInstanceFromFunction, Dictionary, DigitCase, DigitWidth, Direction, DisplacementMapFilterMode, DisplayObjectSharingMode, DisplayUtil, Document, DocumentAssignment, DocumentItem, DocumentReference, DocumentSection, DocumentType, DocumentType, DomainFactory, DomainFactoryImpl, DomainInstanceFactory, DomainObject, DomainUtil, DPIClassification, DragManager, DragSource, DRMContentData, DRMDeviceGroup, DRMPlaybackTimeWindow, DRMState, DRMVoucher, DropLocation, DSClassAliasInitializer, DurationUnit, DurationUnit, DynamicMatrix, DynamicProperty, DynamicStreamingItem, DynamicStreamingVideoItem, DynamicStreamingVideoSource, EaseInOutBase, EasingFraction, EBToolBarNameType, EdgeMetrics, EditingMode, EffectTargetFilter, Elastic, Elastic, Elastic, Elastic, ElementFormat, ElementRange, EncryptedLocalStore, EncryptionKeyGenerator, Endian, Error, ErrorManager, ErrorManagerImpl, Event, EventDetails, EventDispatcher, EventPhase, EventPriority, Exponential, Exponential, Expression, ExpressionBuilder, ExpressionImpl, ExpressionManagerImpl, ExpressionValidationResult, ExpressionVO, ExternalInterface, FactoryAdapter, Fault, FaultResponse, FavoritesManager, FiberUtils, Field, FieldAssignment, FieldModel, FileData, FileDataService, FileFilter, FileMode, FileModel, FileSystemEnumerationMode, FileSystemSizeDisplayMode, FlexConfiguration, FlexGlobals, FlexPrintJob, FlexPrintJobScaleType, FlexVersion, Float, FlowComposerBase, FlowDamageType, FlowElement, FlowOperation, FocusDirection, FocusManager, FocusRequestDirection, Folder, Font, FontDescription, FontLookup, FontMetrics, FontPosture, FontStyle, FontType, FontWeight, Form, FormatDescriptor, FormatMessage, Formatter, FormatterUtil, FormatValue, FormEvents, FormItemDirection, FormState, FragmentDetails, FragmentLayoutState, FrameworkConstants, Function, FunctionEase, FunctionFamilyVO, FunctionListContainer, FunctionParameterVO, FunctionService, FunctionVO, GameInputDevice, GesturePhase, GlobalizationUtils, GlobalSettings, GradientType, Graphics, GraphicsBitmapFill, GraphicsEndFill, GraphicsGradientFill, GraphicsPath, GraphicsPathCommand, GraphicsPathWinding, GraphicsShaderFill, GraphicsSolidFill, GraphicsStroke, GraphicsTrianglePath, GraphicsUtil, GraphicsUtilities, GravityInit, GridFitType, GridSelectionEventKind, GridSelectionMode, Grouping, GroupingField, GroupSpecifier, GuideAccessibility, GuideNodeType, H264Level, H264Profile, HaloColors, HaloDefaults, HandlerHolder, HistoryManager, HitData, HorizontalAlign, HorizontalAlign, HostedGuide, HSBColor, HSBInterpolator, HTMLHistoryItem, HTMLHost, HTMLMediaContainer, HTMLPDFCapability, HTMLSWFCapability, HTMLWindowCreateOptions, HTTPUtil, IconPlacement, ID3Info, IKArmature, IKBone, IKJoint, ImageDecodingPolicy, ImageSnapshot, IMEConversionMode, ImmediateFaultToken, ImmediateSuccessToken, IndexBuffer3D, InlineGraphicElementStatus, InstanceCache, int, InteractionInputType, InteractionMode, InteractionState, InterfaceAddress, InternalConfig, InterpolationMethod, InterruptionBehavior, IntUtil, InvalidateRequestData, InvalidationType, InvokeEventReason, IPVersion, ItemResponder, JobId, JobStatus, JointStyle, JPEGEncoder, JPEGEncoderOptions, JPEGXREncoderOptions, JSON, JustificationRule, JustificationStyle, Kerning, Keyboard, KeyboardType, Keyframe, KeyframeBase, KeyLocation, LabelUtil, LastOperationStatus, LastOperationStatus, LayoutDirection, LayoutMode, LCCQueryServiceFactory, LCTaskManagerServiceConstants, LDMAssignment, LeadingModel, LegendData, Letter, LetterInstanceBuilder, LetterState, LigatureLevel, Linear, Linear, Linear, LineBreak, LineJustification, LineScaleMode, LineSeriesSegment, LinkedList, LinkedListNode, LinkState, ListBaseSeekPending, ListBaseSelectionData, ListData, ListEventReason, ListRowInfo, ListStylePosition, ListStyleType, LoaderContext, LoaderUtil, LoadState, LoadVoucherSetting, Locale, LocaleID, LocalizedGanttItemStates, Log, Log, LogEventLevel, Logger, Logger, LoggerFactory, LogLevel, MailParam, MailPart, Managed, ManagedAssociation, ManagedEntity, ManagedOperation, ManualSyncConfiguration, MaskType, Math, MathFunc, Matrix, Matrix3D, MatrixTransformer, MaxAggregator, MBeanFeatureInfo, MBeanInfo, MediaErrorCodes, MediaFactoryItem, MediaFactoryItemType, MediaPlayerState, MediaResourceBase, MediaTraitType, MediaType, MediaType, Message, MessageCacheItem, MessageChannelState, MessageCodes, MessageNumbers, MessagePerformanceUtils, MetricBase, MetricErrorCodes, MetricFactory, MetricFactoryItem, MetricRepository, MetricType, MetricValue, MicrophoneEnhancedMode, MicrophoneEnhancedOptions, MimeType, MinAggregator, ModelExtension, ModuleAssignment, ModuleManager, MotionBase, MotionPath, Mouse, MouseCursor, MouseCursorData, MultiDPIBitmapSource, Multitouch, MultitouchInputMode, MultiValueInterpolator, Mutex, MXMLObjectAdapter, Namespace, NameUtil, NameValuePair, NationalDigitsType, NativeDragActions, NativeDragManager, NativeDragOptions, NativeProcessStartupInfo, NativeWindowDisplayState, NativeWindowInitOptions, NativeWindowRenderMode, NativeWindowResize, NativeWindowSystemChrome, NativeWindowType, NavigationUnit, NavigationUtil, NavigatorHostInstance, NCManager, NetGroupInfo, NetGroupReceiveMode, NetGroupReplicationStrategy, NetGroupSendMode, NetGroupSendResult, NetStreamAppendBytesAction, NetStreamInfo, NetStreamMulticastInfo, NetStreamPlayTransitions, NetworkInterface, NetworkMonitor, None, NotificationStyle, NotificationType, Number, NumberBase, NumberBaseRoundType, NumberFormatter, NumberInterpolator, NumberParseResult, NumberValidatorDomainType, ObjectEncoding, ObjectInstance, ObjectName, ObjectState, ObjectType, ObjectUtil, OLAPAxisPosition, OLAPCell, OLAPDataGridRendererProvider, OLAPQuery, OLAPQueryAxis, OLAPResult, OLAPResultAxis, OLAPSchema, OLAPSet, OLAPTrace, OLAPTuple, OnDemandEventDispatcher, OperationInfo, OperationParameter, OperationType, Orientation3D, OSMFSettings, OSMFStrings, OverflowPolicy, OverlayDepth, PackageDefinition, PackageDefinitionLoader, PackageElement, PageInformation, PanelBreak, PaperSize, Participant, ParticipantAttributes, PdfInfo, PdfPageDetail, PdfParam, PDFResponseType, PermissionStatus, PersistenceManager, PerspectiveProjection, Pin, PixelSnapping, PlaybackDetails, PlayState, PluginInfo, PNGEncoder, PNGEncoderOptions, Point, PopHeader, PopRecord, PopUpManager, PopUpManagerChildList, PopUpPosition, Portfolio, PostScaleAdapter, PreferencesManager, PreviewUIControlFactory, PrincipalSearchFilterVO, PrincipalVO, PrintJobOptions, PrintJobOrientation, PrintMethod, PrintUIOptions, Process, ProcessConstants, ProcessInstance, ProcessVariable, Program3D, ProgressBarDirection, ProgressBarDirection, ProgressBarLabelPlacement, ProgressBarMode, ProgressBarMode, ProjectManagementCoreService, ProjectManagementQueryService, ProjectState, ProjectStatus, ProjectType, Property, Property, PropertyChangeEventKind, PropertyChanges, PropertySpecifier, ProviderFactory, ProviderFactoryImpl, QName, QoSInfo, QoSInfoHistory, Quadratic, Quadratic, QualifiedResourceManager, QualityLevel, Quartic, Quartic, Query, QueryServiceFactory, QueueConstants, QueuesManager, Quintic, Quintic, RCADomainFactory, RCADomainFactoryImpl, RCAPermission, RCAPermission, RCAServiceProvider, RCAServiceProviderImpl, RecipientType, RecipientType, Recommendation, Rectangle, RectangularDropShadow, ReferencesValidationSetting, RegExp, Regular, RelationParameters, RelationshipVO, Reminder, RemoteNotifierSubscribeOptions, RemotingServiceInfo, RenderData, RenderingMode, RepeatBehavior, ResizeMode, ResolvedContent, ResourceBundle, ResourceManager, ResourceRecord, Responder, Responder, ReturnKeyLabel, RevertManager, Review, ReviewCommentingAndApproval, ReviewCommentingAndApprovalUtil, ReviewCommentVisibility, ReviewCommentVisibility, ReviewContext, ReviewContext, ReviewerStatus, ReviewerStatus, ReviewSearchFilter, ReviewStatus, ReviewStatus, ReviewTemplateReference, ReviewType, ReviewType, RevocationCheckSettings, RGBInterpolator, Roles, RotateDirection, RowAlign, RpcClassAliasInitializer, RPCObjectUtil, RPCStringUtil, RPCUIDUtil, RSLData, RuleBase, RuleType, RuleUtils, RuntimeDPIProvider, Sample, ScaleMode, ScaleMode, Scene, SchemaTypeRegistry, ScrollBarDirection, ScrollBarDirection, ScrollEventDetail, ScrollEventDirection, ScrollEventDirection, ScrollIntoViewUtil, ScrollPolicy, ScrollPolicy, ScrollPolicy, ScrollSnappingMode, SearchFilter, SearchFilter, SearchFilter, SearchFilterAttribute, SearchFilterCondition, SearchFilterSort, SearchParameters, SearchParameters, SearchQuery, SearchQuery, SearchTemplate, SearchTemplateDescriptor, SearchUIControlFactory, Security, SecurityConfig, SecurityDomain, SecurityPanel, SecurityUtil, SelectionFormat, SelectionManager, Sequence, SerializationFilter, ServerConfig, ServerConstants, ServiceBinder, ServiceDelegate, ServiceElement, ServiceElementCollection, ServiceLocator, ServiceLocator, ServiceLocator, ServiceLocator, ServiceLocator, ServiceLocator, ServiceProvider, ServiceProvider, ServiceProvider, ServiceProvider, ServiceProviderImpl, Session, Session, SessionConfiguration, SessionMap, SessionToken, SHA256, SHA256, Shader, ShaderData, ShaderInput, ShaderParameter, ShaderParameterType, ShaderPrecision, SharedObjectFlushStatus, SignatureOptions, SignatureOptions, SignatureStatus, SignerTrustSettings, SimpleCollectionItem, SimpleEase, SimpleXMLDecoder, SimpleXMLEncoder, Sine, Sine, SliderDirection, SliderDirection, SliderEventClickTarget, SliderEventClickTarget, SlideViewTransitionMode, SOAPHeader, SOAPResult, SoftKeyboardTrigger, SoftKeyboardType, SortFieldImpl, SortInfo, SoundCodec, SoundLoaderContext, SoundMixer, SoundTransform, Source, SparkRichEditableTextAutomationHelper, SplashScreenImage, SplashScreenImageSource, SpreadMethod, SQLCollationType, SQLColumnNameStyle, SQLColumnSchema, SQLErrorOperation, SQLMode, SQLResult, SQLSchema, SQLSchemaResult, SQLTransactionLockType, StackFrame, Stage, StageAlign, StageAspectRatio, StageDisplayState, StageFactory, StageManager, StageOrientation, StageQuality, StageScaleMode, StageStatus, StageStatus, StageTemplateSearchFilterVO, StageTextClearButtonMode, StageTextInitOptions, StageTypes, StageTypes, StageVideoAvailability, StageVideoAvailabilityReason, StateDeserializer, Statement, Statement, StateSerializer, StatusReasonCode, StorageVolume, StreamingItem, StreamingItemType, StreamType, String, StringFunc, StringOperand, StringTools, StringUtil, Strong, Style, StyleManager, StyleManager, StyleProxy, SubscriptionInfo, Suffix, SumAggregator, SummaryField, SummaryField2, SummaryObject, SummaryRow, SupportingDocument, SupportingDocument, SWFVersion, SwitchingRuleBase, SwitchSymbolFormatter, SyncManager, System, SystemIdleMode, SystemUpdaterType, TabAlignment, Table, TableColumnDetails, TabOrderManager, TabStop, TabStopFormat, TargetArea, TargetAreaAssignment, TaskACL, TaskAttachmentInfo, TaskCommand, TaskConstants, TaskFormSaveCommand, TaskFormSubmitCommand, TaskFormTakeOfflineCommand, TaskManagerServiceConstants, TaskProperty, TaskTypes, TaskTypes, TBXState, TBXType, TeamMember, Telemetry, TemplateSearchFilter, TemplateSearchFilterVO, TextAlign, TextBaseline, TextBlock, TextClipboard, TextColorType, TextConverter, TextDecoration, TextDisplayMode, TextEditingConstants, TextFieldAutomationHelper, TextFieldAutoSize, TextFieldType, TextFlowLine, TextFlowLineLocation, TextFlowUtil, TextFormat, TextFormatAlign, TextInteractionMode, TextJustifier, TextJustify, TextLayoutFormat, TextLayoutVersion, TextLineCreationResult, TextLineFactoryBase, TextLineMetrics, TextLineMirrorRegion, TextLineRecycler, TextLineValidity, TextRange, TextRange, TextRenderer, TextRotation, TextScrap, TextSelectionHighlighting, TextSnapshot, ThrottleType, Ticket, TicketType, TileBaseDirection, TileDirection, TileListCollectionItem, TileOrientation, TimelineMarker, TLFTypographicCase, Token, Token, Token, TouchEventIntent, TouchInteractionReason, TouchscreenType, Transform, Transition, TriangleCulling, TruncationOptions, Tweenables, TypographicCase, UIComponentCachePolicy, UIDUtil, UIFTETextFieldAutomationImpl, uint, UIServiceFactoryProxy, UITextFieldAutomationImpl, UnaryOperator, UndoManager, UpdateCollectionRange, Updater, URIParser, URLLoaderDataFormat, URLRequest, URLRequestDefaults, URLRequestHeader, URLRequestMethod, URLUtil, URLVariables, User, User, User, UserManager, UserPreference, Util, Utils3D, ValidationResult, Variable, VariableAssignment, VariableOperand, VariableVO, Vector, Vector3D, Version, VertexBuffer3D, VerticalAlign, VerticalAlign, VerticalAlign, VideoAlign, VideoCodec, VideoScaleMode, VideoState, VideoStatus, VideoStreamSettings, ViewNavigatorAction, ViewReturnObject, ViewSource, ViewTransitionDirection, VoucherAccessInfo, WhiteSpaceCollapse, WipeDirection, WorkerDomain, WorkerState, WorkItem, WorkItemManagementService, WorkspaceSession, WSDLBinding, X500DistinguishedName, X509Certificate, XML, XMLConfigProvider, XMLList, XMLNode, XMLNodeType, XMLNotifier, XMLUI, XMLUtil, ZipCodeValidatorDomainType

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

The Object class is at the root of the ActionScript class hierarchy. Objects are created by constructors using the `new` operator syntax, and can have properties assigned to them dynamically. Objects can also be created by assigning an object literal, as in:
Copy

    var obj:Object = {a:"foo", b:"bar"}

All classes that don't declare an explicit base class extend the built-in Object class.

You can use the Object class to create associative arrays. At its core, an associative array is an instance of the Object class, and each key-value pair is represented by a property and its value. Another reason to declare an associative array using the Object data type is that you can then use an object literal to populate your associative array (but only at the time you declare it). The following example creates an associative array using an object literal, accesses items using both the dot operator and the array access operator, and then adds a new key-value pair by creating a new property:

Copy

     var myAssocArray:Object = {fname:"John", lname:"Public"};
     trace(myAssocArray.fname);     // John
     trace(myAssocArray["lname"]);  // Public
     myAssocArray.initial = "Q";
     trace(myAssocArray.initial);   // Q

ActionScript 3.0 has two types of inheritance: class inheritance and prototype inheritance:

- Class inheritance - is the primary inheritance mechanism and supports inheritance of fixed properties. A fixed property is a variable, constant or method declared as part of a class definition. Every class definition is now represented by a special class object that stores information about the class.
- Prototype inheritance - is the only inheritance mechanism in previous versions of ActionScript and serves as an alternate form of inheritance in ActionScript 3.0. Each class has an associated prototype object, and the properties of the prototype object are shared by all instances of the class. When a class instance is created, it has a reference to its class's prototype object, which serves as a link between the instance and its associated class prototype object. At run time, when a property is not found on a class instance, the delegate, which is the class prototype object, is checked for that property. If the prototype object does not contain the property, the process continues with the prototype object's delegate checking in consecutively higher levels in the hierarchy until the Flash runtime finds the property.

Both class inheritance and prototype inheritance can exist simultaneously, as shown in the following example:

Copy

     class A {
         var x = 1
         prototype.px = 2
     }
     dynamic class B extends A {
         var y = 3
         prototype.py = 4
     }

     var b = new B()
     b.x // 1 via class inheritance
     b.px // 2 via prototype inheritance from A.prototype
     b.y // 3
     b.py // 4 via prototype inheritance from B.prototype

     B.prototype.px = 5
     b.px // now 5 because B.prototype hides A.prototype

     b.px = 6
     b.px // now 6 because b hides B.prototype

Using functions instead of classes, you can construct custom prototype inheritance trees. With classes, the prototype inheritance tree mirrors the class inheritance tree. However, since the prototype objects are dynamic, you can add and delete prototype-based properties at run time.

View the examples

Learn more

Associative arrays
Associative arrays with string keys

Related API Elements

prototype

Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | prototype : Object [static] A reference to the prototype object of a class or function object. | Object

Public Methods

| Method | Defined By
--- | --- | ---
|  | Object() Creates an Object object and stores a reference to the object's constructor method in the object's constructor property. | Object
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### constructor

property

`public var constructor:Object`

Runtime Versions: | Flash Player 9, Flash Lite 4, Flash Player 9, AIR 1.0

A reference to the class object or constructor function for a given object instance. If an object is an instance of a class, the `constructor` property holds a reference to the class object. If an object is created with a constructor function, the `constructor` property holds a reference to the constructor function. Do not confuse a constructor function with a constructor method of a class. A constructor function is a Function object used to create objects, and is an alternative to using the `class` keyword for defining classes.

If you use the `class` keyword to define a class, the class's prototype object is assigned a property named `constructor` that holds a reference to the class object. An instance of the class inherits this property from the prototype object. For example, the following code creates a new class, `A`, and a class instance named `myA`:

Copy

         dynamic class A {}
         trace(A.prototype.constructor);      // [class A]
         trace(A.prototype.constructor == A); // true
         var myA:A = new A();
         trace(myA.constructor == A);         // true

Advanced users may choose to use the `function` keyword instead of the `class` keyword to define a Function object that can be used as a template for creating objects. Such a function is called a constructor function because you can use it in conjunction with the `new` operator to create objects. If you use the `function` keyword to create a constructor function, its prototype object is assigned a property named `constructor` that holds a reference to the constructor function. If you then use the constructor function to create an object, the object inherits the `constructor` property from the constructor function's prototype object. For example, the following code creates a new constructor function, `f`, and an object named `myF`:

Copy

         function f() {}
         trace(f.prototype.constructor);      // function Function() {}
         trace(f.prototype.constructor == f); // true
         var myF = new f();
         trace(myF.constructor == f);         // true

Note: The `constructor` property is writable, which means that user code can change its value with an assignment statement. Changing the value of the `constructor` property is not recommended, but if you write code that depends on the value of the `constructor` property, you should ensure that the value is not reset. The value can be changed only when the property is accessed through the prototype object (for example, `className.prototype.constructor`).

If you access the `constructor` property and compile in strict mode, you will get an error at compile time because the constructor property depends on the protoype object, which is a runtime entity. If you use standard mode or if the class description specifies "dynamic", the code runs without generating an error.

Related API Elements

Class
Function
prototype

### prototype

property

`public static var prototype:Object`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

A reference to the prototype object of a class or function object. The `prototype` property is automatically created and attached to any class or function object that you create. This property is static in that it is specific to the class or function that you create. For example, if you create a class, the value of the `prototype` property is shared by all instances of the class and is accessible only as a class property. Instances of your class cannot directly access the `prototype` property.

A class's prototype object is a special instance of that class that provides a mechanism for sharing state across all instances of a class. At run time, when a property is not found on a class instance, the delegate, which is the class prototype object, is checked for that property. If the prototype object does not contain the property, the process continues with the prototype object's delegate checking in consecutively higher levels in the hierarchy until the Flash runtime finds the property.

Note: In ActionScript 3.0, prototype inheritance is not the primary mechanism for inheritance. Class inheritance, which drives the inheritance of fixed properties in class definitions, is the primary inheritance mechanism in ActionScript 3.0.

Constructor Detail

### Object

()
Constructor

`public function Object()`

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

Creates an Object object and stores a reference to the object's constructor method in the object's `constructor` property.

Method Detail

### hasOwnProperty

()
method

`AS3 function hasOwnProperty(name:String):Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

Indicates whether an object has a specified property defined. This method returns `true` if the target object has a property that matches the string specified by the `name` parameter, and `false` otherwise. The following types of properties cause this method to return `true` for objects that are instances of a class (as opposed to class objects):

- Fixed instance properties—variables, constants, or methods defined by the object's class that are not static;
- Inherited fixed instance properties—variables, constants, or methods inherited by the object's class;
- Dynamic properties—properties added to an object after it is instantiated (outside of its class definition). To add dynamic properties, the object's defining class must be declared with the `dynamic` keyword.

The following types of properties cause this method to return `false` for objects that are instances of a class:

- Static properties—variables, constants, or methods defined with the static keyword in an object's defining class or any of its superclasses;
- Prototype properties—properties defined on a prototype object that is part of the object's prototype chain. In ActionScript 3.0, the prototype chain is not used for class inheritance, but still exists as an alternative form of inheritance. For example, an instance of the Array class can access the `valueOf()` method because it exists on `Object.prototype`, which is part of the prototype chain for the Array class. Although you can use `valueOf()` on an instance of Array, the return value of `hasOwnProperty("valueOf")` for that instance is `false`.

ActionScript 3.0 also has class objects, which are direct representations of class definitions. When called on class objects, the `hasOwnProperty()` method returns `true` only if a property is a static property defined on that class object. For example, if you create a subclass of Array named CustomArray, and define a static property in CustomArray named `foo`, a call to `CustomArray.hasOwnProperty("foo")` returns `true`. For the static property `DESCENDING` defined in the Array class, however, a call to `CustomArray.hasOwnProperty("DESCENDING")` returns `false`.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the `override` keyword. For example, A subclass of Object implements `function hasOwnProperty():Boolean` instead of using an override of the base class.

Parameters

| `name:String` — The property of the object.

Returns

| `Boolean` — If the target object has the property specified by the `name` parameter this value is `true`, otherwise `false`.

### isPrototypeOf

()
method

`AS3 function isPrototypeOf(theClass:Object):Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. This method returns `true` if the object is in the prototype chain of the object specified by the `theClass` parameter. The method returns `false` if the target object is absent from the prototype chain of the `theClass` object, and also if the `theClass` parameter is not an object.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the `override` keyword. For example, A subclass of Object implements `function isPrototypeOf():Boolean` instead of using an override of the base class.

Parameters

| `theClass:Object` — The class to which the specified object may refer.

Returns

| `Boolean` — If the object is in the prototype chain of the object specified by the `theClass` parameter this value is `true`, otherwise `false`.

### propertyIsEnumerable

()
method

`AS3 function propertyIsEnumerable(name:String):Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

Indicates whether the specified property exists and is enumerable. If `true`, then the property exists and can be enumerated in a `for..in` loop. The property must exist on the target object because this method does not check the target object's prototype chain.

Properties that you create are enumerable, but built-in properties are generally not enumerable.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the `override` keyword. For example, A subclass of Object implements `function propertyIsEnumerable():Boolean` instead of using an override of the base class.

Parameters

| `name:String` — The property of the object.

Returns

| `Boolean` — If the property specified by the `name` parameter is enumerable this value is `true`, otherwise `false`.

### setPropertyIsEnumerable

()
method

`public function setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

Sets the availability of a dynamic property for loop operations. The property must exist on the target object because this method does not check the target object's prototype chain.

Parameters

| `name:String` — The property of the object.
| `isEnum:Boolean` (default = `true`)`` — If set to `false`, the dynamic property does not show up in `for..in` loops, and the method `propertyIsEnumerable()` returns `false`.

Related API Elements

propertyIsEnumerable()

### toLocaleString

()
method

`public function toLocaleString():String`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

Returns the string representation of this object, formatted according to locale-specific conventions.

The default implementation of this method does not perform locale-specific formatting and returns the same string as `toString()`. Subclasses should provided their own locale-aware implementation when appropriate.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the `override` keyword. For example, a subclass of Object implements `function toLocaleString():String` instead of using an override of the base class.

Returns

| `String` — A string representation of this object formatted according to local conventions.

Related API Elements

Object.toString()

### toString

()
method

`public function toString():String`

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

Returns the string representation of the specified object.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the `override` keyword. For example, a subclass of Object implements `function toString():String` instead of using an override of the base class.

Returns

| `String` — A string representation of the object.

### valueOf

()
method

`public function valueOf():Object`

Runtime Versions: | Flash Player 9, AIR 1.0, Flash Lite 4

Returns the primitive value of the specified object. If this object does not have a primitive value, the object itself is returned.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the `override` keyword. For example, A subclass of Object implements `function valueOf():Object` instead of using an override of the base class.

Returns

| `Object` — The primitive value of this object or the object itself.

Related API Elements

Object.toString()
Examples How to use this example
ObjectExample.as
The following example uses the classes `ObjectExample` and `Circle` to demonstrate the dynamic nature of the Object class, and how value objects can be transformed into Shape objects and then added to the stage at the specified x/y coordinates.

The example creates the value objects `firstInitObj` and `secondInitObj`. The custom class `Circle` accepts the value object and loops over it while setting its matching internal properties to those defined in the value object.

Copy

    package {
        import flash.display.Sprite;

        public class ObjectExample extends Sprite {
            public function ObjectExample() {
                var firstInitObj:Object = new Object();
                firstInitObj.bgColor = 0xFF0000;
                firstInitObj.radius = 25;
                firstInitObj.xCenter = 25;
                firstInitObj.yCenter = 25;

                var firstCircle:Circle = new Circle(firstInitObj);
                addChild(firstCircle);
                firstCircle.x = 50;
                firstCircle.y = 50;

                var secondInitObj:Object = {bgColor:0xCCCCCC, radius:50, xCenter:50, yCenter:50};

                var secondCircle:Circle = new Circle(secondInitObj);
                addChild(secondCircle);
                secondCircle.x = 100;
                secondCircle.y = 100;
            }

        }
    }

    import flash.display.Shape;

    class Circle extends Shape {
        public var bgColor:Number = 0xFFFFFF;
        public var radius:Number = 0;
        public var xCenter:Number = 0;
        public var yCenter:Number = 0;

        public function Circle(initObj:Object) {
            for(var i:String in initObj) {
                this[i] = initObj[i];
            }
            draw();
        }

        public function draw():void {
            graphics.beginFill(bgColor);
            graphics.drawCircle(xCenter, yCenter, radius);
            graphics.endFill();
        }
    }

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00