DisplayObjectUtil class added to DestroyFramework

 

I’ve been sifting through my old framework, finding classes that are useful, but lacking in their current state—one of them being the fSprite class. This is easily my most-used class because it’s the base of every visual object. It has so much built-in and I now realize that isn’t exactly a good thing. Whenever I don’t need its layer management or motion methods, precious memory is lost. On top of that, there are visual objects that aren’t Sprites but could benefit from fSprite’s methods, such as the Shape class. After seeing Jackson Dunstan’s comparison of the two, I realized I could be saving a solid amount memory and instantiation speed by using Shape instead of Sprite where possible.

Because of these realizations, I decided to write a DisplayObjectUtil class. It starts with my layer management methods and will grow to include many others. In the following methods, if the object isn’t the child of a parent, it returns -1 instead of throwing an error.

The bringToFront method takes a DisplayObject and brings it to the front of the display list. It also includes an optional back parameter in the case you don’t want the object in the very front, you can send it back a few.

1
2
3
4
5
// DisplayObjectUtil.bringToFront(object:DisplayObject, back:int = 0):int
 
// consider sprite's index is 2 in a display list of 5 objects
DisplayObjectUtil.bringToFront(sprite); // returns new index of 4
DisplayObjectUtil.bringToFront(sprite, 1); // returns new index of 3

Along with bringToFront, I wrote bringForward, which moves the object up in the display list the set number of times. If the new index exceeds the highest index, it limits itself to that instead of throwing an error.

1
2
3
4
5
6
7
8
// DisplayObjectUtil.bringForward(object:DisplayObject, steps:int = 1):int
 
// consider sprite's index is 2 in a display list of 5 objects
DisplayObjectUtil.bringForward(sprite); // returns new index of 3
 
// consider sprite's index is 1 in a display list of 5 objects
DisplayObjectUtil.bringForward(sprite, 2); // returns new index of 3
DisplayObjectUtil.bringForward(sprite, 9); // returns new index of 4

On the reverse, I wrote methods sendToBack and sendBackward. Both work exactly the same as the methods above, but in the reverse direction.

1
2
3
4
5
// DisplayObjectUtil.sendToBack(object:DisplayObject, forward:int = 0):int
 
// consider sprite's index is 2 in a display list of 5 objects
DisplayObjectUtil.sendToBack(sprite); // returns new index of 0
DisplayObjectUtil.sendToBack(sprite, 1); // returns new index of 1
1
2
3
4
5
6
7
8
// DisplayObjectUtil.sendBackward(object:DisplayObject, steps:int = 1):int
 
// consider sprite's index is 2 in a display list of 5 objects
DisplayObjectUtil.sendBackward(sprite); // returns new index of 1
 
// consider sprite's index is 3 in a display list of 5 objects
DisplayObjectUtil.sendBackward(sprite, 2); // returns new index of 1
DisplayObjectUtil.sendBackward(sprite, 9); // returns new index of 0

I hope this class lends a hand and proves useful. Feel free to suggest any other methods DisplayObjectUtil should have.

Using code to problem-solve everyday issues

 

If I spend a third of my life sleeping, I spend another third programming. Most of the code I write is for an application or framework, but lately I find myself using code for everyday problem solving. In the last post, regarding the width of DT, I wrote a 3-line script to find sizes with 3:2 ratios, without decimals. Here’s the code:

1
2
3
for (var w:uint= 576; w < 650; ++w) {
	if (w / 1.5 == int(w / 1.5)) trace(w, "x", w / 1.5);
}

Sure, it’s not the prettiest code, but it gets the job done—and in less than a minute. Without these three lines, I could have spent a good 15 minutes with the calculator widget.

Another scenario where code came in handy happened a month ago. I visited my sister, Lizzy, in Philly and we decided to play Scattegories. Unfortunately, she didn’t have the die to pick the letter for each round. Luckily, I had my laptop with me, so I wrote this snippet:

1
trace("abcdefghijklmnopqrstuvwxyz".substr(int(Math.random() * 26), 1));

In less than a minute, we had a pseudo-random letter and a fun time. There are dozens of moments each day where code is the quick solution, but I don’t always think code-first. Of course, code isn’t always the fastest solution to all problems, but it certainly comes in handy. Next time you have an issue, try using code. Heck, you can even write a 1-line 8-ball script if you have trouble making decisions.

645 576 is the new 450: a wider Destroy Today

 

wider

