PageRenderTime 34ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/jangaroo/lsystem/joo/classes/flash/display/DisplayObject.js

https://github.com/mohlendo/mohlendo.github.com
JavaScript | 2064 lines | 422 code | 87 blank | 1555 comment | 46 complexity | e8f9696c579c05c894074fb7742ba86e MD5 | raw file
  1. joo.classLoader.prepare("package flash.display",/* {
  2. import flash.accessibility.AccessibilityProperties;
  3. import flash.events.Event;
  4. import flash.events.EventDispatcher;
  5. import flash.events.KeyboardEvent;
  6. import flash.events.MouseEvent;
  7. import flash.geom.Point;
  8. import flash.geom.Rectangle;
  9. import flash.geom.Transform;
  10. import flash.geom.Vector3D;
  11. import js.Event;
  12. import js.HTMLElement;
  13. import js.Style;*/
  14. /**
  15. * Dispatched when a display object is added to the display list. The following methods trigger this event: <code>DisplayObjectContainer.addChild()</code>, <code>DisplayObjectContainer.addChildAt()</code>.
  16. * @eventType flash.events.Event.ADDED
  17. */
  18. {Event:{name:"added", type:"flash.events.Event"}},
  19. /**
  20. * Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained. The following methods trigger this event: <code>DisplayObjectContainer.addChild()</code>, <code>DisplayObjectContainer.addChildAt()</code>.
  21. * @eventType flash.events.Event.ADDED_TO_STAGE
  22. */
  23. {Event:{name:"addedToStage", type:"flash.events.Event"}},
  24. /**
  25. * [broadcast event] Dispatched when the playhead is entering a new frame. If the playhead is not moving, or if there is only one frame, this event is dispatched continuously in conjunction with the frame rate. This event is a broadcast event, which means that it is dispatched by all display objects with a listener registered for this event.
  26. * @eventType flash.events.Event.ENTER_FRAME
  27. */
  28. {Event:{name:"enterFrame", type:"flash.events.Event"}},
  29. /**
  30. * [broadcast event] Dispatched when the playhead is exiting the current frame. All frame scripts have been run. If the playhead is not moving, or if there is only one frame, this event is dispatched continuously in conjunction with the frame rate. This event is a broadcast event, which means that it is dispatched by all display objects with a listener registered for this event.
  31. * @eventType flash.events.Event.EXIT_FRAME
  32. */
  33. {Event:{name:"exitFrame", type:"flash.events.Event"}},
  34. /**
  35. * [broadcast event] Dispatched after the constructors of frame display objects have run but before frame scripts have run. If the playhead is not moving, or if there is only one frame, this event is dispatched continuously in conjunction with the frame rate. This event is a broadcast event, which means that it is dispatched by all display objects with a listener registered for this event.
  36. * @eventType flash.events.Event.FRAME_CONSTRUCTED
  37. */
  38. {Event:{name:"frameConstructed", type:"flash.events.Event"}},
  39. /**
  40. * Dispatched when a display object is about to be removed from the display list. Two methods of the DisplayObjectContainer class generate this event: <code>removeChild()</code> and <code>removeChildAt()</code>.
  41. * <p>The following methods of a DisplayObjectContainer object also generate this event if an object must be removed to make room for the new object: <code>addChild()</code>, <code>addChildAt()</code>, and <code>setChildIndex()</code>.</p>
  42. * @eventType flash.events.Event.REMOVED
  43. */
  44. {Event:{name:"removed", type:"flash.events.Event"}},
  45. /**
  46. * Dispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained. Two methods of the DisplayObjectContainer class generate this event: <code>removeChild()</code> and <code>removeChildAt()</code>.
  47. * <p>The following methods of a DisplayObjectContainer object also generate this event if an object must be removed to make room for the new object: <code>addChild()</code>, <code>addChildAt()</code>, and <code>setChildIndex()</code>.</p>
  48. * @eventType flash.events.Event.REMOVED_FROM_STAGE
  49. */
  50. {Event:{name:"removedFromStage", type:"flash.events.Event"}},
  51. /**
  52. * [broadcast event] Dispatched when the display list is about to be updated and rendered. This event provides the last opportunity for objects listening for this event to make changes before the display list is rendered. You must call the <code>invalidate()</code> method of the Stage object each time you want a <code>render</code> event to be dispatched. <code>Render</code> events are dispatched to an object only if there is mutual trust between it and the object that called <code>Stage.invalidate()</code>. This event is a broadcast event, which means that it is dispatched by all display objects with a listener registered for this event.
  53. * <p><b>Note:</b> This event is not dispatched if the display is not rendering. This is the case when the content is either minimized or obscured.</p>
  54. * @eventType flash.events.Event.RENDER
  55. */
  56. {Event:{name:"render", type:"flash.events.Event"}},
  57. /**
  58. * The DisplayObject class is the base class for all objects that can be placed on the display list. The display list manages all objects displayed in the Flash runtimes. Use the DisplayObjectContainer class to arrange the display objects in the display list. DisplayObjectContainer objects can have child display objects, while other display objects, such as Shape and TextField objects, are "leaf" nodes that have only parents and siblings, no children.
  59. * <p>The DisplayObject class supports basic functionality like the <i>x</i> and <i>y</i> position of an object, as well as more advanced properties of the object such as its transformation matrix.</p>
  60. * <p>DisplayObject is an abstract base class; therefore, you cannot call DisplayObject directly. Invoking <code>new DisplayObject()</code> throws an <code>ArgumentError</code> exception.</p>
  61. * <p>All display objects inherit from the DisplayObject class.</p>
  62. * <p>The DisplayObject class itself does not include any APIs for rendering content onscreen. For that reason, if you want create a custom subclass of the DisplayObject class, you will want to extend one of its subclasses that do have APIs for rendering content onscreen, such as the Shape, Sprite, Bitmap, SimpleButton, TextField, or MovieClip class.</p>
  63. * <p>The DisplayObject class contains several broadcast events. Normally, the target of any particular event is a specific DisplayObject instance. For example, the target of an <code>added</code> event is the specific DisplayObject instance that was added to the display list. Having a single target restricts the placement of event listeners to that target and in some cases the target's ancestors on the display list. With broadcast events, however, the target is not a specific DisplayObject instance, but rather all DisplayObject instances, including those that are not on the display list. This means that you can add a listener to any DisplayObject instance to listen for broadcast events. In addition to the broadcast events listed in the DisplayObject class's Events table, the DisplayObject class also inherits two broadcast events from the EventDispatcher class: <code>activate</code> and <code>deactivate</code>.</p>
  64. * <p>Some properties previously used in the ActionScript 1.0 and 2.0 MovieClip, TextField, and Button classes (such as <code>_alpha</code>, <code>_height</code>, <code>_name</code>, <code>_width</code>, <code>_x</code>, <code>_y</code>, and others) have equivalents in the ActionScript 3.0 DisplayObject class that are renamed so that they no longer begin with the underscore (_) character.</p>
  65. * <p>For more information, see the "Display Programming" chapter of the <i>ActionScript 3.0 Developer's Guide</i>.</p>
  66. * <p><a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#includeExamplesSummary">View the examples</a></p>
  67. * @see DisplayObjectContainer
  68. * @see http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3c.html Core display classes
  69. * @see http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3d.html Working with display objects
  70. * @see http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7dcb.html Geometry example: Applying a matrix transformation to a display object
  71. *
  72. */
  73. "public class DisplayObject extends flash.events.EventDispatcher implements flash.display.IBitmapDrawable",2,function($$private){var $$bound=joo.boundMethod,trace=joo.trace;return[function(){joo.classLoader.init(flash.events.KeyboardEvent,flash.display.BlendMode,flash.events.MouseEvent,flash.events.Event);},
  74. /**
  75. * The current accessibility options for this display object. If you modify the <code>accessibilityProperties</code> property or any of the fields within <code>accessibilityProperties</code>, you must call the <code>Accessibility.updateProperties()</code> method to make your changes take effect.
  76. * <p><b>Note</b>: For an object created in the Flash authoring environment, the value of <code>accessibilityProperties</code> is prepopulated with any information you entered in the Accessibility panel for that object.</p>
  77. * @see flash.accessibility.Accessibility#updateProperties()
  78. * @see flash.accessibility.AccessibilityProperties
  79. *
  80. * @example The following example shows how the to attach a simple AccessibilityProperties object to a TextField instance:
  81. * <listing>
  82. * import flash.text.TextField;
  83. * import flash.accessibility.AccessibilityProperties;
  84. * import flash.accessibility.Accessibility;
  85. * import flash.system.Capabilities;
  86. *
  87. * var tf:TextField = new TextField();
  88. * tf.text = "hello";
  89. *
  90. * var accessProps:AccessibilityProperties = new AccessibilityProperties();
  91. * accessProps.name = "Greeting";
  92. *
  93. * tf.accessibilityProperties = accessProps;
  94. *
  95. * if (Capabilities.hasAccessibility) {
  96. * Accessibility.updateProperties();
  97. * }
  98. *
  99. * trace(tf.accessibilityProperties.name); // Greeting
  100. * </listing>
  101. */
  102. "public function get accessibilityProperties",function accessibilityProperties$get()/*:AccessibilityProperties*/ {
  103. throw new Error('not implemented'); // TODO: implement!
  104. },
  105. /**
  106. * @private
  107. */
  108. "public function set accessibilityProperties",function accessibilityProperties$set(value/*:AccessibilityProperties*/)/*:void*/ {
  109. throw new Error('not implemented'); // TODO: implement!
  110. },
  111. /**
  112. * Indicates the alpha transparency value of the object specified. Valid values are 0 (fully transparent) to 1 (fully opaque). The default value is 1. Display objects with <code>alpha</code> set to 0 <i>are</i> active, even though they are invisible.
  113. * @example The following code sets the <code>alpha</code> property of a sprite to 50% when the mouse rolls over the sprite:
  114. * <listing>
  115. * import flash.display.Sprite;
  116. * import flash.events.MouseEvent;
  117. *
  118. * var circle:Sprite = new Sprite();
  119. * circle.graphics.beginFill(0xFF0000);
  120. * circle.graphics.drawCircle(40, 40, 40);
  121. * addChild(circle);
  122. *
  123. * circle.addEventListener(MouseEvent.MOUSE_OVER, dimObject);
  124. * circle.addEventListener(MouseEvent.MOUSE_OUT, restoreObject);
  125. *
  126. * function dimObject(event:MouseEvent):void {
  127. * event.target.alpha = 0.5;
  128. * }
  129. *
  130. * function restoreObject(event:MouseEvent):void {
  131. * event.target.alpha = 1.0;
  132. * }
  133. * </listing>
  134. */
  135. "public function get alpha",function alpha$get()/*:Number*/ {
  136. return this._alpha$2;
  137. },
  138. /**
  139. * @private
  140. */
  141. "public function set alpha",function alpha$set(value/*:Number*/)/*:void*/ {
  142. this._alpha$2 = value;
  143. this.getElement().style.opacity = String(value);
  144. },
  145. /**
  146. * A value from the BlendMode class that specifies which blend mode to use. A bitmap can be drawn internally in two ways. If you have a blend mode enabled or an external clipping mask, the bitmap is drawn by adding a bitmap-filled square shape to the vector render. If you attempt to set this property to an invalid value, Flash runtimes set the value to <code>BlendMode.NORMAL</code>.
  147. * <p>The <code>blendMode</code> property affects each pixel of the display object. Each pixel is composed of three constituent colors (red, green, and blue), and each constituent color has a value between 0x00 and 0xFF. Flash Player or Adobe AIR compares each constituent color of one pixel in the movie clip with the corresponding color of the pixel in the background. For example, if <code>blendMode</code> is set to <code>BlendMode.LIGHTEN</code>, Flash Player or Adobe AIR compares the red value of the display object with the red value of the background, and uses the lighter of the two as the value for the red component of the displayed color.</p>
  148. * <p>The following table describes the <code>blendMode</code> settings. The BlendMode class defines string values you can use. The illustrations in the table show <code>blendMode</code> values applied to a circular display object (2) superimposed on another display object (1).</p>
  149. * <p><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-0a.jpg" /> <img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-0b.jpg" /></p>
  150. * <table>
  151. * <tr><th>BlendMode Constant</th><th>Illustration</th><th>Description</th></tr>
  152. * <tr>
  153. * <td><code>BlendMode.NORMAL</code></td>
  154. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-1.jpg" /></td>
  155. * <td>The display object appears in front of the background. Pixel values of the display object override those of the background. Where the display object is transparent, the background is visible.</td></tr>
  156. * <tr>
  157. * <td><code>BlendMode.LAYER</code></td>
  158. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-2.jpg" /></td>
  159. * <td>Forces the creation of a transparency group for the display object. This means that the display object is pre-composed in a temporary buffer before it is processed further. This is done automatically if the display object is pre-cached using bitmap caching or if the display object is a display object container with at least one child object with a <code>blendMode</code> setting other than <code>BlendMode.NORMAL</code>. Not supported under GPU rendering.</td></tr>
  160. * <tr>
  161. * <td><code>BlendMode.MULTIPLY</code></td>
  162. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-3.jpg" /></td>
  163. * <td>Multiplies the values of the display object constituent colors by the colors of the background color, and then normalizes by dividing by 0xFF, resulting in darker colors. This setting is commonly used for shadows and depth effects.
  164. * <p>For example, if a constituent color (such as red) of one pixel in the display object and the corresponding color of the pixel in the background both have the value 0x88, the multiplied result is 0x4840. Dividing by 0xFF yields a value of 0x48 for that constituent color, which is a darker shade than the color of the display object or the color of the background.</p></td></tr>
  165. * <tr>
  166. * <td><code>BlendMode.SCREEN</code></td>
  167. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-4.jpg" /></td>
  168. * <td>Multiplies the complement (inverse) of the display object color by the complement of the background color, resulting in a bleaching effect. This setting is commonly used for highlights or to remove black areas of the display object.</td></tr>
  169. * <tr>
  170. * <td><code>BlendMode.LIGHTEN</code></td>
  171. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-5.jpg" /></td>
  172. * <td>Selects the lighter of the constituent colors of the display object and the color of the background (the colors with the larger values). This setting is commonly used for superimposing type.
  173. * <p>For example, if the display object has a pixel with an RGB value of 0xFFCC33, and the background pixel has an RGB value of 0xDDF800, the resulting RGB value for the displayed pixel is 0xFFF833 (because 0xFF > 0xDD, 0xCC < 0xF8, and 0x33 > 0x00 = 33). Not supported under GPU rendering.</p></td></tr>
  174. * <tr>
  175. * <td><code>BlendMode.DARKEN</code></td>
  176. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-6.jpg" /></td>
  177. * <td>Selects the darker of the constituent colors of the display object and the colors of the background (the colors with the smaller values). This setting is commonly used for superimposing type.
  178. * <p>For example, if the display object has a pixel with an RGB value of 0xFFCC33, and the background pixel has an RGB value of 0xDDF800, the resulting RGB value for the displayed pixel is 0xDDCC00 (because 0xFF > 0xDD, 0xCC < 0xF8, and 0x33 > 0x00 = 33). Not supported under GPU rendering.</p></td></tr>
  179. * <tr>
  180. * <td><code>BlendMode.DIFFERENCE</code></td>
  181. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-7.jpg" /></td>
  182. * <td>Compares the constituent colors of the display object with the colors of its background, and subtracts the darker of the values of the two constituent colors from the lighter value. This setting is commonly used for more vibrant colors.
  183. * <p>For example, if the display object has a pixel with an RGB value of 0xFFCC33, and the background pixel has an RGB value of 0xDDF800, the resulting RGB value for the displayed pixel is 0x222C33 (because 0xFF - 0xDD = 0x22, 0xF8 - 0xCC = 0x2C, and 0x33 - 0x00 = 0x33).</p></td></tr>
  184. * <tr>
  185. * <td><code>BlendMode.ADD</code></td>
  186. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-8.jpg" /></td>
  187. * <td>Adds the values of the constituent colors of the display object to the colors of its background, applying a ceiling of 0xFF. This setting is commonly used for animating a lightening dissolve between two objects.
  188. * <p>For example, if the display object has a pixel with an RGB value of 0xAAA633, and the background pixel has an RGB value of 0xDD2200, the resulting RGB value for the displayed pixel is 0xFFC833 (because 0xAA + 0xDD > 0xFF, 0xA6 + 0x22 = 0xC8, and 0x33 + 0x00 = 0x33).</p></td></tr>
  189. * <tr>
  190. * <td><code>BlendMode.SUBTRACT</code></td>
  191. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-9.jpg" /></td>
  192. * <td>Subtracts the values of the constituent colors in the display object from the values of the background color, applying a floor of 0. This setting is commonly used for animating a darkening dissolve between two objects.
  193. * <p>For example, if the display object has a pixel with an RGB value of 0xAA2233, and the background pixel has an RGB value of 0xDDA600, the resulting RGB value for the displayed pixel is 0x338400 (because 0xDD - 0xAA = 0x33, 0xA6 - 0x22 = 0x84, and 0x00 - 0x33 < 0x00).</p></td></tr>
  194. * <tr>
  195. * <td><code>BlendMode.INVERT</code></td>
  196. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-10.jpg" /></td>
  197. * <td>Inverts the background.</td></tr>
  198. * <tr>
  199. * <td><code>BlendMode.ALPHA</code></td>
  200. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-11.jpg" /></td>
  201. * <td>Applies the alpha value of each pixel of the display object to the background. This requires the <code>blendMode</code> setting of the parent display object to be set to <code>BlendMode.LAYER</code>. For example, in the illustration, the parent display object, which is a white background, has <code>blendMode = BlendMode.LAYER</code>. Not supported under GPU rendering.</td></tr>
  202. * <tr>
  203. * <td><code>BlendMode.ERASE</code></td>
  204. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-12.jpg" /></td>
  205. * <td>Erases the background based on the alpha value of the display object. This requires the <code>blendMode</code> of the parent display object to be set to <code>BlendMode.LAYER</code>. For example, in the illustration, the parent display object, which is a white background, has <code>blendMode = BlendMode.LAYER</code>. Not supported under GPU rendering.</td></tr>
  206. * <tr>
  207. * <td><code>BlendMode.OVERLAY</code></td>
  208. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-13.jpg" /></td>
  209. * <td>Adjusts the color of each pixel based on the darkness of the background. If the background is lighter than 50% gray, the display object and background colors are screened, which results in a lighter color. If the background is darker than 50% gray, the colors are multiplied, which results in a darker color. This setting is commonly used for shading effects. Not supported under GPU rendering.</td></tr>
  210. * <tr>
  211. * <td><code>BlendMode.HARDLIGHT</code></td>
  212. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/blendMode-14.jpg" /></td>
  213. * <td>Adjusts the color of each pixel based on the darkness of the display object. If the display object is lighter than 50% gray, the display object and background colors are screened, which results in a lighter color. If the display object is darker than 50% gray, the colors are multiplied, which results in a darker color. This setting is commonly used for shading effects. Not supported under GPU rendering.</td></tr>
  214. * <tr>
  215. * <td><code>BlendMode.SHADER</code></td>
  216. * <td>N/A</td>
  217. * <td>Adjusts the color using a custom shader routine. The shader that is used is specified as the Shader instance assigned to the <code>blendShader</code> property. Setting the <code>blendShader</code> property of a display object to a Shader instance automatically sets the display object's <code>blendMode</code> property to <code>BlendMode.SHADER</code>. If the <code>blendMode</code> property is set to <code>BlendMode.SHADER</code> without first setting the <code>blendShader</code> property, the <code>blendMode</code> property is set to <code>BlendMode.NORMAL</code>. Not supported under GPU rendering.</td></tr></table>
  218. * @see BlendMode
  219. * @see #blendShader
  220. *
  221. * @example The following code creates two sprite objects, a square and a circle, and sets the blend mode of the circle (in the foreground) to <code>BlendMode.SUBTRACT</code> when the pointer rolls over the circle:
  222. * <listing>
  223. * import flash.display.Sprite;
  224. * import flash.display.BlendMode;
  225. * import flash.events.MouseEvent;
  226. *
  227. * var square:Sprite = new Sprite();
  228. * square.graphics.beginFill(0xFF88CC);
  229. * square.graphics.drawRect(0, 0, 80, 80);
  230. * addChild(square);
  231. *
  232. * var circle:Sprite = new Sprite();
  233. * circle.graphics.beginFill(0xAA0022);
  234. * circle.graphics.drawCircle(40, 40, 40);
  235. * addChild(circle);
  236. *
  237. * circle.addEventListener(MouseEvent.MOUSE_OVER, dimObject);
  238. * circle.addEventListener(MouseEvent.MOUSE_OUT, restoreObject);
  239. *
  240. * function dimObject(event:MouseEvent):void {
  241. * event.target.blendMode = BlendMode.SUBTRACT;
  242. * }
  243. *
  244. * function restoreObject(event:MouseEvent):void {
  245. * event.target.blendMode = BlendMode.NORMAL;
  246. * }
  247. * </listing>
  248. */
  249. "public function get blendMode",function blendMode$get()/*:String*/ {
  250. return this._blendMode$2;
  251. },
  252. /**
  253. * @private
  254. */
  255. "public function set blendMode",function blendMode$set(value/*:String*/)/*:void*/ {
  256. this._blendMode$2 = value;
  257. },
  258. /**
  259. * Sets a shader that is used for blending the foreground and background. When the <code>blendMode</code> property is set to <code>BlendMode.SHADER</code>, the specified Shader is used to create the blend mode output for the display object.
  260. * <p>Setting the <code>blendShader</code> property of a display object to a Shader instance automatically sets the display object's <code>blendMode</code> property to <code>BlendMode.SHADER</code>. If the <code>blendShader</code> property is set (which sets the <code>blendMode</code> property to <code>BlendMode.SHADER</code>), then the value of the <code>blendMode</code> property is changed, the blend mode can be reset to use the blend shader simply by setting the <code>blendMode</code> property to <code>BlendMode.SHADER</code>. The <code>blendShader</code> property does not need to be set again except to change the shader that's used for the blend mode.</p>
  261. * <p>The Shader assigned to the <code>blendShader</code> property must specify at least two <code>image4</code> inputs. The inputs <b>do not</b> need to be specified in code using the associated ShaderInput objects' <code>input</code> properties. The background display object is automatically used as the first input (the input with <code>index</code> 0). The foreground display object is used as the second input (the input with <code>index</code> 1). A shader used as a blend shader can specify more than two inputs. In that case any additional input must be specified by setting its ShaderInput instance's <code>input</code> property.</p>
  262. * <p>When you assign a Shader instance to this property the shader is copied internally. The blend operation uses that internal copy, not a reference to the original shader. Any changes made to the shader, such as changing a parameter value, input, or bytecode, are not applied to the copied shader that's used for the blend mode.</p>
  263. * @throws ArgumentError When the shader output type is not compatible with this operation (the shader must specify a <code>pixel4</code> output).
  264. * @throws ArgumentError When the shader specifies fewer than two image inputs or the first two inputs are not an <code>image4</code> inputs.
  265. * @throws ArgumentError When the shader specifies an image input that isn't provided.
  266. * @throws ArgumentError When a ByteArray or Vector.<Number> instance is used as an input and the <code>width</code> and <code>height</code> properties aren't specified for the ShaderInput, or the specified values don't match the amount of data in the input object. See the <code>ShaderInput.input</code> property for more information.
  267. *
  268. * @see BlendMode
  269. * @see Shader
  270. * @see ShaderInput
  271. *
  272. */
  273. "public function set blendShader",function blendShader$set(value/*:Shader*/)/*:void*/ {
  274. throw new Error('not implemented'); // TODO: implement!
  275. },
  276. /**
  277. * If set to <code>true</code>, Flash runtimes cache an internal bitmap representation of the display object. This caching can increase performance for display objects that contain complex vector content.
  278. * <p>All vector data for a display object that has a cached bitmap is drawn to the bitmap instead of the main display. If <code>cacheAsBitmapMatrix</code> is null or unsupported, the bitmap is then copied to the main display as unstretched, unrotated pixels snapped to the nearest pixel boundaries. Pixels are mapped 1 to 1 with the parent object. If the bounds of the bitmap change, the bitmap is recreated instead of being stretched.</p>
  279. * <p>If <code>cacheAsBitmapMatrix</code> is non-null and supported, the object is drawn to the off-screen bitmap using that matrix and the stretched and/or rotated results of that rendering are used to draw the object to the main display.</p>
  280. * <p>No internal bitmap is created unless the <code>cacheAsBitmap</code> property is set to <code>true</code>.</p>
  281. * <p>After you set the <code>cacheAsBitmap</code> property to <code>true</code>, the rendering does not change, however the display object performs pixel snapping automatically. The animation speed can be significantly faster depending on the complexity of the vector content.</p>
  282. * <p>The <code>cacheAsBitmap</code> property is automatically set to <code>true</code> whenever you apply a filter to a display object (when its <code>filter</code> array is not empty), and if a display object has a filter applied to it, <code>cacheAsBitmap</code> is reported as <code>true</code> for that display object, even if you set the property to <code>false</code>. If you clear all filters for a display object, the <code>cacheAsBitmap</code> setting changes to what it was last set to.</p>
  283. * <p>A display object does not use a bitmap even if the <code>cacheAsBitmap</code> property is set to <code>true</code> and instead renders from vector data in the following cases:</p>
  284. * <ul>
  285. * <li>The bitmap is too large. In AIR 1.5 and Flash Player 10, the maximum size for a bitmap image is 8,191 pixels in width or height, and the total number of pixels cannot exceed 16,777,215 pixels. (So, if a bitmap image is 8,191 pixels wide, it can only be 2,048 pixels high.) In Flash Player 9 and earlier, the limitation is is 2880 pixels in height and 2,880 pixels in width.</li>
  286. * <li>The bitmap fails to allocate (out of memory error).</li></ul>
  287. * <p>The <code>cacheAsBitmap</code> property is best used with movie clips that have mostly static content and that do not scale and rotate frequently. With such movie clips, <code>cacheAsBitmap</code> can lead to performance increases when the movie clip is translated (when its <i>x</i> and <i>y</i> position is changed).</p>
  288. * @see #cacheAsBitmapMatrix
  289. * @see #opaqueBackground
  290. *
  291. * @example The following example applies a drop shadow to a Shape instance. It then traces the value of the <code>cacheAsBitmap</code> property, which is set to <code>true</code> when the filter is applied:
  292. * <listing>
  293. * import flash.display.Sprite;
  294. * import flash.filters.DropShadowFilter
  295. *
  296. * var circle:Sprite = new Sprite();
  297. * circle.graphics.beginFill(0xAA0022);
  298. * circle.graphics.drawCircle(40, 40, 40);
  299. *
  300. * addChild(circle);
  301. *
  302. * trace(circle.cacheAsBitmap); // false
  303. *
  304. * var filter:DropShadowFilter = new DropShadowFilter();
  305. * circle.filters = [filter];
  306. *
  307. * trace(circle.cacheAsBitmap); // true
  308. * </listing>
  309. */
  310. "public function get cacheAsBitmap",function cacheAsBitmap$get()/*:Boolean*/ {
  311. return this._cacheAsBitmap$2;
  312. },
  313. /**
  314. * @private
  315. */
  316. "public function set cacheAsBitmap",function cacheAsBitmap$set(value/*:Boolean*/)/*:void*/ {
  317. this._cacheAsBitmap$2 = value; // TODO: implement!
  318. },
  319. /**
  320. * An indexed array that contains each filter object currently associated with the display object. The flash.filters package contains several classes that define specific filters you can use.
  321. * <p>Filters can be applied in Flash Professional at design time, or at run time by using ActionScript code. To apply a filter by using ActionScript, you must make a temporary copy of the entire <code>filters</code> array, modify the temporary array, then assign the value of the temporary array back to the <code>filters</code> array. You cannot directly add a new filter object to the <code>filters</code> array.</p>
  322. * <p>To add a filter by using ActionScript, perform the following steps (assume that the target display object is named <code>myDisplayObject</code>):</p><ol>
  323. * <li>Create a new filter object by using the constructor method of your chosen filter class.</li>
  324. * <li>Assign the value of the <code>myDisplayObject.filters</code> array to a temporary array, such as one named <code>myFilters</code>.</li>
  325. * <li>Add the new filter object to the <code>myFilters</code> temporary array.</li>
  326. * <li>Assign the value of the temporary array to the <code>myDisplayObject.filters</code> array.</li></ol>
  327. * <p>If the <code>filters</code> array is undefined, you do not need to use a temporary array. Instead, you can directly assign an array literal that contains one or more filter objects that you create. The first example in the Examples section adds a drop shadow filter by using code that handles both defined and undefined <code>filters</code> arrays.</p>
  328. * <p>To modify an existing filter object, you must use the technique of modifying a copy of the <code>filters</code> array:</p><ol>
  329. * <li>Assign the value of the <code>filters</code> array to a temporary array, such as one named <code>myFilters</code>.</li>
  330. * <li>Modify the property by using the temporary array, <code>myFilters</code>. For example, to set the quality property of the first filter in the array, you could use the following code: <code>myFilters[0].quality = 1;</code></li>
  331. * <li>Assign the value of the temporary array to the <code>filters</code> array.</li></ol>
  332. * <p>At load time, if a display object has an associated filter, it is marked to cache itself as a transparent bitmap. From this point forward, as long as the display object has a valid filter list, the player caches the display object as a bitmap. This source bitmap is used as a source image for the filter effects. Each display object usually has two bitmaps: one with the original unfiltered source display object and another for the final image after filtering. The final image is used when rendering. As long as the display object does not change, the final image does not need updating.</p>
  333. * <p>The flash.filters package includes classes for filters. For example, to create a DropShadow filter, you would write:</p>
  334. * <listing>
  335. * import flash.filters.DropShadowFilter
  336. * var myFilter:DropShadowFilter = new DropShadowFilter (distance, angle, color, alpha, blurX, blurY, quality, inner, knockout)
  337. * </listing>
  338. * <p>You can use the <code>is</code> operator to determine the type of filter assigned to each index position in the <code>filter</code> array. For example, the following code shows how to determine the position of the first filter in the <code>filters</code> array that is a DropShadowFilter:</p>
  339. * <listing>
  340. * import flash.text.TextField;
  341. * import flash.filters.*;
  342. * var tf:TextField = new TextField();
  343. * var filter1:DropShadowFilter = new DropShadowFilter();
  344. * var filter2:GradientGlowFilter = new GradientGlowFilter();
  345. * tf.filters = [filter1, filter2];
  346. *
  347. * tf.text = "DropShadow index: " + filterPosition(tf, DropShadowFilter).toString(); // 0
  348. * addChild(tf)
  349. *
  350. * function filterPosition(displayObject:DisplayObject, filterClass:Class):int {
  351. * for (var i:uint = 0; i < displayObject.filters.length; i++) {
  352. * if (displayObject.filters[i] is filterClass) {
  353. * return i;
  354. * }
  355. * }
  356. * return -1;
  357. * }
  358. * </listing>
  359. * <p><b>Note:</b> Since you cannot directly add a new filter object to the <code>DisplayObject.filters</code> array, the following code has no effect on the target display object, named <code>myDisplayObject</code>:</p>
  360. * <listing>
  361. * myDisplayObject.filters.push(myDropShadow);
  362. * </listing>
  363. * @throws ArgumentError When <code>filters</code> includes a ShaderFilter and the shader output type is not compatible with this operation (the shader must specify a <code>pixel4</code> output).
  364. * @throws ArgumentError When <code>filters</code> includes a ShaderFilter and the shader doesn't specify any image input or the first input is not an <code>image4</code> inputs.
  365. * @throws ArgumentError When <code>filters</code> includes a ShaderFilter and the shader specifies an image input that isn't provided.
  366. * @throws ArgumentError When <code>filters</code> includes a ShaderFilter, a ByteArray or Vector.<Number> instance as a shader input, and the <code>width</code> and <code>height</code> properties aren't specified for the ShaderInput object, or the specified values don't match the amount of data in the input data. See the <code>ShaderInput.input</code> property for more information.
  367. *
  368. * @see flash.filters
  369. * @see ShaderInput#input
  370. *
  371. */
  372. "public function get filters",function filters$get()/*:Array*/ {
  373. return this._filters$2.concat();
  374. },
  375. /**
  376. * @private
  377. */
  378. "public function set filters",function filters$set(value/*:Array*/)/*:void*/ {
  379. this._filters$2 = value.concat();
  380. if (value.length > 0) {
  381. // see documentation of "cacheAsBitmap": "automatically set to true when filter is set"
  382. this._cacheAsBitmap$2 = true;
  383. }
  384. // TODO: update visual appearance!
  385. },
  386. /**
  387. * Indicates the height of the display object, in pixels. The height is calculated based on the bounds of the content of the display object. When you set the <code>height</code> property, the <code>scaleY</code> property is adjusted accordingly, as shown in the following code:
  388. * <listing>
  389. * var rect:Shape = new Shape();
  390. * rect.graphics.beginFill(0xFF0000);
  391. * rect.graphics.drawRect(0, 0, 100, 100);
  392. * trace(rect.scaleY) // 1;
  393. * rect.height = 200;
  394. * trace(rect.scaleY) // 2;</listing>
  395. * <p>Except for TextField and Video objects, a display object with no content (such as an empty sprite) has a height of 0, even if you try to set <code>height</code> to a different value.</p>
  396. * @example The following code creates two TextField objects and adjusts the <code>height</code> property of each based on the <code>textHeight</code> property of each; it also positions the second text field by setting its <code>y</code> property:
  397. * <listing>
  398. * import flash.text.TextField;
  399. *
  400. * var tf1:TextField = new TextField();
  401. * tf1.text = "Text Field 1";
  402. * tf1.border = true;
  403. * tf1.wordWrap = true;
  404. * tf1.width = 40;
  405. * tf1.height = tf1.textHeight + 5;
  406. * addChild(tf1);
  407. *
  408. * var tf2:TextField = new TextField();
  409. * tf2.text = "Text Field 2";
  410. * tf2.border = true;
  411. * tf2.wordWrap = true;
  412. * tf2.width = 40;
  413. * tf2.height = tf2.textHeight + 5;
  414. * tf2.y = tf1.y + tf1.height + 5;
  415. * addChild(tf2);
  416. * </listing>
  417. */
  418. "public function get height",function height$get()/*:Number*/ {
  419. return this._height * this._scaleY$2;
  420. },
  421. /**
  422. * @private
  423. */
  424. "public function set height",function height$set(value/*:Number*/)/*:void*/ {
  425. var style/*:Style*/ = this.getElement().style;
  426. var oldHeight/*:Number*/ = this.height;
  427. if (!isNaN(value)) {
  428. if (style.paddingTop) {
  429. value -= $$private.styleLengthToNumber(style.paddingTop);
  430. }
  431. if (style.paddingBottom) {
  432. value -= $$private.styleLengthToNumber(style.paddingBottom);
  433. }
  434. }
  435. style.height = $$private.numberToStyleLength(value);
  436. if (oldHeight && value) {
  437. this._scaleY$2 = value / oldHeight;
  438. }
  439. },
  440. /**
  441. * Returns a LoaderInfo object containing information about loading the file to which this display object belongs. The <code>loaderInfo</code> property is defined only for the root display object of a SWF file or for a loaded Bitmap (not for a Bitmap that is drawn with ActionScript). To find the <code>loaderInfo</code> object associated with the SWF file that contains a display object named <code>myDisplayObject</code>, use <code>myDisplayObject.root.loaderInfo</code>.
  442. * <p>A large SWF file can monitor its download by calling <code>this.root.loaderInfo.addEventListener(Event.COMPLETE, func)</code>.</p>
  443. * @see LoaderInfo
  444. *
  445. * @example The following code assumes that <code>this</code> refers to a display object. The code outputs the URL of the root SWF file for the display object:
  446. * <listing>
  447. * trace (this.loaderInfo.url);
  448. *
  449. * </listing>
  450. */
  451. "public native function get loaderInfo"/*():LoaderInfo*/,
  452. /**
  453. * The calling display object is masked by the specified <code>mask</code> object. To ensure that masking works when the Stage is scaled, the <code>mask</code> display object must be in an active part of the display list. The <code>mask</code> object itself is not drawn. Set <code>mask</code> to <code>null</code> to remove the mask.
  454. * <p>To be able to scale a mask object, it must be on the display list. To be able to drag a mask Sprite object (by calling its <code>startDrag()</code> method), it must be on the display list. To call the <code>startDrag()</code> method for a mask sprite based on a <code>mouseDown</code> event being dispatched by the sprite, set the sprite's <code>buttonMode</code> property to <code>true</code>.</p>
  455. * <p>When display objects are cached by setting the <code>cacheAsBitmap</code> property to <code>true</code> an the <code>cacheAsBitmapMatrix</code> property to a Matrix object, both the mask and the display object being masked must be part of the same cached bitmap. Thus, if the display object is cached, then the mask must be a child of the display object. If an ancester of the display object on the display list is cached, then the mask must be a child of that ancestor or one of its descendents. If more than one ancestor of the masked object is cached, then the mask must be a descendent of the cached container closest to the masked object in the display list.</p>
  456. * <p><b>Note:</b> A single <code>mask</code> object cannot be used to mask more than one calling display object. When the <code>mask</code> is assigned to a second display object, it is removed as the mask of the first object, and that object's <code>mask</code> property becomes <code>null</code>.</p>
  457. * @example The following code creates a TextField object as well as a Sprite object that is set as a mask for the TextField object. When the user clicks the text field, the <code>drag()</code> event listener function calls the <code>startDrag()</code> method of the mask Sprite object:
  458. * <listing>
  459. * import flash.text.TextField;
  460. * import flash.display.Sprite;
  461. * import flash.events.MouseEvent;
  462. *
  463. * var tf:TextField = new TextField();
  464. * tf.text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
  465. * + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "
  466. * tf.selectable = false;
  467. * tf.wordWrap = true;
  468. * tf.width = 150;
  469. * addChild(tf);
  470. *
  471. * var square:Sprite = new Sprite();
  472. * square.graphics.beginFill(0xFF0000);
  473. * square.graphics.drawRect(0, 0, 40, 40);
  474. * addChild(square);
  475. *
  476. * tf.mask = square;
  477. *
  478. * tf.addEventListener(MouseEvent.MOUSE_DOWN, drag);
  479. * tf.addEventListener(MouseEvent.MOUSE_UP, noDrag);
  480. *
  481. * function drag(event:MouseEvent):void {
  482. * square.startDrag();
  483. * }
  484. * function noDrag(event:MouseEvent):void {
  485. * square.stopDrag();
  486. * }
  487. * </listing>
  488. */
  489. "public function get mask",function mask$get()/*:DisplayObject*/ {
  490. throw new Error('not implemented'); // TODO: implement!
  491. },
  492. /**
  493. * @private
  494. */
  495. "public function set mask",function mask$set(value/*:DisplayObject*/)/*:void*/ {
  496. throw new Error('not implemented'); // TODO: implement!
  497. },
  498. /**
  499. * Indicates the x coordinate of the mouse or user input device position, in pixels.
  500. * <p><b>Note</b>: For a DisplayObject that has been rotated, the returned x coordinate will reflect the non-rotated object.</p>
  501. * @example The following code creates a Sprite object and traces the <code>mouseX</code> and <code>mouseY</code> positions when the user clicks the sprite:
  502. * <listing>
  503. * import flash.display.Sprite;
  504. * import flash.events.MouseEvent;
  505. *
  506. * var square:Sprite = new Sprite();
  507. * square.graphics.beginFill(0xFF0000);
  508. * square.graphics.drawRect(0, 0, 200, 200);
  509. * addChild(square);
  510. *
  511. * square.addEventListener(MouseEvent.CLICK, traceCoordinates);
  512. *
  513. * function traceCoordinates(event:MouseEvent):void {
  514. * trace(square.mouseX, square.mouseY);
  515. * }
  516. * </listing>
  517. */
  518. "public function get mouseX",function mouseX$get()/*:Number*/ {
  519. return this.stage ? this.stage.mouseX / this._scaleX$2 : NaN;
  520. },
  521. /**
  522. * Indicates the y coordinate of the mouse or user input device position, in pixels.
  523. * <p><b>Note</b>: For a DisplayObject that has been rotated, the returned y coordinate will reflect the non-rotated object.</p>
  524. * @example The following code creates a Sprite object and traces the <code>mouseX</code> and <code>mouseY</code> positions when the user clicks the sprite:
  525. * <listing>
  526. * import flash.display.Sprite;
  527. * import flash.events.MouseEvent;
  528. *
  529. * var square:Sprite = new Sprite();
  530. * square.graphics.beginFill(0xFF0000);
  531. * square.graphics.drawRect(0, 0, 200, 200);
  532. * addChild(square);
  533. *
  534. * square.addEventListener(MouseEvent.CLICK, traceCoordinates);
  535. *
  536. * function traceCoordinates(event:MouseEvent):void {
  537. * trace(square.mouseX, square.mouseY);
  538. * }
  539. * </listing>
  540. */
  541. "public function get mouseY",function mouseY$get()/*:Number*/ {
  542. return this.stage ? this.stage.mouseY / this._scaleY$2 : NaN;
  543. },
  544. /**
  545. * Indicates the instance name of the DisplayObject. The object can be identified in the child list of its parent display object container by calling the <code>getChildByName()</code> method of the display object container.
  546. * @throws flash.errors.IllegalOperationError If you are attempting to set this property on an object that was placed on the timeline in the Flash authoring tool.
  547. *
  548. * @example The following code creates two Sprite object and traces the associated <code>name</code> property when the user clicks either of the objects:
  549. * <listing>
  550. * import flash.display.Sprite;
  551. * import flash.events.MouseEvent;
  552. *
  553. * var circle1:Sprite = new Sprite();
  554. * circle1.graphics.beginFill(0xFF0000);
  555. * circle1.graphics.drawCircle(40, 40, 40);
  556. * circle1.name = "circle1";
  557. * addChild(circle1);
  558. * circle1.addEventListener(MouseEvent.CLICK, traceName);
  559. *
  560. * var circle2:Sprite = new Sprite();
  561. * circle2.graphics.beginFill(0x0000FF);
  562. * circle2.graphics.drawCircle(140, 40, 40);
  563. * circle2.name = "circle2";
  564. * addChild(circle2);
  565. * circle2.addEventListener(MouseEvent.CLICK, traceName);
  566. *
  567. * function traceName(event:MouseEvent):void {
  568. * trace(event.target.name);
  569. * }
  570. * </listing>
  571. */
  572. "public native function get name"/*():String*/,
  573. /**
  574. * @private
  575. */
  576. "public native function set name"/*(value:String):void*/,
  577. /**
  578. * 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.
  579. * <p>If set to a number value, the surface is opaque (not transparent) with the RGB background color that the number specifies. If set to <code>null</code> (the default value), the display object has a transparent background.</p>
  580. * <p>The <code>opaqueBackground</code> property is intended mainly for use with the <code>cacheAsBitmap</code> property, for rendering optimization. For display objects in which the <code>cacheAsBitmap</code> property is set to true, setting <code>opaqueBackground</code> can improve rendering performance.</p>
  581. * <p>The opaque background region is <i>not</i> matched when calling the <code>hitTestPoint()</code> method with the <code>shapeFlag</code> parameter set to <code>true</code>.</p>
  582. * <p>The opaque background region does not respond to mouse events.</p>
  583. * @see #cacheAsBitmap
  584. * @see #hitTestPoint()
  585. *
  586. * @example The following code creates a Shape object with a blue circle and sets its <code>opaqueBackground</code> property to red (0xFF0000):
  587. * <listing>
  588. * import flash.display.Shape;
  589. *
  590. * var circle:Shape = new Shape();
  591. * circle.graphics.beginFill(0x0000FF);
  592. * circle.graphics.drawCircle(40, 40, 40);
  593. * circle.opaqueBackground = 0xFF0000;
  594. * addChild(circle);
  595. * </listing>
  596. */
  597. "public function get opaqueBackground",function opaqueBackground$get()/*:Object*/ {
  598. throw new Error('not implemented'); // TODO: implement!
  599. },
  600. /**
  601. * @private
  602. */
  603. "public function set opaqueBackground",function opaqueBackground$set(value/*:Object*/)/*:void*/ {
  604. throw new Error('not implemented'); // TODO: implement!
  605. },
  606. /**
  607. * Indicates the DisplayObjectContainer object that contains this display object. Use the <code>parent</code> property to specify a relative path to display objects that are above the current display object in the display list hierarchy.
  608. * <p>You can use <code>parent</code> to move up multiple levels in the display list as in the following:</p>
  609. * <listing>
  610. * this.parent.parent.alpha = 20;
  611. * </listing>
  612. * @throws SecurityError The parent display object belongs to a security sandbox to which you do not have access. You can avoid this situation by having the parent movie call the <code>Security.allowDomain()</code> method.
  613. *
  614. * @example The following code creates three Sprite objects and shows how the <code>parent</code> property reflects the display list hierarchy:
  615. * <listing>
  616. * import flash.display.Sprite;
  617. *
  618. * var sprite1:Sprite = new Sprite();
  619. * sprite1.name = "sprite1";
  620. * var sprite2:Sprite = new Sprite();
  621. * sprite2.name = "sprite2";
  622. * var sprite3:Sprite = new Sprite();
  623. * sprite3.name = "sprite3";
  624. *
  625. * sprite1.addChild(sprite2);
  626. * sprite2.addChild(sprite3);
  627. *
  628. * trace(sprite2.parent.name); // sprite1
  629. * trace(sprite3.parent.name); // sprite2
  630. * trace(sprite3.parent.parent.name); // sprite1
  631. * </listing>
  632. */
  633. "public native function get parent"/*():DisplayObjectContainer*/,
  634. /**
  635. * For a display object in a loaded SWF file, the <code>root</code> 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 <code>root</code> property is the Bitmap object itself. For the instance of the main class of the first SWF file loaded, the <code>root</code> property is the display object itself. The <code>root</code> property of the Stage object is the Stage object itself. The <code>root</code> property is set to <code>null</code> 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.
  636. * <p>For example, if you create a new Sprite object by calling the <code>Sprite()</code> constructor method, its <code>root</code> property is <code>null</code> 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).</p>
  637. * <p>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 <code>root</code> property set to itself. The Loader object does not have its <code>root</code> property set until it is added as a child of a display object for which the <code>root</code> property is set.</p>
  638. * @example The following code shows the difference between the <code>root</code> property for the Stage object, for a display object (a Loader object) that is not loaded (both before and after it has been added to the display list), and for a loaded object (a loaded Bitmap object):
  639. * <listing>
  640. * import flash.display.Loader;
  641. * import flash.net.URLRequest;
  642. * import flash.events.Event;
  643. *
  644. * trace(stage.root); // [object Stage]
  645. *
  646. * var ldr:Loader = new Loader();
  647. * trace (ldr.root); // null
  648. *
  649. * addChild(ldr);
  650. * trace (ldr.root); // [object ...]
  651. *
  652. * var urlReq:URLRequest = new URLRequest("example.jpg");
  653. * ldr.load(urlReq);
  654. *
  655. * ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
  656. *
  657. * function loaded(event:Event):void {
  658. * trace(ldr.content.root); // [object Bitmap]
  659. * }
  660. * </listing>
  661. */
  662. "public function get root",function root$get()/*:DisplayObject*/ {
  663. var root/*:DisplayObject*/ = this;
  664. while (root.parent) {
  665. root = root.parent;
  666. }
  667. return root;
  668. },
  669. /**
  670. * Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement <code>my_video.rotation = 450</code> is the same as <code>my_video.rotation = 90</code>.
  671. * @example The following code creates a Sprite object and rotates the object when the user clicks it:
  672. * <listing>
  673. * import flash.display.Sprite;
  674. * import flash.events.MouseEvent;
  675. *
  676. * var square:Sprite = new Sprite();
  677. * square.graphics.beginFill(0xFFCC00);
  678. * square.graphics.drawRect(-50, -50, 100, 100);
  679. * square.x = 150;
  680. * square.y = 150;
  681. * addChild(square);
  682. *
  683. * square.addEventListener(MouseEvent.CLICK, rotate);
  684. *
  685. * function rotate(event:MouseEvent):void {
  686. * square.rotation += 15;
  687. * }
  688. * </listing>
  689. */
  690. "public function get rotation",function rotation$get()/*:Number*/ {
  691. return this._rotation$2;
  692. },
  693. /**
  694. * @private
  695. */
  696. "public function set rotation",function rotation$set(value/*:Number*/)/*:void*/ {
  697. if (!value) {
  698. value = 0;
  699. }
  700. if (value !== this._rotation$2) {
  701. this._rotation$2 = value;
  702. var style/*:Style*/ = this.getElement().style;
  703. $$private.setProprietaryStyle(style, 'transform', "rotate(" + this.rotation + "deg)");
  704. $$private.setProprietaryStyle(style, 'transform-origin', "0pt 0pt");
  705. }
  706. },
  707. "private static const",{ BROWSER_PREFIXES/*:Object*/ :function(){return( { '-moz-': 1, '-webkit-': 1, '-o': 1, '-ms-': 1 });}},
  708. "private static function setProprietaryStyle",function setProprietaryStyle(style/*:Style*/, property/*:String*/, value/*:String*/)/*:void*/ {
  709. for (var browserPrefix/*:String*/ in $$private.BROWSER_PREFIXES) {
  710. try {
  711. style['setProperty'](browserPrefix + property, value, "");
  712. } catch(e/*:**/) {
  713. // ignore
  714. }
  715. }
  716. },
  717. "protected function get vertical",function vertical$get()/*:Boolean*/ {
  718. return this._rotation$2 === 90 || this._rotation$2 === 270;
  719. },
  720. /**
  721. * Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from 360 to obtain a value within the range.
  722. * @example In this example, two ellipses rotate using their <code>rotationX</code> and <code>rotationY</code> properties. The first ellipse's registration point is set to its center. It rotates around itself. The second ellipse rotates around an external point.
  723. * <listing>
  724. * package {
  725. * import flash.display.MovieClip;
  726. * import flash.display.Shape;
  727. * import flash.geom.*;
  728. * import flash.display.Graphics;
  729. * import flash.events.TimerEvent;
  730. * import flash.utils.Timer;
  731. *
  732. * public class RotationExample1 extends MovieClip {
  733. * private var ellipse:Shape = new Shape();
  734. * private var speed:int = 10;
  735. * private var ellipse1:Shape;
  736. * private var ellipse2:Shape;
  737. *
  738. * public function RotationExample1():void {
  739. *
  740. * ellipse1 = drawEllipse(-50, -40, (this.stage.stageWidth / 2),
  741. * (this.stage.stageHeight / 2));
  742. *
  743. * ellipse2 = drawEllipse(30, 40, (this.stage.stageWidth / 2),
  744. * (this.stage.stageHeight / 2));
  745. *
  746. * this.addChild(ellipse1);
  747. * this.addChild(ellipse2);
  748. *
  749. * var t:Timer = new Timer(50);
  750. * t.addEventListener(TimerEvent.TIMER, timerHandler);
  751. * t.start();
  752. * }
  753. *
  754. * private function drawEllipse(x1, y1, x2, y2):Shape {
  755. *
  756. * var e:Shape = new Shape();
  757. * e.graphics.beginFill(0xFF0000);
  758. * e.graphics.lineStyle(2);
  759. * e.graphics.drawEllipse(x1, y1, 100, 80);
  760. * e.graphics.endFill();
  761. *
  762. * e.x = x2;
  763. * e.y = y2;
  764. * e.z = 1;
  765. * return e;
  766. * }
  767. *
  768. * private function timerHandler(event:TimerEvent):void {
  769. * ellipse1.rotationY += speed;
  770. * ellipse1.rotationX -= speed;
  771. *
  772. * ellipse2.rotationY += speed;
  773. * ellipse2.rotationX -= speed;
  774. * }
  775. * }
  776. * }
  777. * </listing>
  778. * <div>The following example shows how you can 3D rotate a Sprite object around its x-axis with Flash Professional, ActionScript 3.0, and Flash Player 10 by setting the object's rotationX property. Example provided by <a href="http://actionscriptexamples.com/2009/02/26/rotating-a-sprite-object-around-its-x-axis-in-flash-using-actionscript-30-and-flash-player-10/">ActionScriptExamples.com</a>.
  779. * <listing>
  780. * //Requires:
  781. * // - Slider control UI component in Flash library.
  782. * // - Publish for Flash Player 10.
  783. * //
  784. *
  785. * [SWF(width="400", height="300")]
  786. *
  787. * import fl.controls.Slider;
  788. * import fl.controls.SliderDirection;
  789. * import fl.events.SliderEvent;
  790. *
  791. * var slider:Slider = new Slider();
  792. * slider.direction = SliderDirection.HORIZONTAL;
  793. * slider.minimum = 0;
  794. * slider.maximum = 360;
  795. * slider.value = 45;
  796. * slider.tickInterval = 45;
  797. * slider.snapInterval = 1;
  798. * slider.liveDragging = true;
  799. * slider.addEventListener(SliderEvent.CHANGE, slider_change);
  800. * slider.move(10, 10);
  801. * addChild(slider);
  802. *
  803. * var spr:Sprite = new Sprite();
  804. * spr.graphics.lineStyle(2, 0xFF0000);
  805. * spr.graphics.drawRect(0, 0, 100, 80);
  806. * spr.x = Math.round((stage.stageWidth - spr.width)/2);
  807. * spr.y = Math.round((stage.stageHeight - spr.height)/2);
  808. * spr.rotationX = 45;
  809. * addChild(spr);
  810. *
  811. * function slider_change(evt:SliderEvent):void {
  812. * spr.rotationX = evt.value;
  813. * }
  814. * </listing></div>
  815. */
  816. "public function get rotationX",function rotationX$get()/*:Number*/ {
  817. throw new Error('not implemented'); // TODO: implement!
  818. },
  819. /**
  820. * @private
  821. */
  822. "public function set rotationX",function rotationX$set(value/*:Number*/)/*:void*/ {
  823. throw new Error('not implemented'); // TODO: implement!
  824. },
  825. /**
  826. * Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from 360 to obtain a value within the range.
  827. * @example In this example, two ellipses rotate using their <code>rotationX</code> and <code>rotationY</code> properties. The first ellipse's registration point is set to its center. It rotates around itself. The second ellipse rotates around an external point.
  828. * <listing>
  829. * package {
  830. * import flash.display.MovieClip;
  831. * import flash.display.Shape;
  832. * import flash.geom.*;
  833. * import flash.display.Graphics;
  834. * import flash.events.TimerEvent;
  835. * import flash.utils.Timer;
  836. *
  837. * public class RotationExample1 extends MovieClip {
  838. * private var ellipse:Shape = new Shape();
  839. * private var speed:int = 10;
  840. * private var ellipse1:Shape;
  841. * private var ellipse2:Shape;
  842. *
  843. * public function RotationExample1():void {
  844. *
  845. * ellipse1 = drawEllipse(-50, -40, (this.stage.stageWidth / 2),
  846. * (this.stage.stageHeight / 2));
  847. *
  848. * ellipse2 = drawEllipse(30, 40, (this.stage.stageWidth / 2),
  849. * (this.stage.stageHeight / 2));
  850. *
  851. * this.addChild(ellipse1);
  852. * this.addChild(ellipse2);
  853. *
  854. * var t:Timer = new Timer(50);
  855. * t.addEventListener(TimerEvent.TIMER, timerHandler);
  856. * t.start();
  857. * }
  858. *
  859. * private function drawEllipse(x1, y1, x2, y2):Shape {
  860. *
  861. * var e:Shape = new Shape();
  862. * e.graphics.beginFill(0xFF0000);
  863. * e.graphics.lineStyle(2);
  864. * e.graphics.drawEllipse(x1, y1, 100, 80);
  865. * e.graphics.endFill();
  866. *
  867. * e.x = x2;
  868. * e.y = y2;
  869. * e.z = 1;
  870. * return e;
  871. * }
  872. *
  873. * private function timerHandler(event:TimerEvent):void {
  874. * ellipse1.rotationY += speed;
  875. * ellipse1.rotationX -= speed;
  876. *
  877. * ellipse2.rotationY += speed;
  878. * ellipse2.rotationX -= speed;
  879. * }
  880. * }
  881. * }
  882. * </listing>
  883. */
  884. "public function get rotationY",function rotationY$get()/*:Number*/ {
  885. throw new Error('not implemented'); // TODO: implement!
  886. },
  887. /**
  888. * @private
  889. */
  890. "public function set rotationY",function rotationY$set(value/*:Number*/)/*:void*/ {
  891. throw new Error('not implemented'); // TODO: implement!
  892. },
  893. /**
  894. * Indicates the z-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from 360 to obtain a value within the range.
  895. */
  896. "public function get rotationZ",function rotationZ$get()/*:Number*/ {
  897. throw new Error('not implemented'); // TODO: implement!
  898. },
  899. /**
  900. * @private
  901. */
  902. "public function set rotationZ",function rotationZ$set(value/*:Number*/)/*:void*/ {
  903. throw new Error('not implemented'); // TODO: implement!
  904. },
  905. /**
  906. * The current scaling grid that is in effect. If set to <code>null</code>, the entire display object is scaled normally when any scale transformation is applied.
  907. * <p>When you define the <code>scale9Grid</code> property, the display object is divided into a grid with nine regions based on the <code>scale9Grid</code> rectangle, which defines the center region of the grid. The eight other regions of the grid are the following areas:</p>
  908. * <ul>
  909. * <li>The upper-left corner outside of the rectangle</li>
  910. * <li>The area above the rectangle</li>
  911. * <li>The upper-right corner outside of the rectangle</li>
  912. * <li>The area to the left of the rectangle</li>
  913. * <li>The area to the right of the rectangle</li>
  914. * <li>The lower-left corner outside of the rectangle</li>
  915. * <li>The area below the rectangle</li>
  916. * <li>The lower-right corner outside of the rectangle</li></ul>
  917. * <p>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.</p>
  918. * <p>When the <code>scale9Grid</code> 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:</p>
  919. * <ul>
  920. * <li>Content in the center region is scaled normally.</li>
  921. * <li>Content in the corners is not scaled.</li>
  922. * <li>Content in the top and bottom regions is scaled horizontally only. Content in the left and right regions is scaled vertically only.</li>
  923. * <li>All fills (including bitmaps, video, and gradients) are stretched to fit their shapes.</li></ul>
  924. * <p>If a display object is rotated, all subsequent scaling is normal (and the <code>scale9Grid</code> property is ignored).</p>
  925. * <p>For example, consider the following display object and a rectangle that is applied as the display object's <code>scale9Grid</code>:</p>
  926. * <table>
  927. * <tr>
  928. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/scale9Grid-a.jpg" />
  929. * <p>The display object.</p></td>
  930. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/scale9Grid-b.jpg" />
  931. * <p>The red rectangle shows the <code>scale9Grid</code>.</p></td></tr></table>
  932. * <p>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 <code>scale9Grid</code> rules:</p>
  933. * <table>
  934. * <tr>
  935. * <td>Scaled to 75%:</td>
  936. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/scale9Grid-c.jpg" /></td></tr>
  937. * <tr>
  938. * <td>Scaled to 50%:</td>
  939. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/scale9Grid-d.jpg" /></td></tr>
  940. * <tr>
  941. * <td>Scaled to 25%:</td>
  942. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/scale9Grid-e.jpg" /></td></tr>
  943. * <tr>
  944. * <td>Stretched horizontally 150%:</td>
  945. * <td><img src="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/scale9Grid-f.jpg" /></td></tr></table>
  946. * <p>A common use for setting <code>scale9Grid</code> 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.</p>
  947. * @throws ArgumentError If you pass an invalid argument to the method.
  948. *
  949. * @see flash.geom.Rectangle
  950. *
  951. * @example The following code creates a Shape object with a rectangle drawn in its <code>graphics</code> property. The rectangle has a 20-pixel-thick line as the border and it is filled with a gradient. The timer event calls the <code>scale()</code> function, which scales the Shape object by adjusting the <code>scaleX</code> and <code>scaleY</code> properties. The <code>scale9Grid</code> applied to the Shape object prevents the rectangle's border line from scaling — only the gradient fill scales:
  952. * <listing>
  953. * import flash.display.Shape;
  954. * import flash.display.GradientType;
  955. * import flash.display.SpreadMethod;
  956. * import flash.display.InterpolationMethod;
  957. * import flash.geom.Matrix;
  958. * import flash.geom.Rectangle;
  959. * import flash.utils.Timer;
  960. * import flash.events.TimerEvent;
  961. *
  962. * var square:Shape = new Shape();
  963. * square.graphics.lineStyle(20, 0xFFCC00);
  964. * var gradientMatrix:Matrix = new Matrix();
  965. * gradientMatrix.createGradientBox(15, 15, Math.PI, 10, 10);
  966. * square.graphics.beginGradientFill(GradientType.RADIAL,
  967. * [0xffff00, 0x0000ff],
  968. * [100, 100],
  969. * [0, 0xFF],
  970. * gradientMatrix,
  971. * SpreadMethod.REFLECT,
  972. * InterpolationMethod.RGB,
  973. * 0.9);
  974. * square.graphics.drawRect(0, 0, 100, 100);
  975. *
  976. * var grid:Rectangle = new Rectangle(20, 20, 60, 60);
  977. * square.scale9Grid = grid ;
  978. *
  979. * addChild(square);
  980. *
  981. * var tim:Timer = new Timer(100);
  982. * tim.start();
  983. * tim.addEventListener(TimerEvent.TIMER, scale);
  984. *
  985. * var scaleFactor:Number = 1.01;
  986. *
  987. * function scale(event:TimerEvent):void {
  988. * square.scaleX *= scaleFactor;
  989. * square.scaleY *= scaleFactor;
  990. *
  991. * if (square.scaleX > 2.0) {
  992. * scaleFactor = 0.99;
  993. * }
  994. * if (square.scaleX < 1.0) {
  995. * scaleFactor = 1.01;
  996. * }
  997. * }
  998. * </listing>
  999. */
  1000. "public function get scale9Grid",function scale9Grid$get()/*:Rectangle*/ {
  1001. throw new Error('not implemented'); // TODO: implement!
  1002. },
  1003. /**
  1004. * @private
  1005. */
  1006. "public function set scale9Grid",function scale9Grid$set(value/*:Rectangle*/)/*:void*/ {
  1007. throw new Error('not implemented'); // TODO: implement!
  1008. },
  1009. /**
  1010. * Indicates the horizontal scale (percentage) of the object as applied from the registration point. The default registration point is (0,0). 1.0 equals 100% scale.
  1011. * <p>Scaling the local coordinate system changes the <code>x</code> and <code>y</code> property values, which are defined in whole pixels.</p>
  1012. * @example The following code creates a Sprite object with a rectangle drawn in its <code>graphics</code> property. When the user clicks the sprite, it scales by 10%:
  1013. * <listing>
  1014. * import flash.display.Sprite;
  1015. * import flash.events.MouseEvent;
  1016. *
  1017. * var square:Sprite = new Sprite();
  1018. * square.graphics.beginFill(0xFFCC00);
  1019. * square.graphics.drawRect(0, 0, 100, 100);
  1020. * addChild(square);
  1021. *
  1022. * square.addEventListener(MouseEvent.CLICK, scale);
  1023. *
  1024. * function scale(event:MouseEvent):void {
  1025. * square.scaleX *= 1.10;
  1026. * square.scaleY *= 1.10;
  1027. * }
  1028. * </listing>
  1029. */
  1030. "public function get scaleX",function scaleX$get()/*:Number*/ {
  1031. return this._scaleX$2;
  1032. },
  1033. /**
  1034. * @private
  1035. */
  1036. "public function set scaleX",function scaleX$set(value/*:Number*/)/*:void*/ {
  1037. var width/*:Number*/ = this.width;
  1038. if (width) {
  1039. this.width = width * value / this._scaleX$2; // sets _scaleX as a side-effect
  1040. } else {
  1041. this._scaleX$2 = value;
  1042. }
  1043. },
  1044. /**
  1045. * Indicates the vertical scale (percentage) of an object as applied from the registration point of the object. The default registration point is (0,0). 1.0 is 100% scale.
  1046. * <p>Scaling the local coordinate system changes the <code>x</code> and <code>y</code> property values, which are defined in whole pixels.</p>
  1047. * @example The following code creates a Sprite object with a rectangle drawn in its <code>graphics</code> property. When the user clicks the sprite, it scales by 10%:
  1048. * <listing>
  1049. * import flash.display.Sprite;
  1050. * import flash.events.MouseEvent;
  1051. *
  1052. * var square:Sprite = new Sprite();
  1053. * square.graphics.beginFill(0xFFCC00);
  1054. * square.graphics.drawRect(0, 0, 100, 100);
  1055. * addChild(square);
  1056. *
  1057. * square.addEventListener(MouseEvent.CLICK, scale);
  1058. *
  1059. * function scale(event:MouseEvent):void {
  1060. * square.scaleX *= 1.10;
  1061. * square.scaleY *= 1.10;
  1062. * }
  1063. * </listing>
  1064. */
  1065. "public function get scaleY",function scaleY$get()/*:Number*/ {
  1066. return this._scaleY$2;
  1067. },
  1068. /**
  1069. * @private
  1070. */
  1071. "public function set scaleY",function scaleY$set(value/*:Number*/)/*:void*/ {
  1072. var height/*:Number*/ = this.height;
  1073. if (height) {
  1074. this.height = height * value / this._scaleY$2; // sets _scaleY as a side-effect
  1075. } else {
  1076. this._scaleY$2 = value;
  1077. }
  1078. },
  1079. /**
  1080. * Indicates the depth scale (percentage) of an object as applied from the registration point of the object. The default registration point is (0,0). 1.0 is 100% scale.
  1081. * <p>Scaling the local coordinate system changes the <code>x</code>, <code>y</code> and <code>z</code> property values, which are defined in whole pixels.</p>
  1082. * @see #z
  1083. *
  1084. */
  1085. "public function get scaleZ",function scaleZ$get()/*:Number*/ {
  1086. throw new Error('not implemented'); // TODO: implement!
  1087. },
  1088. /**
  1089. * @private
  1090. */
  1091. "public function set scaleZ",function scaleZ$set(value/*:Number*/)/*:void*/ {
  1092. throw new Error('not implemented'); // TODO: implement!
  1093. },
  1094. /**
  1095. * 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 <code>x</code> and <code>y</code> properties of the <code>scrollRect</code> object.
  1096. * <p>The properties of the <code>scrollRect</code> 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.</p>
  1097. * <p>You can scroll an object left and right by setting the <code>x</code> property of the <code>scrollRect</code> Rectangle object. You can scroll an object up and down by setting the <code>y</code> property of the <code>scrollRect</code> Rectangle object. If the display object is rotated 90° and you scroll it left and right, the display object actually scrolls up and down.</p>
  1098. * @see flash.geom.Rectangle
  1099. *
  1100. * @example The following example shows how the <code>scrollRect</code> property defines the scrolling area for a display object, <code>circle</code>. When you click the <code>circle</code> object, the <code>clicked()</code> event handler method adjusts the <code>y</code> property of the <code>scrollRect</code> property of the <code>circle</code> object, causing the object to scroll down:
  1101. * <listing>
  1102. * import flash.display.Sprite;
  1103. * import flash.geom.Rectangle;
  1104. * import flash.events.MouseEvent;
  1105. *
  1106. * var circle:Sprite = new Sprite();
  1107. * circle.graphics.beginFill(0xFFCC00);
  1108. * circle.graphics.drawCircle(200, 200, 200);
  1109. * circle.scrollRect = new Rectangle(0, 0, 200, 200);
  1110. * addChild(circle);
  1111. *
  1112. * circle.addEventListener(MouseEvent.CLICK, clicked);
  1113. *
  1114. * function clicked(event:MouseEvent):void {
  1115. * var rect:Rectangle = event.target.scrollRect;
  1116. * rect.y -= 5;
  1117. * event.target.scrollRect = rect;
  1118. * }
  1119. * </listing>
  1120. */
  1121. "public function get scrollRect",function scrollRect$get()/*:Rectangle*/ {
  1122. throw new Error('not implemented'); // TODO: implement!
  1123. },
  1124. /**
  1125. * @private
  1126. */
  1127. "public function set scrollRect",function scrollRect$set(value/*:Rectangle*/)/*:void*/ {
  1128. throw new Error('not implemented'); // TODO: implement!
  1129. },
  1130. /**
  1131. * 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 <code>stage</code> property of each display object refers to the same Stage object (even if the display object belongs to a loaded SWF file).
  1132. * <p>If a display object is not added to the display list, its <code>stage</code> property is set to <code>null</code>.</p>
  1133. * @example The following code creates two TextField objects and uses the <code>width</code> property of the Stage object to position the text fields:
  1134. * <listing>
  1135. * import flash.text.TextField;
  1136. *
  1137. * var tf1:TextField = new TextField();
  1138. * tf1.text = "Text Field 1";
  1139. * tf1.border = true;
  1140. * tf1.x = 10;
  1141. * addChild(tf1);
  1142. * tf1.width = tf1.stage.stageWidth / 2 - 10;
  1143. *
  1144. * var tf2:TextField = new TextField();
  1145. * tf2.text = "Text Field 2";
  1146. * tf2.border = true;
  1147. * tf2.x = tf1.x + tf1.width + 5;
  1148. * addChild(tf2);
  1149. * tf2.width = tf2.stage.stageWidth / 2 - 10;
  1150. *
  1151. * trace(stage.stageWidth);
  1152. * </listing>
  1153. */
  1154. "public function get stage",function stage$get()/*:Stage*/ {
  1155. return this.parent ? this.parent.stage : null;
  1156. },
  1157. /**
  1158. * 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 (<code>concatenatedMatrix</code>, <code>concatenatedColorTransform</code>, and <code>pixelBounds</code>) — are described in the entry for the Transform class.
  1159. * <p>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.matrix or transform.colorTransform property.</p>
  1160. * <p>For example, to increase the <code>tx</code> 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:</p>
  1161. * <pre><code> var myMatrix:Matrix = myDisplayObject.transform.matrix;
  1162. myMatrix.tx += 10;
  1163. myDisplayObject.transform.matrix = myMatrix;
  1164. </code></pre>
  1165. * <p>You cannot directly set the <code>tx</code> property. The following code has no effect on <code>myDisplayObject</code>:</p>
  1166. * <pre><code> myDisplayObject.transform.matrix.tx += 10;
  1167. </code></pre>
  1168. * <p>You can also copy an entire transform object and assign it to another display object's transform property. For example, the following code copies the entire transform object from <code>myOldDisplayObj</code> to <code>myNewDisplayObj</code>:</p><code>myNewDisplayObj.transform = myOldDisplayObj.transform;</code>
  1169. * <p>The resulting display object, <code>myNewDisplayObj</code>, now has the same values for its matrix, color transform, and pixel bounds as the old display object, <code>myOldDisplayObj</code>.</p>
  1170. * <p>Note that AIR for TV devices use hardware acceleration, if it is available, for color transforms.</p>
  1171. * @see flash.geom.Transform
  1172. * @see http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7ddb.html Using Matrix objects
  1173. *
  1174. * @example The following code sets up a <code>square</code> Sprite object. When the user clicks the sprite, the <code>transformer()</code> method adjusts the <code>colorTransform</code> and <code>matrix</code> properties of the <code>transform</code> property of the sprite:
  1175. * <listing>
  1176. * import flash.display.Sprite;
  1177. * import flash.geom.ColorTransform;
  1178. * import flash.geom.Matrix;
  1179. * import flash.geom.Transform;
  1180. * import flash.events.MouseEvent;
  1181. *
  1182. * var square:Sprite = new Sprite();
  1183. * square.graphics.lineStyle(20, 0xFF2200);
  1184. * square.graphics.beginFill(0x0000DD);
  1185. * square.graphics.drawRect(0, 0, 100, 100);
  1186. * addChild(square);
  1187. *
  1188. * var resultColorTransform:ColorTransform = new ColorTransform();
  1189. * resultColorTransform.alphaMultiplier = 0.5;
  1190. * resultColorTransform.redOffset = 155;
  1191. * resultColorTransform.greenMultiplier = 0.5;
  1192. *
  1193. * var skewMatrix:Matrix = new Matrix(1, 1, 0, 1);
  1194. *
  1195. * square.addEventListener(MouseEvent.CLICK, transformer);
  1196. *
  1197. * function transformer(event:MouseEvent):void {
  1198. * var transformation:Transform = square.transform;
  1199. * var tempMatrix:Matrix = square.transform.matrix;
  1200. * tempMatrix.concat(skewMatrix);
  1201. * square.transform.colorTransform = resultColorTransform;
  1202. *
  1203. * square.transform.matrix = tempMatrix;
  1204. * }
  1205. * </listing>
  1206. */
  1207. "public function get transform",function transform$get()/*:Transform*/ {
  1208. if (!this._transform$2)
  1209. this._transform$2 = new flash.geom.Transform(this);
  1210. return this._transform$2;
  1211. },
  1212. /**
  1213. * @private
  1214. */
  1215. "public function set transform",function transform$set(value/*:Transform*/)/*:void*/ {
  1216. this._transform$2 = value;
  1217. },
  1218. /**
  1219. * Whether or not the display object is visible. Display objects that are not visible are disabled. For example, if <code>visible=false</code> for an InteractiveObject instance, it cannot be clicked.
  1220. * @example The following code uses a Timer object to call a function that periodically changes the <code>visible</code> property of a display object, resulting in a blinking effect:
  1221. * <listing>
  1222. * import flash.text.TextField;
  1223. * import flash.utils.Timer;
  1224. * import flash.events.TimerEvent;
  1225. *
  1226. * var tf:TextField = new TextField();
  1227. * tf.text = "Hello.";
  1228. * addChild(tf);
  1229. *
  1230. * var tim:Timer = new Timer(250);
  1231. * tim.start();
  1232. * tim.addEventListener(TimerEvent.TIMER, blinker);
  1233. *
  1234. * function blinker(event:TimerEvent):void {
  1235. * tf.visible = !tf.visible;
  1236. * }
  1237. * </listing>
  1238. */
  1239. "public function get visible",function visible$get()/*:Boolean*/ {
  1240. return this._visible$2;
  1241. },
  1242. /**
  1243. * @private
  1244. */
  1245. "public function set visible",function visible$set(value/*:Boolean*/)/*:void*/ {
  1246. this._visible$2 = value;
  1247. this.getElement().style.display = this._visible$2 ? "" : "none";
  1248. },
  1249. /**
  1250. * Indicates the width of the display object, in pixels. The width is calculated based on the bounds of the content of the display object. When you set the <code>width</code> property, the <code>scaleX</code> property is adjusted accordingly, as shown in the following code:
  1251. * <listing>
  1252. * var rect:Shape = new Shape();
  1253. * rect.graphics.beginFill(0xFF0000);
  1254. * rect.graphics.drawRect(0, 0, 100, 100);
  1255. * trace(rect.scaleX) // 1;
  1256. * rect.width = 200;
  1257. * trace(rect.scaleX) // 2;</listing>
  1258. * <p>Except for TextField and Video objects, a display object with no content (such as an empty sprite) has a width of 0, even if you try to set <code>width</code> to a different value.</p>
  1259. * @example The following code sets up a <code>square</code> Sprite object. When the user clicks the sprite, the <code>widen()</code> method increases the <code>width</code> property of the sprite:
  1260. * <listing>
  1261. * import flash.display.Sprite;
  1262. * import flash.events.MouseEvent;
  1263. *
  1264. * var square:Sprite = new Sprite();
  1265. * square.graphics.beginFill(0xFF0000);
  1266. * square.graphics.drawRect(0, 0, 100, 100);
  1267. * addChild(square);
  1268. *
  1269. * square.addEventListener(MouseEvent.CLICK, widen);
  1270. *
  1271. * function widen(event:MouseEvent):void {
  1272. * square.width += 10;
  1273. * }
  1274. * </listing>
  1275. */
  1276. "public function get width",function width$get()/*:Number*/ {
  1277. return this._width * this._scaleX$2;
  1278. },
  1279. /**
  1280. * @private
  1281. */
  1282. "public function set width",function width$set(value/*:Number*/)/*:void*/ {
  1283. var style/*:Style*/ = this.getElement().style;
  1284. var oldWidth/*:Number*/ = this.width;
  1285. if (!isNaN(value)) {
  1286. if (style.paddingLeft) {
  1287. value -= $$private.styleLengthToNumber(style.paddingLeft);
  1288. }
  1289. if (style.paddingRight) {
  1290. value -= $$private.styleLengthToNumber(style.paddingRight);
  1291. }
  1292. }
  1293. style.width = $$private.numberToStyleLength(value);
  1294. if (oldWidth && value) {
  1295. this._scaleX$2 = value / oldWidth;
  1296. }
  1297. },
  1298. /**
  1299. * Indicates the <i>x</i> 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. Thus, for a DisplayObjectContainer rotated 90° counterclockwise, the DisplayObjectContainer's children inherit a coordinate system that is rotated 90° counterclockwise. The object's coordinates refer to the registration point position.
  1300. * @example The following code sets up a <code>circle</code> Sprite object. A Timer object is used to change the <code>x</code> property of the sprite every 50 milliseconds:
  1301. * <listing>
  1302. * import flash.display.Sprite;
  1303. * import flash.utils.Timer;
  1304. * import flash.events.TimerEvent;
  1305. *
  1306. * var circle:Sprite = new Sprite();
  1307. * circle.graphics.beginFill(0xFF0000);
  1308. * circle.graphics.drawCircle(100, 100, 100);
  1309. * addChild(circle);
  1310. *
  1311. * var tim:Timer = new Timer(50);
  1312. * tim.start();
  1313. * tim.addEventListener(TimerEvent.TIMER, bounce);
  1314. *
  1315. * var xInc:Number = 2;
  1316. *
  1317. * function bounce(event:TimerEvent):void {
  1318. * circle.x += xInc;
  1319. * if (circle.x > circle.width) {
  1320. * xInc = -2;
  1321. * }
  1322. * if (circle.x < 0) {
  1323. * xInc = 2;
  1324. * }
  1325. * }
  1326. * </listing>
  1327. */
  1328. "public function get x",function x$get()/*:Number*/ {
  1329. return this._x$2;
  1330. },
  1331. /**
  1332. * @private
  1333. */
  1334. "public function set x",function x$set(value/*:Number*/)/*:void*/ {
  1335. this._x$2 = value || 0;
  1336. if (this._elem$2) {
  1337. this._elem$2.style.left = this._x$2 + "px";
  1338. }
  1339. },
  1340. /**
  1341. * Indicates the <i>y</i> 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. Thus, for a DisplayObjectContainer rotated 90° counterclockwise, the DisplayObjectContainer's children inherit a coordinate system that is rotated 90° counterclockwise. The object's coordinates refer to the registration point position.
  1342. * @example The following code creates two TextField objects and adjusts the <code>height</code> property of each based on the <code>textHeight</code> property of each; it also positions the second text field by setting its <code>y</code> property:
  1343. * <listing>
  1344. * import flash.text.TextField;
  1345. *
  1346. * var tf1:TextField = new TextField();
  1347. * tf1.text = "Text Field 1";
  1348. * tf1.border = true;
  1349. * tf1.wordWrap = true;
  1350. * tf1.width = 40;
  1351. * tf1.height = tf1.textHeight + 5;
  1352. * addChild(tf1);
  1353. *
  1354. * var tf2:TextField = new TextField();
  1355. * tf2.text = "Text Field 2";
  1356. * tf2.border = true;
  1357. * tf2.wordWrap = true;
  1358. * tf2.width = 40;
  1359. * tf2.height = tf2.textHeight + 5;
  1360. * tf2.y = tf1.y + tf1.height + 5;
  1361. * addChild(tf2);
  1362. * </listing>
  1363. */
  1364. "public function get y",function y$get()/*:Number*/ {
  1365. return this._y$2;
  1366. },
  1367. /**
  1368. * @private
  1369. */
  1370. "public function set y",function y$set(value/*:Number*/)/*:void*/ {
  1371. this._y$2 = value || 0;
  1372. if (this._elem$2) {
  1373. this._elem$2.style.top = this._y$2 + "px";
  1374. }
  1375. },
  1376. /**
  1377. * Indicates the z coordinate position along the z-axis of the DisplayObject instance relative to the 3D parent container. The z property is used for 3D coordinates, not screen or pixel coordinates.
  1378. * <p>When you set a <code>z</code> property for a display object to something other than the default value of <code>0</code>, a corresponding Matrix3D object is automatically created. for adjusting a display object's position and orientation in three dimensions. When working with the z-axis, the existing behavior of x and y properties changes from screen or pixel coordinates to positions relative to the 3D parent container.</p>
  1379. * <p>For example, a child of the <code>_root</code> at position x = 100, y = 100, z = 200 is not drawn at pixel location (100,100). The child is drawn wherever the 3D projection calculation puts it. The calculation is:</p>
  1380. * <p><code>(x*cameraFocalLength/cameraRelativeZPosition, y*cameraFocalLength/cameraRelativeZPosition)</code></p>
  1381. * @see flash.geom.PerspectiveProjection
  1382. * @see flash.geom.Matrix3D
  1383. * @see #transform
  1384. *
  1385. * @example This example draws two ellipses and has them go back and forth (down and up the <code>z</code> axis) toward the vanishing point. One ellipse is set to move faster than the other.
  1386. * <listing>
  1387. * package {
  1388. * import flash.display.MovieClip;
  1389. * import flash.display.Shape;
  1390. * import flash.display.Graphics;
  1391. * import flash.events.Event;
  1392. * import flash.geom.*;
  1393. *
  1394. * public class ZAxisExample1 extends MovieClip {
  1395. * private var ellipse1Back:int = 1;
  1396. * private var ellipse2Back:int = 1;
  1397. * private var depth:int = 1000;
  1398. *
  1399. * public function ZAxisExample1():void {
  1400. *
  1401. * var ellipse1 = drawEllipse((this.stage.stageWidth / 2) - 100,
  1402. * (this.stage.stageHeight / 2), 100, 80, 10);
  1403. * var ellipse2 = drawEllipse((this.stage.stageWidth / 2) + 100,
  1404. * (this.stage.stageHeight / 2), 100, 80, 300);
  1405. *
  1406. * this.addChild(ellipse1);
  1407. * this.addChild(ellipse2);
  1408. *
  1409. * ellipse1.addEventListener(Event.ENTER_FRAME, ellipse1FrameHandler);
  1410. * ellipse2.addEventListener(Event.ENTER_FRAME, ellipse2FrameHandler);
  1411. * }
  1412. *
  1413. * private function drawEllipse(x:Number, y:Number, w:Number, h:Number, z:Number):Shape {
  1414. * var s:Shape = new Shape();
  1415. * s.z = z;
  1416. * s.graphics.beginFill(0xFF0000);
  1417. * s.graphics.lineStyle(2);
  1418. * s.graphics.drawEllipse(x, y, w, h);
  1419. * s.graphics.endFill();
  1420. * return s;
  1421. * }
  1422. *
  1423. * private function ellipse1FrameHandler(e:Event):void {
  1424. * ellipse1Back = setDepth(e, ellipse1Back);
  1425. * e.currentTarget.z += ellipse1Back * 10;
  1426. * }
  1427. *
  1428. * private function ellipse2FrameHandler(e:Event):void {
  1429. * ellipse2Back = setDepth(e, ellipse2Back);
  1430. * e.currentTarget.z += ellipse2Back * 20;
  1431. * }
  1432. *
  1433. * private function setDepth(e:Event, d:int):int {
  1434. * if(e.currentTarget.z > depth) {
  1435. * e.currentTarget.z = depth;
  1436. * d = -1;
  1437. * }else if (e.currentTarget.z < 0) {
  1438. * e.currentTarget.z = 0;
  1439. * d = 1;
  1440. * }
  1441. * return d;
  1442. * }
  1443. * }
  1444. * }
  1445. * </listing>
  1446. */
  1447. "public function get z",function z$get()/*:Number*/ {
  1448. throw new Error('not implemented'); // TODO: implement!
  1449. },
  1450. /**
  1451. * @private
  1452. */
  1453. "public function set z",function z$set(value/*:Number*/)/*:void*/ {
  1454. throw new Error('not implemented'); // TODO: implement!
  1455. },
  1456. /**
  1457. * Returns a rectangle that defines the area of the display object relative to the coordinate system of the <code>targetCoordinateSpace</code> object. Consider the following code, which shows how the rectangle returned can vary depending on the <code>targetCoordinateSpace</code> parameter that you pass to the method:
  1458. * <listing>
  1459. * var container:Sprite = new Sprite();
  1460. * container.x = 100;
  1461. * container.y = 100;
  1462. * this.addChild(container);
  1463. * var contents:Shape = new Shape();
  1464. * contents.graphics.drawCircle(0,0,100);
  1465. * container.addChild(contents);
  1466. * trace(contents.getBounds(container));
  1467. * // (x=-100, y=-100, w=200, h=200)
  1468. * trace(contents.getBounds(this));
  1469. * // (x=0, y=0, w=200, h=200)
  1470. * </listing>
  1471. * <p><b>Note:</b> Use the <code>localToGlobal()</code> and <code>globalToLocal()</code> methods to convert the display object's local coordinates to display coordinates, or display coordinates to local coordinates, respectively.</p>
  1472. * <p>The <code>getBounds()</code> method is similar to the <code>getRect()</code> method; however, the Rectangle returned by the <code>getBounds()</code> method includes any strokes on shapes, whereas the Rectangle returned by the <code>getRect()</code> method does not. For an example, see the description of the <code>getRect()</code> method.</p>
  1473. * @param targetCoordinateSpace The display object that defines the coordinate system to use.
  1474. *
  1475. * @return The rectangle that defines the area of the display object relative to the <code>targetCoordinateSpace</code> object's coordinate system.
  1476. *
  1477. * @see #getRect()
  1478. * @see #globalToLocal()
  1479. * @see #localToGlobal()
  1480. *
  1481. */
  1482. "public function getBounds",function getBounds(targetCoordinateSpace/*:DisplayObject*/)/*:Rectangle*/ {
  1483. var stageOffset/*:Point*/ = this.getStageOffset$2();
  1484. var targetStageOffset/*:Point*/ = targetCoordinateSpace.getStageOffset$2();
  1485. return new flash.geom.Rectangle(
  1486. stageOffset.x - targetStageOffset.x,
  1487. stageOffset.y - targetStageOffset.y,
  1488. this.width, this.height); // TODO: implement correctly!
  1489. },
  1490. /**
  1491. * Returns a rectangle that defines the boundary of the display object, based on the coordinate system defined by the <code>targetCoordinateSpace</code> parameter, excluding any strokes on shapes. The values that the <code>getRect()</code> method returns are the same or smaller than those returned by the <code>getBounds()</code> method.
  1492. * <p><b>Note:</b> Use <code>localToGlobal()</code> and <code>globalToLocal()</code> methods to convert the display object's local coordinates to Stage coordinates, or Stage coordinates to local coordinates, respectively.</p>
  1493. * @param targetCoordinateSpace The display object that defines the coordinate system to use.
  1494. *
  1495. * @return The rectangle that defines the area of the display object relative to the <code>targetCoordinateSpace</code> object's coordinate system.
  1496. *
  1497. * @see #getBounds()
  1498. *
  1499. * @example The following example shows how the <code>getBounds()</code> method can return a larger rectangle than the <code>getRect()</code> method does, because of the additional area taken up by strokes. In this case, the <code>triangle</code> sprite includes extra strokes because of the <code>width</code> and <code>jointStyle</code> parameters of the <code>lineStyle()</code> method. The <code>trace()</code> output (in the last two lines) shows the differences between the <code>getRect()</code> and <code>getBounds()</code> rectangles:
  1500. * <listing>
  1501. * import flash.display.CapsStyle;
  1502. * import flash.display.JointStyle;
  1503. * import flash.display.LineScaleMode;
  1504. * import flash.display.Sprite;
  1505. * import flash.geom.Rectangle;
  1506. *
  1507. * var triangle:Sprite = new Sprite();
  1508. * var color:uint = 0xFF0044;
  1509. * var width:Number = 20;
  1510. * var alpha:Number = 1.0;
  1511. * var pixelHinting:Boolean = true;
  1512. * var scaleMode:String = LineScaleMode.NORMAL;
  1513. * var caps:String = CapsStyle.SQUARE;
  1514. * var joints:String = JointStyle.MITER;
  1515. * triangle.graphics.lineStyle(width, color, alpha, pixelHinting, scaleMode, caps, joints);
  1516. *
  1517. * var triangleSide:Number = 100;
  1518. * triangle.graphics.moveTo(0, 0);
  1519. * triangle.graphics.lineTo(0, triangleSide);
  1520. * triangle.graphics.lineTo(triangleSide, triangleSide);
  1521. * triangle.graphics.lineTo(0, 0);
  1522. *
  1523. * addChild(triangle);
  1524. *
  1525. * trace(triangle.getBounds(this)); // (x=-10, y=-24.1, w=134.10000000000002, h=134.1)
  1526. * trace(triangle.getRect(this)); // (x=0, y=0, w=100, h=100)
  1527. * </listing>
  1528. */
  1529. "public function getRect",function getRect(targetCoordinateSpace/*:DisplayObject*/)/*:Rectangle*/ {
  1530. throw new Error('not implemented'); // TODO: implement!
  1531. },
  1532. /**
  1533. * Converts the <code>point</code> object from the Stage (global) coordinates to the display object's (local) coordinates.
  1534. * <p>To use this method, first create an instance of the Point class. The <i>x</i> and <i>y</i> 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 <code>globalToLocal()</code> method. The method returns a new Point object with <i>x</i> and <i>y</i> values that relate to the origin of the display object instead of the origin of the Stage.</p>
  1535. * @param point An object created with the Point class. The Point object specifies the <i>x</i> and <i>y</i> coordinates as properties.
  1536. *
  1537. * @return A Point object with coordinates relative to the display object.
  1538. *
  1539. * @see #localToGlobal()
  1540. * @see flash.geom.Point
  1541. *
  1542. * @example The following code creates a Shape object and shows the result of calling the <code>hitTestPoint()</code> method, using different points as parameters. The <code>globalToLocal()</code> method converts the point from Stage coordinates to the coordinate space of the shape:
  1543. * <listing>
  1544. * import flash.display.Shape;
  1545. * import flash.geom.Point;
  1546. *
  1547. * var circle:Shape = new Shape();
  1548. * circle.graphics.beginFill(0x0000FF);
  1549. * circle.graphics.drawCircle(40, 40, 40);
  1550. * circle.x = 10;
  1551. * addChild(circle);
  1552. *
  1553. * var point1:Point = new Point(0, 0);
  1554. * trace(circle.hitTestPoint(point1.x, point1.y, true)); // false
  1555. * trace(circle.hitTestPoint(point1.x, point1.y, false)); // false
  1556. * trace(circle.globalToLocal(point1)); // [x=-10, y=0]
  1557. *
  1558. * var point2:Point = new Point(10, 1);
  1559. * trace(circle.hitTestPoint(point2.x, point2.y, true)); // false
  1560. * trace(circle.hitTestPoint(point2.x, point2.y, false)); // true
  1561. * trace(circle.globalToLocal(point2)); // [x=0, y=1]
  1562. *
  1563. * var point3:Point = new Point(30, 20);
  1564. * trace(circle.hitTestPoint(point3.x, point3.y, true)); // true
  1565. * trace(circle.hitTestPoint(point3.x, point3.y, false)); // true
  1566. * trace(circle.globalToLocal(point3)); // [x=20, y=20]
  1567. * </listing>
  1568. */
  1569. "public function globalToLocal",function globalToLocal(point/*:Point*/)/*:Point*/ {
  1570. return point.subtract(this.getStageOffset$2());
  1571. },
  1572. /**
  1573. * Converts a two-dimensional point from the Stage (global) coordinates to a three-dimensional display object's (local) coordinates.
  1574. * <p>To use this method, first create an instance of the Point class. The x and y values that you assign to the Point object represent global coordinates because they are relative to the origin (0,0) of the main display area. Then pass the Point object to the <code>globalToLocal3D()</code> method as the <code>point</code> parameter. The method returns three-dimensional coordinates as a Vector3D object containing <code>x</code>, <code>y</code>, and <code>z</code> values that are relative to the origin of the three-dimensional display object.</p>
  1575. * @param point A two dimensional Point object representing global x and y coordinates.
  1576. *
  1577. * @return A Vector3D object with coordinates relative to the three-dimensional display object.
  1578. *
  1579. */
  1580. "public function globalToLocal3D",function globalToLocal3D(point/*:Point*/)/*:Vector3D*/ {
  1581. throw new Error('not implemented'); // TODO: implement!
  1582. },
  1583. /**
  1584. * Evaluates the bounding box of the display object to see if it overlaps or intersects with the bounding box of the <code>obj</code> display object.
  1585. * @param obj The display object to test against.
  1586. *
  1587. * @return <code>true</code> if the bounding boxes of the display objects intersect; <code>false</code> if not.
  1588. *
  1589. * @example The following code creates three Shape objects and shows the result of calling the <code>hitTestObject()</code> method. Note that although circle2 and circle3 do not overlap, their bounding boxes do. Thus, the hit test of circle2 and circle3 returns <code>true</code>.
  1590. * <listing>
  1591. * import flash.display.Shape;
  1592. *
  1593. * var circle1:Shape = new Shape();
  1594. * circle1.graphics.beginFill(0x0000FF);
  1595. * circle1.graphics.drawCircle(40, 40, 40);
  1596. * addChild(circle1);
  1597. *
  1598. * var circle2:Shape = new Shape();
  1599. * circle2.graphics.beginFill(0x00FF00);
  1600. * circle2.graphics.drawCircle(40, 40, 40);
  1601. * circle2.x = 50;
  1602. * addChild(circle2);
  1603. *
  1604. * var circle3:Shape = new Shape();
  1605. * circle3.graphics.beginFill(0xFF0000);
  1606. * circle3.graphics.drawCircle(40, 40, 40);
  1607. * circle3.x = 100;
  1608. * circle3.y = 67;
  1609. * addChild(circle3);
  1610. *
  1611. * trace(circle1.hitTestObject(circle2)); // true
  1612. * trace(circle1.hitTestObject(circle3)); // false
  1613. * trace(circle2.hitTestObject(circle3)); // true
  1614. * </listing>
  1615. */
  1616. "public function hitTestObject",function hitTestObject(obj/*:DisplayObject*/)/*:Boolean*/ {
  1617. throw new Error('not implemented'); // TODO: implement!
  1618. },
  1619. /**
  1620. * Evaluates the display object to see if it overlaps or intersects with the point specified by the <code>x</code> and <code>y</code> parameters. The <code>x</code> and <code>y</code> 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).
  1621. * @param x The <i>x</i> coordinate to test against this object.
  1622. * @param y The <i>y</i> coordinate to test against this object.
  1623. * @param shapeFlag Whether to check against the actual pixels of the object (<code>true</code>) or the bounding box (<code>false</code>).
  1624. *
  1625. * @return <code>true</code> if the display object overlaps or intersects with the specified point; <code>false</code> otherwise.
  1626. *
  1627. * @see #opaqueBackground
  1628. *
  1629. * @example The following code creates a Shape object and shows the result of calling the <code>hitTestPoint()</code> method, using different points as parameters. The <code>globalToLocal()</code> method converts the point from Stage coordinates to the coordinate space of the shape:
  1630. * <listing>
  1631. * import flash.display.Shape;
  1632. * import flash.geom.Point;
  1633. *
  1634. * var circle:Shape = new Shape();
  1635. * circle.graphics.beginFill(0x0000FF);
  1636. * circle.graphics.drawCircle(40, 40, 40);
  1637. * circle.x = 10;
  1638. * addChild(circle);
  1639. *
  1640. * var point1:Point = new Point(0, 0);
  1641. * trace(circle.hitTestPoint(point1.x, point1.y, true)); // false
  1642. * trace(circle.hitTestPoint(point1.x, point1.y, false)); // false
  1643. * trace(circle.globalToLocal(point1)); // [x=-10, y=0]
  1644. *
  1645. * var point2:Point = new Point(10, 1);
  1646. * trace(circle.hitTestPoint(point2.x, point2.y, true)); // false
  1647. * trace(circle.hitTestPoint(point2.x, point2.y, false)); // true
  1648. * trace(circle.globalToLocal(point2)); // [x=0, y=1]
  1649. *
  1650. * var point3:Point = new Point(30, 20);
  1651. * trace(circle.hitTestPoint(point3.x, point3.y, true)); // true
  1652. * trace(circle.hitTestPoint(point3.x, point3.y, false)); // true
  1653. * trace(circle.globalToLocal(point3)); // [x=20, y=20]
  1654. * </listing>
  1655. */
  1656. "public function hitTestPoint",function hitTestPoint(x/*:Number*/, y/*:Number*/, shapeFlag/*:Boolean = false*/)/*:Boolean*/ {if(arguments.length<3){shapeFlag = false;}
  1657. throw new Error('not implemented'); // TODO: implement!
  1658. },
  1659. /**
  1660. * Converts a three-dimensional point of the three-dimensional display object's (local) coordinates to a two-dimensional point in the Stage (global) coordinates.
  1661. * <p>For example, you can only use two-dimensional coordinates (x,y) to draw with the <code>display.Graphics</code> methods. To draw a three-dimensional object, you need to map the three-dimensional coordinates of a display object to two-dimensional coordinates. First, create an instance of the Vector3D class that holds the x-, y-, and z- coordinates of the three-dimensional display object. Then pass the Vector3D object to the <code>local3DToGlobal()</code> method as the <code>point3d</code> parameter. The method returns a two-dimensional Point object that can be used with the Graphics API to draw the three-dimensional object.</p>
  1662. * @param point3d A Vector3D object containing either a three-dimensional point or the coordinates of the three-dimensional display object.
  1663. *
  1664. * @return A two-dimensional point representing a three-dimensional point in two-dimensional space.
  1665. *
  1666. * @example This example draws a simple three-dimensional cube in a two dimensional space using <code>display.Graphics</code> methods. The location of <code>this</code> display object is offset, so the cube's registration point is in its center. A vector of Vector3D objects holds the cube's three dimensional coordinates. The top of the cube is draw first, the bottom is drawn second, and then the top and bottom four corners are connected. You need to add the cube to the display object container before drawing the cube in order to use the <code>local3DToGlobal()</code> method.
  1667. * <listing>
  1668. * package {
  1669. * import flash.display.MovieClip;
  1670. * import flash.display.Sprite;
  1671. * import flash.display.Graphics;
  1672. * import flash.geom.*;
  1673. *
  1674. * public class Local3DToGlobalExample extends MovieClip {
  1675. * private var myCube:Sprite = new Sprite();
  1676. * private var v8:Vector.<Vector3D> = new Vector.<Vector3D>(8);
  1677. *
  1678. * public function Local3DToGlobalExample():void {
  1679. * this.x = -(this.stage.stageWidth / 2);
  1680. * this.y = -(this.stage.stageWidth / 2);
  1681. *
  1682. * v8[0] = new Vector3D(-40,-40,-40);
  1683. * v8[1] = new Vector3D(40,-40,-40);
  1684. * v8[2] = new Vector3D(40,-40,40);
  1685. * v8[3] = new Vector3D(-40,-40,40);
  1686. * v8[4] = new Vector3D(-40,100,-40);
  1687. * v8[5] = new Vector3D(40,100,-40);
  1688. * v8[6] = new Vector3D(40,100,40);
  1689. * v8[7] = new Vector3D(-40,100,40);
  1690. *
  1691. * myCube.x = (this.stage.stageWidth / 2);
  1692. * myCube.y = (this.stage.stageWidth / 2);
  1693. * myCube.z = 1;
  1694. * addChild(myCube);
  1695. *
  1696. * Cube();
  1697. * }
  1698. *
  1699. * private function Cube():void {
  1700. * var ps:Point = new Point(0,0);
  1701. *
  1702. * myCube.graphics.lineStyle(2,0xFF0000);
  1703. *
  1704. * ps = myCube.local3DToGlobal(v8[0]);
  1705. * myCube.graphics.moveTo(ps.x, ps.y);
  1706. * ps = myCube.local3DToGlobal(v8[1]);
  1707. * myCube.graphics.lineTo(ps.x, ps.y);
  1708. * ps = myCube.local3DToGlobal(v8[2]);
  1709. * myCube.graphics.lineTo(ps.x, ps.y);
  1710. * ps = myCube.local3DToGlobal(v8[3]);
  1711. * myCube.graphics.lineTo(ps.x, ps.y);
  1712. * ps = myCube.local3DToGlobal(v8[0]);
  1713. * myCube.graphics.lineTo(ps.x, ps.y);
  1714. *
  1715. * ps = myCube.local3DToGlobal(v8[4]);
  1716. * myCube.graphics.moveTo(ps.x, ps.y);
  1717. * ps = myCube.local3DToGlobal(v8[5]);
  1718. * myCube.graphics.lineTo(ps.x, ps.y);
  1719. * ps = myCube.local3DToGlobal(v8[6]);
  1720. * myCube.graphics.lineTo(ps.x, ps.y);
  1721. * ps = myCube.local3DToGlobal(v8[7]);
  1722. * myCube.graphics.lineTo(ps.x, ps.y);
  1723. * ps = myCube.local3DToGlobal(v8[4]);
  1724. * myCube.graphics.lineTo(ps.x, ps.y);
  1725. *
  1726. * ps = myCube.local3DToGlobal(v8[0]);
  1727. * myCube.graphics.moveTo(ps.x, ps.y);
  1728. * ps = myCube.local3DToGlobal(v8[4]);
  1729. * myCube.graphics.lineTo(ps.x, ps.y);
  1730. * ps = myCube.local3DToGlobal(v8[1]);
  1731. * myCube.graphics.moveTo(ps.x, ps.y);
  1732. * ps = myCube.local3DToGlobal(v8[5]);
  1733. * myCube.graphics.lineTo(ps.x, ps.y);
  1734. * ps = myCube.local3DToGlobal(v8[2]);
  1735. * myCube.graphics.moveTo(ps.x, ps.y);
  1736. * ps = myCube.local3DToGlobal(v8[6]);
  1737. * myCube.graphics.lineTo(ps.x, ps.y);
  1738. * ps = myCube.local3DToGlobal(v8[3]);
  1739. * myCube.graphics.moveTo(ps.x, ps.y);
  1740. * ps = myCube.local3DToGlobal(v8[7]);
  1741. * myCube.graphics.lineTo(ps.x, ps.y);
  1742. * }
  1743. * }
  1744. * }
  1745. * </listing>
  1746. */
  1747. "public function local3DToGlobal",function local3DToGlobal(point3d/*:Vector3D*/)/*:Point*/ {
  1748. throw new Error('not implemented'); // TODO: implement!
  1749. },
  1750. /**
  1751. * Converts the <code>point</code> object from the display object's (local) coordinates to the Stage (global) coordinates.
  1752. * <p>This method allows you to convert any given <i>x</i> and <i>y</i> 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).</p>
  1753. * <p>To use this method, first create an instance of the Point class. The <i>x</i> and <i>y</i> values that you assign represent local coordinates because they relate to the origin of the display object.</p>
  1754. * <p>You then pass the Point instance that you created as the parameter to the <code>localToGlobal()</code> method. The method returns a new Point object with <i>x</i> and <i>y</i> values that relate to the origin of the Stage instead of the origin of the display object.</p>
  1755. * @param point The name or identifier of a point created with the Point class, specifying the <i>x</i> and <i>y</i> coordinates as properties.
  1756. *
  1757. * @return A Point object with coordinates relative to the Stage.
  1758. *
  1759. * @see #globalToLocal()
  1760. * @see flash.geom.Point
  1761. * @see http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7dca.html Using Point objects
  1762. *
  1763. * @example The following code creates a Sprite object. The <code>mouseX</code> and <code>mouseY</code> properties of the sprite are in the coordinate space of the display object. This code uses the <code>localToGlobal()</code> method to translate these properties to the global (Stage) coordinates:
  1764. * <listing>
  1765. * import flash.display.Sprite;
  1766. * import flash.events.MouseEvent;
  1767. * import flash.geom.Point;
  1768. *
  1769. * var square:Sprite = new Sprite();
  1770. * square.graphics.beginFill(0xFFCC00);
  1771. * square.graphics.drawRect(0, 0, 100, 100);
  1772. * square.x = 100;
  1773. * square.y = 200;
  1774. *
  1775. * addChild(square);
  1776. *
  1777. * square.addEventListener(MouseEvent.CLICK, traceCoordinates)
  1778. *
  1779. * function traceCoordinates(event:MouseEvent):void {
  1780. * var clickPoint:Point = new Point(square.mouseX, square.mouseY);
  1781. * trace("display object coordinates:", clickPoint);
  1782. * trace("stage coordinates:", square.localToGlobal(clickPoint));
  1783. * }
  1784. * </listing>
  1785. */
  1786. "public function localToGlobal",function localToGlobal(point/*:Point*/)/*:Point*/ {
  1787. // TODO: take into account scale, rotation etc.!
  1788. return point.add(this.getStageOffset$2());
  1789. },
  1790. // ************************** Jangaroo part **************************
  1791. /**
  1792. * @private
  1793. */
  1794. "protected function setParent",function setParent(parent/* : DisplayObjectContainer*/)/* : void*/ {
  1795. this['parent'] = parent;
  1796. },
  1797. /**
  1798. * @private
  1799. */
  1800. "public function broadcastEvent",function broadcastEvent(event/*:flash.events.Event*/)/*:Boolean*/ {
  1801. return this.dispatchEvent(event);
  1802. },
  1803. "private static const",{ DOM_EVENT_TO_MOUSE_EVENT/* : Object*//*<String,String>*/ :function(){return( {
  1804. 'click': flash.events.MouseEvent.CLICK,
  1805. 'dblclick': flash.events.MouseEvent.DOUBLE_CLICK,
  1806. 'mousedown': flash.events.MouseEvent.MOUSE_DOWN,
  1807. 'mouseup': flash.events.MouseEvent.MOUSE_UP,
  1808. 'mousemove': flash.events.MouseEvent.MOUSE_MOVE,
  1809. 'mouseover': flash.events.MouseEvent.MOUSE_OVER,
  1810. 'mouseout': flash.events.MouseEvent.MOUSE_OUT,
  1811. 'mousewheel':flash.events.MouseEvent.MOUSE_WHEEL
  1812. // TODO: map remaining MouseEvent constants to DOM events!
  1813. });}},
  1814. "private static const",{ DOM_EVENT_TO_KEYBOARD_EVENT/* : Object*//*<String,String>*/ :function(){return( {
  1815. 'keydown': flash.events.KeyboardEvent.KEY_DOWN,
  1816. 'keyup': flash.events.KeyboardEvent.KEY_UP
  1817. });}},
  1818. "private static const",{ FLASH_EVENT_TO_DOM_EVENT/* : Object*/ :function(){return( $$private.merge(
  1819. $$private.reverseMapping($$private.DOM_EVENT_TO_MOUSE_EVENT),
  1820. $$private.reverseMapping($$private.DOM_EVENT_TO_KEYBOARD_EVENT)));}},
  1821. "private static function merge",function merge(o1/*:Object*/, o2/*:Object*/)/*:Object*/ {
  1822. var result/*:Object*/ = {};
  1823. for (var m/*:String*/ in o1) {
  1824. result[m] = o1[m];
  1825. }
  1826. for (m in o2) {
  1827. result[m] = o2[m];
  1828. }
  1829. return result;
  1830. },
  1831. "private static function reverseMapping",function reverseMapping(mapping/*:Object*/)/*:Object*/ {
  1832. var result/*:Object*/ = {};
  1833. for (var m/*:String*/ in mapping) {
  1834. result[mapping[m]] = m;
  1835. }
  1836. return result;
  1837. },
  1838. /**
  1839. * @inheritDoc
  1840. */
  1841. "override public function addEventListener",function addEventListener(type/* : String*/, listener/* : Function*/, useCapture/* : Boolean = false*/,
  1842. priority/* : int = 0*/, useWeakReference/* : Boolean = false*/)/* : void*/ {if(arguments.length<5){if(arguments.length<4){if(arguments.length<3){useCapture = false;}priority = 0;}useWeakReference = false;}
  1843. var newEventType/* : Boolean*/ = !this.hasEventListener(type);
  1844. this.addEventListener$2(type, listener, useCapture, priority, useWeakReference);
  1845. var domEventType/* : String*/ = $$private.FLASH_EVENT_TO_DOM_EVENT[type];
  1846. if (newEventType) {
  1847. if (domEventType) {
  1848. this.getElement().addEventListener(domEventType,$$bound( this,"transformAndDispatch$2"), useCapture);
  1849. // TODO: maintain different event listeners for useCapture==true and useCapture==false (if supported by browser)!
  1850. } else if (type === flash.events.Event.ENTER_FRAME) {
  1851. flash.display.Stage.addEnterFrameSource(this);
  1852. }
  1853. }
  1854. },
  1855. /**
  1856. * @inheritDoc
  1857. */
  1858. "override public function removeEventListener",function removeEventListener(type/* : String*/, listener/* : Function*/, useCapture/* : Boolean = false*/)/*:void*/ {if(arguments.length<3){useCapture = false;}
  1859. this.removeEventListener$2(type, listener, useCapture);
  1860. if (!this.hasEventListener(type)) { // did we just remove the last event listener of this type?
  1861. var domEventType/* : String*/ = $$private.FLASH_EVENT_TO_DOM_EVENT[type];
  1862. if (domEventType) {
  1863. // remove the DOM element event listener, too:
  1864. this._elem$2.removeEventListener(domEventType,$$bound( this,"transformAndDispatch$2"), useCapture);
  1865. } else if (type === flash.events.Event.ENTER_FRAME) {
  1866. flash.display.Stage.removeEnterFrameSource(this);
  1867. }
  1868. }
  1869. },
  1870. "private function transformAndDispatch",function transformAndDispatch(event/* : js.Event*/)/* : Boolean*/ {
  1871. var flashEvent/*:flash.events.Event*/;
  1872. var type/* : String*/ = $$private.DOM_EVENT_TO_MOUSE_EVENT[event.type];
  1873. if (type) {
  1874. flashEvent = new flash.events.MouseEvent(type, true, true, event.pageX - this.stage.x, event.pageY - this.stage.y, null,
  1875. event.ctrlKey, event.altKey, event.shiftKey, this.stage.buttonDown);
  1876. } else {
  1877. type = $$private.DOM_EVENT_TO_KEYBOARD_EVENT[event.type];
  1878. if (type) {
  1879. flashEvent = new flash.events.KeyboardEvent(type, true, true, event['charCode'], event.keyCode || event['which'], 0,
  1880. event.ctrlKey, event.altKey, event.shiftKey, event.ctrlKey, event.ctrlKey);
  1881. }
  1882. }
  1883. if (!flashEvent) {
  1884. trace("Unmapped DOM event type " + event.type + " occured, ignoring.");
  1885. }
  1886. return this.dispatchEvent(flashEvent);
  1887. },
  1888. "private static function numberToStyleLength",function numberToStyleLength(value/*:Number*/)/*:String*/ {
  1889. return isNaN(value) ? "auto" : (value + "px");
  1890. },
  1891. "private static function styleLengthToNumber",function styleLengthToNumber(length/*:String*/)/*:**/ {
  1892. return length == "auto" ? NaN : Number(length.split("px")[0]);
  1893. },
  1894. /**
  1895. * @private
  1896. */
  1897. "protected function createElement",function createElement()/* : HTMLElement*/ {
  1898. var elem/* : HTMLElement*/ =/* js.HTMLElement*/(window.document.createElement(this.getElementName()));
  1899. elem.style.position = "absolute";
  1900. elem.style.width = "100%";
  1901. elem.style.left = this._x$2 + "px";
  1902. elem.style.top = this._y$2 + "px";
  1903. elem.style['MozUserSelect'] = 'none';
  1904. elem.style['KhtmlUserSelect'] = 'none';
  1905. elem['unselectable'] = 'on';
  1906. elem['onselectstart'] = function flash$display$DisplayObject$1985_29()/*:Boolean*/ {return false;};
  1907. return elem;
  1908. },
  1909. /**
  1910. * @private
  1911. */
  1912. "protected function getElementName",function getElementName()/* : String*/ {
  1913. return "div";
  1914. },
  1915. /**
  1916. * @private
  1917. */
  1918. "public function hasElement",function hasElement()/* : Boolean*/ {
  1919. return ! !this._elem$2;
  1920. },
  1921. /**
  1922. * @private
  1923. */
  1924. "public function getElement",function getElement()/* : HTMLElement*/ {
  1925. if (!this._elem$2) {
  1926. this._elem$2 = this.createElement();
  1927. }
  1928. return this._elem$2;
  1929. },
  1930. /**
  1931. * @private
  1932. */
  1933. "protected function setElement",function setElement(elem/* : HTMLElement*/)/*:void*/ {
  1934. elem.style.left = this._x$2 + "px";
  1935. elem.style.top = this._y$2 + "px";
  1936. if (this._elem$2) {
  1937. elem.style.width = this._elem$2.style.width;
  1938. elem.style.height = this._elem$2.style.height;
  1939. if (this.parent) {
  1940. this.parent.getElement().replaceChild(elem, this._elem$2);
  1941. }
  1942. }
  1943. this._elem$2 = elem;
  1944. },
  1945. "private function getStageOffset",function getStageOffset()/*:Point*/ {
  1946. var x/*:Number*/ = this._x$2;
  1947. var y/*:Number*/ = this._y$2;
  1948. for (var current/*:DisplayObjectContainer*/ = this.parent; current ; current = current.parent) {
  1949. x += current.x;
  1950. y += current.y;
  1951. }
  1952. return new flash.geom.Point(x, y);
  1953. },
  1954. /**
  1955. * @private
  1956. */
  1957. "public function DisplayObject",function DisplayObject$() {
  1958. flash.events.EventDispatcher.call(this);
  1959. this._filters$2 = [];
  1960. this._blendMode$2 = flash.display.BlendMode.NORMAL;
  1961. },
  1962. "private var",{ _elem/* : HTMLElement*/:null},
  1963. "private var",{ _x/* : Number*/ : 0, _y/* : Number*/ : 0},
  1964. "protected var",{ _width/* : Number*/ : 0, _height/* : Number*/ : 0}, // unscaled
  1965. "private var",{ _scaleX/*:Number*/ : 1},
  1966. "private var",{ _scaleY/*:Number*/ : 1},
  1967. "private var",{ _transform/* : Transform*/:null},
  1968. "private var",{ _rotation/*:Number*/ : 0},
  1969. "private var",{ _visible/*: Boolean*/ : true},
  1970. "private var",{ _alpha/*: Number*/ : 1},
  1971. "private var",{ _filters/*: Array*/:null},
  1972. "private var",{ _cacheAsBitmap/*:Boolean*/:false},
  1973. "private var",{ _blendMode/*:String*/:null},
  1974. "private static var",{ _loaderInfo/*:LoaderInfo*/:null},
  1975. ];},[],["flash.events.EventDispatcher","flash.display.IBitmapDrawable","Error","String","flash.geom.Transform","flash.geom.Rectangle","flash.events.MouseEvent","flash.events.KeyboardEvent","flash.events.Event","flash.display.Stage","Number","js.HTMLElement","flash.geom.Point","flash.display.BlendMode"], "0.8.0", "0.9.6"
  1976. );