Graphics Reference
In-Depth Information
Instead, assign the value of the Array
s length to a variable that
you can then reference. Example 5.1 shows the two different
techniques.
'
EXAMPLE 5.1
//Assign the value of myArr.length to a variable before using
it in a for loop:
var myArr:Array = new Array
( item1 , item2 , item3 , item4 );
var myArrLen:Number = myArray.length;
for(var i:Number = 0; i < myArrLen; i++){
trace( Array item at position +i+ is: + myArr[i];
}
//Instead of accessing it directly:
var myArr:Array = new Array
(
item1
,
item2
,
item3
,
item4
);
for(var i:Number = 0; i
<
myArray.length; i++){
trace(
Array item at position
+i+
is:
+ myArr[i];
}
Conclusion
As I
ve covered in this chapter, optimizing your files can be
achieved on several levels. When it comes to file size, you should
always optimize as much as you can without making heavily
noticeable sacrifices to image quality or functionality. When you
prepare your images for your Flash files, remember to choose the
best file type for the individual image and to save that image at a
high enough quality so that it
'
s clear on your monitor. If you see
obvious image artifacts, raise the quality of the image before you
use it in Flash. Once inside Flash, manage the compression of your
images on an individual basis from the Library window instead of
globally from the Publish Settings window.
Use vector images when you can, but remember to use them
wisely. If you
'
ve got a visually complicated image, go ahead and
use the raster version. However, if that image can be re-created
with a minimal number of lines and colors, you may benefit from
drawing it in vector format in order to achieve a possibly smoother
representation that can be scaled without worry of quality loss. In
addition to keeping the number of lines and colors to a minimum,
do the same with gradients, as they require the Flash Player to
work just a little harder. As for fonts, try to embed only what you
need to embed and only if you need to embed them at all. If you
need to use a specific font for only one or two words, try using a
raster image of those words, and try to avoid breaking the text
apart into complicated vector shapes.
'
Search WWH ::




Custom Search