After working with 450 for the past how many years, I decided to widen things a bit. The main reason for this change is code snippets—just about any code I posted would require a horizontal scroll and that’s not cool. I also plan to get away from the computer more and get back into photography—the wider the better!

On a similar note, if you haven’t noticed, I added a search and archive on the left. Use them!—there’s a solid number of posts from the past.

[update] — I got greedy and increased the width even more, to 645.

NumberUtil added to DestroyFramework

 

Continuing with my nightly work towards the DestroyFramework, I started a NumberUtil class. For now, it includes three methods: confine, pad, and insertCommas.

The confine method is like bumper bowling—you provide it with a number, a minimum, and a maximum. It then returns the number within the minimum and maximum:

1
2
3
4
// NumberUtil.confine(value, min, max);
NumberUtil.confine(5, 0, 10); // returns 5
NumberUtil.confine(-5, 0, 10); // returns 0
NumberUtil.confine(15, 0, 10); // returns 10

The pad method fills a number with zeros based on the set number of digits before and after the point:

1
2
3
4
// NumberUtil.pad(value, beforePoint, afterPoint);
NumberUtil.pad(.4, 1, 2); // returns "0.40"
NumberUtil.pad(3.85, 3, 3); // returns "003.850"
NumberUtil.pad(67, 2, 2); // returns "67.00"

Lastly, the insertCommas method places commas every three digits in the integer of the provided number:

1
2
3
4
// NumberUtil.insertCommas(value);
NumberUtil.insertCommas(4815162342); // returns "4,815,162,342"
NumberUtil.insertCommas(274); // returns "274"
NumberUtil.insertCommas(5931.85); // returns "5,931.85"

I hope these are helpful to everyone. Be sure to let me know if you get some use out of them or if you have any suggestions for other methods.

StringUtil class added to DestroyFramework

 

Last night, I started on a new class, StringUtil. There’s already a StringUtil class in the mx.util package, but it lacks a few methods that I use regularly. The two methods I developed last night are truncate and addSlashes.

The truncate method shortens the supplied String and appends an ellipsis (…) if the length is greater than the set length.

1
2
3
var truncatedString:String = StringUtil.truncate("How can you work on a weekend?", 10);
 
trace(truncatedString); // outputs: How can yo...

The addSlashes method is very powerful. I come from a PHP background, so I deeply missed addSlashes in AS3. I took it one step farther though, adding the ability to specify which characters to slash. By default, it slashes quotes, but you can also have it slash single quotes or special regex characters like hyphens, brackets, periods, and question marks.

1
2
3
var slashedString:String = StringUtil.addSlashes("What's up with the name \"DestroyTwitter\"?", "'\"?");
 
trace(slashedString); // outputs: What\'s up with the name \"DestroyTwitter\"\?

I’m having a blast writing these scripts. Expect many additions over the next few weeks.

Use Capabilities.isDebugger to avoid the startAtLogin error in ADL

 

In DestroyTwitter, I make use of the NativeApplication.nativeApplication.startAtLogin property. It allows the app to automatically open whenever the user turns on his computer. It’s a great feature that’s as easy as setting the property to true, though it has a downside. When using ADL (AIR Debug Launcher), if you try to change this property, an error is thrown:

Error: Error #2014: Feature is not available at this time.
	at flash.desktop::NativeApplication/set startAtLogin()

This wouldn’t be a big deal if the developer only experienced the error, but some Linux users run builds that requires AIR apps to launch with ADL. Even though this pertains to only one DestroyTwitter user that I know of, every user deserves the same experience—especially if they do all that fancy command line code. Prior to today, I used the following code to avoid the error:

1
2
3
4
5
6
7
8
9
10
11
12
13
protected var adl:Boolean;
 
public function set openAtStartup(value:Boolean):void {
	if (adl) return;
 
	try {
		adl = false;
 
		NativeApplication.nativeApplication.startAtLogin = value;
	} catch (error:*) {
		adl = true;
	}
}

This works, but I cringe every time I need to use try/catch. While searching the depths of the flash package, looking for a solution, I came across the Capabilities.isDebugger property. It’s exactly what I was looking for, but for some reason, I never knew about it. Here’s the new implementation:

1
2
3
4
5
public function set openAtStartup(value:Boolean):void {
	if (!Capabilities.isDebugger) {
		NativeApplication.nativeApplication.startAtLogin = value;
	}
}

