vendredi 27 novembre 2015

Smooth image on load in as3

I am new here and a complete noob when it comes to as3. Somehow I have managed to put this together with some help from different places. And now I turn to you guys :)

I need to put smoothing on my images and thumbs that Im loading from an XML file. I have tried a lot of things but can't get any of it to work and I get this error: Scene 1, Layer 'as3', Frame 1, Line 27 1120: Access of undefined property e. -> So I know var bitmapContent:Bitmap = Bitmap( ); is the problem. but I have no idea what to use instead of e. I this i what I have so far:

import fl.transitions.Tween;
import fl.transitions.easing.None;
import flash.display.Bitmap;

// Loads the first image//
var i =new Loader();
i.load(new URLRequest("images/1.jpg"));

//Loads the XML file//
var picsXML:XML;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE ,  xmlLoaded);
xmlLoader.load(new URLRequest("imagelist.xml"));

//Loads images into thumbs//
function xmlLoaded(event:Event):void{
    picsXML = new XML(;
    var bitmapContent:Bitmap = Bitmap( );
    bitmapContent.smoothing = true;
    var thumbLoader:UILoader;
    for (var i:uint=0; i<picsXML.image.length(); i++)

        thumbLoader.load(new URLRequest("thumbs/"+picsXML.image[i].@file));
        thumbLoader.buttonMode = true;
        thumbLoader.addEventListener(MouseEvent.CLICK, thumbClicked);
        thumbLoader.addEventListener(MouseEvent.CLICK, tester); 

//Loads large image when thumb is clicked//
function thumbClicked(event:MouseEvent){
    //var bitmapImage:Bitmap =;
    //bitmapImage.smoothing = true;
    var thumbName:String =;
    var thumbIndex:uint = uint(thumbName.substr(5));
    var fullPath:String = "images/"+picsXML.image[thumbIndex].@file;
    mainLoader.load(new URLRequest(fullPath));
    var myTween:Tween = new Tween(mainLoader,"alpha", None.easeNone, .3,1,18,false);


//Removes the first image when thumbs is clicked//
function tester(event:MouseEvent){
    if (mainLoader.contains(i)) {

Aucun commentaire:

Enregistrer un commentaire