forked from as3/as3-utils
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreate.as
More file actions
28 lines (28 loc) · 846 Bytes
/
create.as
File metadata and controls
28 lines (28 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package utils.object
{
/**
* Creates an instance of the given Class,
* optionally passing arguments to the constructor,
* and then decorating with properties.
*
* @param classToInstantiate Class to create an instance of.
* @param constructorArguments Array of arguments to pass to the Class constructor.
* @returns An instance of <code>classToInstantiate</code>
*
* @see utils.object#createInstance
* @see utils.object#merge
*
* @example
* <listing version="3.0">
* var sprite:Sprite = create(Sprite, null, { x: 50, y: 100 });
* </listing>
*
* @author drewbourne
*/
public function create(classToInstantiate:Class,
constructorArguments:Array = null,
properties:Object = null):Object
{
return merge(createInstance(classToInstantiate, constructorArguments), properties);
}
}