Stroep

Just a collection of random works – Mark Knol

Code snippetEasily create an image without taking care of loaders and URLRequest etc.
Most simple usage of the Image class:

import nl.stroep.utils.Image

var myImage:Image = new Image("myImage.jpg");
this.addChild(myImage)
 

You can also add the most common eventListeners to the image:

import nl.stroep.utils.Image

var myImage:Image = new Image("myImage.jpg");
this.addChild(myImage);

myImage.addEventListener(Event.COMPLETE, onImageLoaded );
myImage.addEventListener(IOErrorEvent.IO_ERROR, onImageError );
myImage.addEventListener(ProgressEvent.PROGRESS, onImageLoading );

function onImageLoaded (e:Event):void {
   trace("image loaded!");
}

function onImageError (e:IOErrorEvent):void {
   trace("image error", e.text);
}

function onImageLoading (e :P rogressEvent):void {
   trace("loading image.. bytesLoaded=" + e.bytesLoaded + " bytesTotal=" + e.bytesTotal );
}
 

Download
Check out the Image class at googlecode



   

2 responses to “nl.stroep.utils.Image”

  1. Jack says:

    Thanks for the great utility.

    I was going to create some high resolution images but it seems that it doesn’t work past a certain size. Any tips on how I would go about creating high resolution images?

    Cheers

Say something interesting

CommentLuv badge