It’s as easy as pie and enables me to remove one more try/catch from my code and another angel gets his wings.

DestroyFramework on GitHub

 

After signing up with GitHub, I was anxious to use it, so I created the DestroyFramework repository—the product of my late night coding. So far, it only includes TextFieldPlus and ScreenMonitor, but I plan to build it over time.

TextFieldPlus is the beginning of my fText rewrite. At the moment, it includes methods to fix the TextField’s autoSize kerning and autoSize scrolling bugs. It’s a work in progress, so expect some additions in the future.

ScreenMonitor is an incredibly useful class for AIR apps. Since AIR doesn’t have any events for connecting and disconnecting displays, if a user disconnects a display while an AIR window is on that screen, it’s lost forever—for Mac, at least. The ScreenMonitor class periodically checks for a change in screen count and dispatches an event when one occurs. It also lets you check manually at any time.

Check it out and keep a close eye. I’m really starting to get the hang of Git.

I’m on the Git to the Hub

 

GitHub

I decided to finally sign up with GitHub. It looks like a terrific community of developers and there are some incredible useful classes hosted on it. Check it out and let me know what you think. And, since GitHub is considered another “social network,” I’ll need to add it to my list of icons on the left—so many things to do!

I have 16 Google Wave invites (updated)

 

James

Ok, so here’s the deal. I have 8 Google Wave invites. Whoever wants one must send a photo of themself giving the double thumbs up ala James Hall, pictured above. Three rules: 1) both thumbs need to be up and visible, 2) mouth must be open, and 3) the photo must be atleast 800×600. I’ll pick the eight best photos and deliver the invites. Simply send an email to jonnie[at]destroytoday[dot]com with the attached photo. Be sure to say hi.

[note] By sending me your photo, you are allowing me to post your photo on this article.

[update] Here are the first few photos that came in and out the invites went. Google, however, gave me another eight invites, so keep the photos coming!

Picture-2

ryanmckernan

Photo-on-2009-11-25-at-15.05-#2

app7818151259179950

P1010156.JPG

onj

thumbsup

200911262315

Photo-on-2009-11-27-at-20.32

tu7

image

How to handle untyped returns

 

Ideally, you never want to use untyped variables or returns. Sometimes, there are no other options. For example, in DestroyTwitter 2.0, I have a PreferenceManager class. This class has two methods for getting and setting preferences from a specific account or the application as a whole. Since some preferences are Strings and others are Numbers, the return for the getter is untyped.

With an untyped return on my hands, I want to know the best way to handle the variables once I get them. Do I typecast them, use the as operator, or simply do nothing? The answer is pretty surprising. With all literals tested, typecasting is faster than using the as operator, but doing nothing wins. In the non-literal Sprite test, the as operator is faster than typecastng, but once again, doing nothing wins.

Here’s the results and code. For comparison, I tested typed returns as well.

