PageRenderTime 31ms CodeModel.GetById 32ms 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

Large files files are truncated, but you can click here to view the full 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ā€¦

Large files files are truncated, but you can click here to view the full file