Invoking new DisplayObject throws an ArgumentError exception. For more information, see the "Display Programming" chapter of the ActionScript 3. Determines whether or not the children of the object are mouse, or user input device, enabled. If an object is enabled, a user can interact with it by using a mouse or user input device. The default is true. This property is useful when you create a button with an instance of the Sprite class instead of using the SimpleButton class. When you use a Sprite instance to create a button, you can choose to decorate the button by using the addChild method to add additional Sprite instances.
This process can cause unexpected behavior with mouse events because the Sprite instances you add as children can become the target object of a mouse event when you expect the parent instance to be the target object.
To ensure that the parent instance serves as the target objects for mouse events, you can set the mouseChildren property of the parent instance to false. No event is dispatched by setting this property. You must use the addEventListener method to create interactive functionality. Determines whether the children of the object are tab enabled. Enables or disables tabbing for the children of the object. Note: Do not use the tabChildren property with Flex.
Instead, use the mx. The child is added to the front top of all other children in this DisplayObjectContainer instance. To add a child to a specific index position, use the addChildAt method. If you add a child object that already has a different display object container as a parent, the object is removed from the child list of the other display object container.
Note: The command stage. There is only one Stage within a Flash runtime instance, no matter how many SWF files you load into the runtime. So, generally, objects should not be added to the Stage, directly, at all. The only object the Stage should contain is the root object. Create a DisplayObjectContainer to contain all of the items on the display list.
Then, if necessary, add that DisplayObjectContainer instance to the Stage. The child is added at the index position specified. An index of 0 represents the back bottom of the display list for this DisplayObjectContainer object. For example, the following example shows three display objects, labeled a, b, and c, at index positions 0, 2, and 1, respectively:.
If you specify a currently occupied index position, the child object that exists at that position and all higher positions are moved up one position in the child list. Indicates whether the security restrictions would cause any display objects to be omitted from the list returned by calling the DisplayObjectContainer. By default, content from one domain cannot access objects from another domain unless they are permitted to do so with a call to the Security.
The point parameter is in the coordinate space of the Stage, which may differ from the coordinate space of the display object container unless the display object container is the Stage. You can use the globalToLocal and the localToGlobal methods to convert points between these coordinate spaces.
Parameters point : Point — The point under which to look. Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance itself. The search includes the entire display list including this DisplayObjectContainer instance.
Grandchildren, great-grandchildren, and so on each return true. Parameters child : DisplayObject — The child object to test. Parameters index : int — The index position of the child object.
Returns the child display object that exists with the specified name. If more that one child display object has the specified name, the method returns the first object in the child list.
The getChildAt method accesses a child from a cached array, whereas the getChildByName method has to traverse a linked list to access a child. Parameters name : String — The name of the child to return. Returns an array of objects that lie under the specified point and are children or grandchildren, and so on of this DisplayObjectContainer instance. Any child objects that are inaccessible for security reasons are omitted from the returned array.
To determine whether this security restriction affects the returned array, call the areInaccessibleObjectsUnderPoint method.
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance. The parent property of the removed child is set to null , and the object is garbage collected if no other references to the child exist.
The index positions of any display objects above the child in the DisplayObjectContainer are decreased by 1. The garbage collector reallocates unused memory space. When a variable or object is no longer actively referenced or stored somewhere, the garbage collector sweeps through and wipes out the memory space it used to occupy if no other references to it exist.
Removes a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer.
Parameters index : int — The child index of the DisplayObject to remove. Removes all child DisplayObject instances from the child list of the DisplayObjectContainer instance. The parent property of the removed children is set to null , and the objects are garbage collected if no other references to the children exist. A value smaller than 0 throws a RangeError. Changes the position of an existing child in the display object container. This affects the layering of child objects.
For example, the following example shows three display objects, labeled a, b, and c, at index positions 0, 1, and 2, respectively:. When you use the setChildIndex method and specify an index position that is already occupied, the only positions that change are those in between the display object's former and new position. All others will stay the same. For example, if the display object container in the previous example is named container , you can swap the position of the display objects labeled a and b by calling the following code:.
Parameters child : DisplayObject — The child DisplayObject instance for which you want to change the index number. Recursively stops the timeline execution of all MovieClips rooted at this object. Child display objects belonging to a sandbox to which the excuting code does not have access are ignored. Swaps the z-order front-to-back order of the two specified child objects. All other child objects in the display object container remain in the same index positions.
Parameters child1 : DisplayObject — The first child object. Swaps the z-order front-to-back order of the child objects at the two specified index positions in the child list. Parameters index1 : int — The index position of the first child object. Filters: Retrieving Data from Server Retrieving Data from Server Classes x. Package flash. The display list manages all objects displayed in the Flash runtimes. Use the DisplayObjectContainer class to arrange the display objects in the display list.
Each DisplayObjectContainer object has its own child list for organizing the z-order of the objects. The z-order is the front-to-back order that determines which object is drawn in front, which is behind, and so on. The DisplayObjectContainer class is an abstract base class for all objects that can contain child objects.
It cannot be instantiated directly; calling the new DisplayObjectContainer constructor throws an ArgumentError exception. View the examples More examples Adding display objects to the display list Traversing the display list. Display programming Basics of display programming Core display classes Advantages of the display list approach Improved depth management Off-list display objects Working with display objects Working with display object containers Loading display content dynamically.
Public Properties. Hide Inherited Public Properties. Show Inherited Public Properties. The current accessibility implementation AccessibilityImplementation for this InteractiveObject instance. The current accessibility options for this display object.
Indicates the alpha transparency value of the object specified. A value from the BlendMode class that specifies which blend mode to use. If set to true, Flash runtimes cache an internal bitmap representation of the display object.
If non-null, this Matrix object defines how a display object is rendered when cacheAsBitmap is set to true. A reference to the class object or constructor function for a given object instance. An indexed array that contains each filter object currently associated with the display object.
The calling display object is masked by the specified mask object. Obtains the meta data object of the DisplayObject instance if meta data was stored alongside the the instance of this DisplayObject in the SWF file through a PlaceObject4 tag. Specifies whether this object receives mouse, or other user input, messages. Add a comment. Active Oldest Votes.
Improve this answer. Solution i found BaseCanvas - canvas with fixed height and width EditCanvas - dynamic canvas which params depends on it's children position. Snapshot takes from EditCanvas. Adrian Adrian 5 5 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook.
Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Specifies whether the display object is opaque with a certain background color. A transparent bitmap contains alpha channel data and is drawn transparently. An opaque bitmap has no alpha channel and renders faster than a transparent bitmap. If the bitmap is opaque, you specify its own background color to use.
If set to a number value, the surface is opaque not transparent with the RGB background color that the number specifies. If set to null the default value , the display object has a transparent background. The opaqueBackground property is intended mainly for use with the cacheAsBitmap property, for rendering optimization. For display objects in which the cacheAsBitmap property is set to true, setting opaqueBackground can improve rendering performance.
The opaque background region is not matched when calling the hitTestPoint method with the shapeFlag parameter set to true. Indicates the DisplayObjectContainer object that contains this display object. Use the parent property to specify a relative path to display objects that are above the current display object in the display list hierarchy. You can use parent to move up multiple levels in the display list as in the following:.
For a display object in a loaded SWF file, the root property is the top-most display object in the portion of the display list's tree structure represented by that SWF file. For a Bitmap object representing a loaded image file, the root property is the Bitmap object itself.
For the instance of the main class of the first SWF file loaded, the root property is the display object itself. The root property of the Stage object is the Stage object itself. The root property is set to null for any display object that has not been added to the display list, unless it has been added to a display object container that is off the display list but that is a child of the top-most display object in a loaded SWF file.
For example, if you create a new Sprite object by calling the Sprite constructor method, its root property is null until you add it to the display list or to a display object container that is off the display list but that is a child of the top-most display object in a SWF file. For a loaded SWF file, even though the Loader object used to load the file may not be on the display list, the top-most display object in the SWF file has its root property set to itself.
The Loader object does not have its root property set until it is added as a child of a display object for which the root property is set. Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. Values from 0 to represent clockwise rotation; values from 0 to represent counterclockwise rotation. Values outside this range are added to or subtracted from to obtain a value within the range.
The current scaling grid that is in effect. If set to null , the entire display object is scaled normally when any scale transformation is applied. When you define the scale9Grid property, the display object is divided into a grid with nine regions based on the scale9Grid rectangle, which defines the center region of the grid. The eight other regions of the grid are the following areas:. You can think of the eight regions outside of the center defined by the rectangle as being like a picture frame that has special rules applied to it when scaled.
When the scale9Grid property is set and a display object is scaled, all text and gradients are scaled normally; however, for other types of objects the following rules apply:. If a display object is rotated, all subsequent scaling is normal and the scale9Grid property is ignored. For example, consider the following display object and a rectangle that is applied as the display object's scale9Grid :. When the display object is scaled or stretched, the objects within the rectangle scale normally, but the objects outside of the rectangle scale according to the scale9Grid rules:.
A common use for setting scale9Grid is to set up a display object to be used as a component, in which edge regions retain the same width when the component is scaled. Indicates the horizontal scale percentage of the object as applied from the registration point.
The default registration point is 0,0. Scaling the local coordinate system changes the x and y property values, which are defined in whole pixels. Indicates the vertical scale percentage of an object as applied from the registration point of the object. The scroll rectangle bounds of the display object. The display object is cropped to the size defined by the rectangle, and it scrolls within the rectangle when you change the x and y properties of the scrollRect object. The properties of the scrollRect Rectangle object use the display object's coordinate space and are scaled just like the overall display object.
The corner bounds of the cropped window on the scrolling display object are the origin of the display object 0,0 and the point defined by the width and height of the rectangle. They are not centered around the origin, but use the origin to define the upper-left corner of the area.
A scrolled display object always scrolls in whole pixel increments. You can scroll an object left and right by setting the x property of the scrollRect Rectangle object.
You can scroll an object up and down by setting the y property of the scrollRect Rectangle object. Note that changes to the scrollRect property are only processed when the object is rendered. Thus methods like localToGlobal may not produce the expected result if called immediately after modifying scrollRect. Note: Starting with Flash Player The Stage of the display object. A Flash runtime application has only one Stage object.
For example, you can create and load multiple display objects into the display list, and the stage property of each display object refers to the same Stage object even if the display object belongs to a loaded SWF file.
If a display object is not added to the display list, its stage property is set to null. An object with properties pertaining to a display object's matrix, color transform, and pixel bounds. The specific properties — matrix, colorTransform, and three read-only properties concatenatedMatrix , concatenatedColorTransform , and pixelBounds — are described in the entry for the Transform class.
Each of the transform object's properties is itself an object. This concept is important because the only way to set new values for the matrix or colorTransform objects is to create a new object and copy that object into the transform. For example, to increase the tx value of a display object's matrix, you must make a copy of the entire matrix object, then copy the new object into the matrix property of the transform object:.
You cannot directly set the tx property. The following code has no effect on myDisplayObject :. You can also copy an entire transform object and assign it to another display object's transform property. The resulting display object, myNewDisplayObj , now has the same values for its matrix, color transform, and pixel bounds as the old display object, myOldDisplayObj.
Whether or not the display object is visible. Display objects that are not visible are disabled. Indicates the width of the display object, in pixels. The width is calculated based on the bounds of the content of the display object. Indicates the x coordinate of the DisplayObject instance relative to the local coordinates of the parent DisplayObjectContainer. If the object is inside a DisplayObjectContainer that has transformations, it is in the local coordinate system of the enclosing DisplayObjectContainer.
The object's coordinates refer to the registration point position. Indicates the y coordinate of the DisplayObject instance relative to the local coordinates of the parent DisplayObjectContainer. Returns a rectangle that defines the area of the display object relative to the coordinate system of the targetCoordinateSpace object.
The getBounds method is similar to the getRect method; however, the Rectangle returned by the getBounds method includes any strokes on shapes, whereas the Rectangle returned by the getRect method does not.
For an example, see the description of the getRect method. Parameters targetCoordinateSpace : DisplayObject — The display object that defines the coordinate system to use. Returns a rectangle that defines the boundary of the display object, based on the coordinate system defined by the targetCoordinateSpace parameter, excluding any strokes on shapes. The values that the getRect method returns are the same or smaller than those returned by the getBounds method.
Note: Use localToGlobal and globalToLocal methods to convert the display object's local coordinates to Stage coordinates, or Stage coordinates to local coordinates, respectively. Converts the point object from the Stage global coordinates to the display object's local coordinates. To use this method, first create an instance of the Point class. The x and y values that you assign represent global coordinates because they relate to the origin 0,0 of the main display area.
Then pass the Point instance as the parameter to the globalToLocal method. The method returns a new Point object with x and y values that relate to the origin of the display object instead of the origin of the Stage. Parameters point : Point — An object created with the Point class.
The Point object specifies the x and y coordinates as properties. Evaluates the bounding box of the display object to see if it overlaps or intersects with the bounding box of the obj display object. Parameters obj : DisplayObject — The display object to test against. Evaluates the display object to see if it overlaps or intersects with the point specified by the x and y parameters. The x and y parameters specify a point in the coordinate space of the Stage, not the display object container that contains the display object unless that display object container is the Stage.
Parameters x : Number — The x coordinate to test against this object. Converts the point object from the display object's local coordinates to the Stage global coordinates. This method allows you to convert any given x and y coordinates from values that are relative to the origin 0,0 of a specific display object local coordinates to values that are relative to the origin of the Stage global coordinates.
The x and y values that you assign represent local coordinates because they relate to the origin of the display object. You then pass the Point instance that you created as the parameter to the localToGlobal method. The method returns a new Point object with x and y values that relate to the origin of the Stage instead of the origin of the display object.
Parameters point : Point — The name or identifier of a point created with the Point class, specifying the x and y coordinates as properties. Parameters x : Number — The new x-position for this object. Sets the actual size of this object. This method is mainly for use in implementing the updateDisplayList method, which is where you compute this object's actual size based on its explicit size, parent-relative percent size, and measured size. You then apply this actual size to the object by calling setActualSize.
0コメント