Search code examples
actionscript-3image-manipulationloaderblackberry-playbook

Actionscript 3.0: resizing images


I'm very very new on ActionScript 3.0 for mobile development.

I'm using loader class to load images. I'm loading ten images with different sizes. I'm trying to load them with a common size (300x300) doing this:

imageWordLoader = new Loader();
imageWordLoader.load(myImageLocation);
imageWordLoader.x = 20;
imageWordLoader.y = 60;
imageWordLoader.height = 300;
imageWordLoader.width = 300;
addChild(imageWordLoader);

But, I can't see anything.

How can I do that?


Solution

  • I have done this to resolve my problem:

    imageWordLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadedEvent);
    

    Now, I can use Event.COMPLETE, but if I use Timo answer, I can't use that event.

    And onLoadedEvent function is:

    private function onLoadedEvent(event:Event):void
    {
        var targetLoader:Loader = Loader(event.target.loader);
    
        targetLoader.content.height = 300;
        targetLoader.content.width = 300;
    }
    

    Thanks for all of your answers.