Loading images through as3 and Arbol Negro

One of the most repetitive processes when using flash is loading images.
At the time of loading an image, you have to call several class to load a single image, and repeat the process can be confusing, if there is no class that handles the concept of image.

Usually when loading an image with Loader, it is placed inside a Sprite, so by default, SimpleImage is a Sprite, but you can also access the loaded content in the form of DisplayObject.

The following example also shows an image loaded twice through SimpleImage, both have been rotated 45 and scaled to 2.5, the image on the right has enabled smooth property to avoid pixelation of the image.

_simpleImage = new SimpleImage();
addChild(_simpleImage);
_simpleImage.x = 500;
_simpleImage.rotation =  45;
_simpleImage.path = _ocean;
_simpleImage.scaleX = 2.5;
_simpleImage.scaleY = 2.5;
_simpleImage.smooth = true;

Same Image Loaded twice

fig1. Left image pixelated, right image softened

The idea of using smooth is because sometimes the size of the image is not correct, is of low quality, and so we reduce the errors.

The advantages of using SimpleImage will be reflected in time savings, moreover, to be used as a Sprite, which means you can manipulate in any manner permitted by this one, or convert to MovieClip, scale, filters, create masks.

SimpleImage also has the ability to read the progress of the data stream to find out the percentage loaded.

Download example files:

Example-SimpleImage.zip

One Response to “Loading images through as3 and Arbol Negro

  1. […] This post was mentioned on Twitter by Sebastian Sanabria and Sebastian Sanabria. Sebastian Sanabria said: RT @ArbolNegro: Loading images through as3 and #ArbolNegro http://bit.ly/8Z6Dx6 #blogpost #as3 #flash #flashdev […]

Leave a Reply

 

*
= 4 + 0

Switch to our mobile site