MCPcopy
hub / github.com/jabbany/CommentCoreLibrary / DisplayObject

Class DisplayObject

src/scripting/api/Display/DisplayObject.ts:224–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222 }
223
224 export class DisplayObject implements ISerializable, Runtime.RegisterableObject, Transformable {
225 private static SANDBOX_EVENTS:Array<string> = ["enterFrame"];
226 /** This represents an element in the HTML rendering **/
227 private _id:string;
228 private _alpha:number = 1;
229 private _anchor:Display.Point = new Point();
230 private _boundingBox:Rectangle = new Rectangle();
231 private _z:number = 0;
232 private _scaleX:number = 1;
233 private _scaleY:number = 1;
234 private _scaleZ:number = 1;
235 private _rotationX:number = 0;
236 private _rotationY:number = 0;
237 private _rotationZ:number = 0;
238 private _filters:Array<Filter> = [];
239 private _visible:boolean = false;
240 private _blendMode:string = "normal";
241 private _listeners:Object = {};
242 private _parent:DisplayObject = null;
243 private _name:string = "";
244 private _children:Array<DisplayObject> = [];
245 private _transform:Transform = new Transform(this);
246 private _hasSetDefaults:boolean = false;
247
248 constructor(id:string = Runtime.generateId()) {
249 this._id = id;
250 this._visible = true;
251 }
252
253 public setDefaults(defaults:Object = {}):void {
254 if (this._hasSetDefaults) {
255 __trace("DisplayObject.setDefaults called more than once.", "warn");
256 return;
257 }
258 this._hasSetDefaults = true;
259 try {
260 /** Try reading the defaults from motion fields **/
261 if (defaults.hasOwnProperty("motion")) {
262 var motion:Object = defaults["motion"];
263 if (motion.hasOwnProperty("alpha")) {
264 this._alpha = motion["alpha"]["fromValue"];
265 }
266 if (motion.hasOwnProperty("x")) {
267 this._anchor.x = motion["x"]["fromValue"];
268 }
269 if (motion.hasOwnProperty("y")) {
270 this._anchor.y = motion["y"]["fromValue"];
271 }
272 } else if (defaults.hasOwnProperty("motionGroup") &&
273 defaults["motionGroup"] && defaults["motionGroup"].length > 0) {
274 var motion:Object = defaults["motionGroup"][0];
275 if (motion.hasOwnProperty("alpha")) {
276 this._alpha = motion["alpha"]["fromValue"];
277 }
278 if (motion.hasOwnProperty("x")) {
279 this._anchor.x = motion["x"]["fromValue"];
280 }
281 if (motion.hasOwnProperty("y")) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected