-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGraphicsPool.as
More file actions
42 lines (33 loc) · 760 Bytes
/
GraphicsPool.as
File metadata and controls
42 lines (33 loc) · 760 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package
{
import flash.display.Bitmap;
public class GraphicsPool
{
public var Graphics:Array = new Array();
private static var _instance:GraphicsPool = new GraphicsPool();
public static function get Instance():GraphicsPool//делаем синглетон
{
trace("getInstance");
return _instance;
}
public function GraphicsPool():void
{
trace("Constructor");
if(_instance)
throw new Error("Use Instance Field");
}
public function SearchBitmap(request:String):Bitmap
{
var response:GameGraphics;
for each(var object:GameGraphics in this.Graphics)
{
if (object.type == ("app:/"+request+".png"))
{
response = object;
break;
}
}
return response.bitmap;
}
}
}