[SWF] Application.swf - 395,961 bytes after decompression
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
typed Number (1000000 iterations)                                       
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
typed Number                                                771     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
none Number (1000000 iterations)                                        
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
none Number                                                 864     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
cast Number (1000000 iterations)                                        
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
cast Number                                                 895     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
as Number (1000000 iterations)                                          
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
as Number                                                   924     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
typed int (1000000 iterations)                                          
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
typed int                                                   788     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
none int (1000000 iterations)                                           
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
none int                                                    859     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
cast int (1000000 iterations)                                           
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
cast int                                                    909     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
as int (1000000 iterations)                                             
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
as int                                                      920     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
typed uint (1000000 iterations)                                         
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
typed uint                                                  789     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
none uint (1000000 iterations)                                          
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
none uint                                                   862     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
cast uint (1000000 iterations)                                          
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
cast uint                                                   903     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
as uint (1000000 iterations)                                            
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
as uint                                                     923     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
typed String (1000000 iterations)                                       
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
typed String                                                799     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
none String (1000000 iterations)                                        
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
none String                                                 815     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
cast String (1000000 iterations)                                        
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
cast String                                                 855     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
as String (1000000 iterations)                                          
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
as String                                                   873     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
typed Sprite (1000000 iterations)                                       
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
typed Sprite                                                810     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
none Sprite (1000000 iterations)                                        
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
none Sprite                                                 813     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
cast Sprite (1000000 iterations)                                        
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
cast Sprite                                                 946     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
as Sprite (1000000 iterations)                                          
Player version: MAC 10,0,32,18 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
as Sprite                                                   886     0.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package app.test { 
	import com.gskinner.utils.PerformanceTest;
 
	import flash.display.DisplayObject;
	import flash.display.InteractiveObject;
	import flash.display.Sprite;
	import flash.utils.setTimeout;
 
	public class Test extends Sprite {
		public var p:PerformanceTest;
 
		public var n:Number;
		public var i:int;
		public var u:uint;
		public var string:String;
		public var sprite:Sprite;
 
		protected var _valueNumber:Number;
		protected var _valueInt:int;
		protected var _valueUint:uint;
		protected var _valueString:String;
		protected var _valueSprite:Sprite;
 
		public function Test() {
			p = PerformanceTest.getInstance();
 
			_valueNumber = 48151623.42;
			_valueInt = 4815162342;
			_valueUint = 4815162342;
			_valueString = "4815162342";
			_valueSprite = new Sprite();
 
			setTimeout(run, 1000);
		}
 
		public function run ():void {
			var it:uint = 1000000;
 
			p.testFunction(testTypedNumber, it, "typed Number");
			p.testFunction(testNoneNumber, it, "none Number");
			p.testFunction(testCastNumber, it, "cast Number");
			p.testFunction(testAsNumber, it, "as Number");
 
			p.testFunction(testTypedInt, it, "typed int");
			p.testFunction(testNoneInt, it, "none int");
			p.testFunction(testCastInt, it, "cast int");
			p.testFunction(testAsInt, it, "as int");
 
			p.testFunction(testTypedUint, it, "typed uint");
			p.testFunction(testNoneUint, it, "none uint");
			p.testFunction(testCastUint, it, "cast uint");
			p.testFunction(testAsUint, it, "as uint");
 
			p.testFunction(testTypedString, it, "typed String");
			p.testFunction(testNoneString, it, "none String");
			p.testFunction(testCastString, it, "cast String");
			p.testFunction(testAsString, it, "as String");
 
			p.testFunction(testTypedSprite, it, "typed Sprite");
			p.testFunction(testNoneSprite, it, "none Sprite");
			p.testFunction(testCastSprite, it, "cast Sprite");
			p.testFunction(testAsSprite, it, "as Sprite");
		}
 
		public function getValueTypedNumber():Number {
			return _valueNumber;
		}
		public function getValueNumber():* {
			return _valueNumber;
		}
		public function getValueTypedInt():int {
			return _valueInt;
		}
		public function getValueInt():* {
			return _valueInt;
		}
		public function getValueTypedUint():uint {
			return _valueUint;
		}
		public function getValueUint():* {
			return _valueUint;
		}
		public function getValueTypedString():String {
			return _valueString;
		}
		public function getValueString():* {
			return _valueString;
		}
		public function getValueTypedSprite():Sprite {
			return _valueSprite;
		}
		public function getValueSprite():* {
			return _valueSprite;
		}
 
		public function testTypedNumber ():void {
			n = getValueTypedNumber();
		}
		public function testNoneNumber ():void {
			n = getValueNumber();
		}
		public function testCastNumber ():void {
			n = Number(getValueNumber());
		}
		public function testAsNumber ():void {
			n = getValueNumber() as Number;
		}
 
		public function testTypedInt ():void {
			i = getValueTypedInt();
		}
		public function testNoneInt ():void {
			i = getValueInt();
		}
		public function testCastInt ():void {
			i = int(getValueInt());
		}
		public function testAsInt ():void {
			i = getValueInt() as int;
		}
 
		public function testTypedUint ():void {
			u = getValueTypedUint();
		}
		public function testNoneUint ():void {
			u = getValueUint();
		}
		public function testCastUint ():void {
			u = int(getValueUint());
		}
		public function testAsUint ():void {
			u = getValueUint() as int;
		}
 
		public function testTypedString ():void {
			string = getValueTypedString();
		}
		public function testNoneString ():void {
			string = getValueString();
		}
		public function testCastString ():void {
			string = String(getValueString());
		}
		public function testAsString ():void {
			string = getValueString() as String;
		}
 
		public function testTypedSprite ():void {
			sprite = getValueTypedSprite();
		}
		public function testNoneSprite ():void {
			sprite = getValueSprite();
		}
		public function testCastSprite ():void {
			sprite = Sprite(getValueSprite());
		}
		public function testAsSprite ():void {
			sprite = getValueSprite() as Sprite;
		}
	}
}