Speeding up Smoothing Tweens

I have all my images being loaded into a emptymovie clip each then added into another movie clip side by side which I use tweener to scroll with.

The scrolling performance does’nt seem to be too great, its choppy a bit. The images are under 350x350 in size each theres about 10. They are png an about 150kb each. I bring them in through using loader and have tried applying smoothing to them which did’nt seem to work when I messed with the big movie clip container to see if the images would be smoothed if I scaled it down. To apply smoothing I used,

tmpBitmap:Bitmap=e.target.content
tmpBitmap.smoothing=true

I originally created this all on as2 with the same results, migrating it to as3 I have’nt seen any improvement, I am new to as3 though so perhaps there are some other techniques I could use to get a smooth tween going? Here is my code

//Imports//
import caurina.transitions.*;
import flash.display.BitmapData;
import flash.net.URLLoader;




//Initial Setup//
var scrolling:String="";
var children:Array = new Array();
var tmpArray:Array = new Array();
var tmpMC:MovieClip;

var imageHolder:MovieClip = new MovieClip();
addChild(imageHolder);
imageHolder.addEventListener(Event.ENTER_FRAME, updateScroll);
imageHolder.y=stage.stageHeight/2;
//imageHolder.scaleX=imageHolder.scaleY = 1

createGallery();


function createGallery() {
    //XML Loader//
    var loader:URLLoader = new URLLoader();
    loader.addEventListener(Event.COMPLETE, loadXML);
    loader.load(new URLRequest("images.xml"));

    function loadXML(e:Event):void {
        var xml:XML=new XML(e.target.data);

        for (var i:int=0; i<=xml.pic.length(); i++) {
            var request:URLRequest=new URLRequest(xml.pic*.image.text());

            var myload:Loader = new Loader();
            myload.load(request);
            //myload.contentLoaderInfo.addEventListener(Event.INIT, storeInstance);
            myload.contentLoaderInfo.addEventListener(Event.INIT, handleInstance);
        }
    }
}

function rollover(e:MouseEvent):void {
    //will add in mouse detection to trigger left/right later on
    scrolling="right";
}

function rollout(e:MouseEvent):void {
    scrolling="";
}

//Event.INIT does not get right order, as2 used onStart prior to init to get correct order from xml
/*
function storeInstance(e:Event):void {
//children.push(somevariable);
}
*/

//Sets the image up for scrolling
function handleInstance(e:Event):void {
    var tmpBitmap:Bitmap=e.target.content;
    tmpBitmap.smoothing=true;
    tmpBitmap.y=- tmpBitmap.height/2;

    var tmpMovie:MovieClip=new MovieClip;
    tmpMovie.addChild(tmpBitmap);
    tmpMovie.addEventListener(MouseEvent.MOUSE_OVER, rollover);
    tmpMovie.addEventListener(MouseEvent.MOUSE_OUT, rollout);
    imageHolder.addChild(tmpMovie);

    children.push(tmpMovie);

    var totalwidth:int=0;
    for (var j:int=0; j<children.length; j++) {
        children[j].x=0+totalwidth;
        totalwidth=totalwidth+children[j].width;
    }
}

function updateScroll(e:Event):void {
    var tmpPoint:Point;

    if (scrolling=="left") {
        Tweener.addTween(imageHolder,{x:(imageHolder.x-20) , time:1, transition:"easeIn"});

        tmpPoint=children[0].globalToLocal(new Point(0,0));
        if (tmpPoint.x>=children[0].width) {
            children[0].x = (children[(children.length-1)].x+children[(children.length-1)].width);
            tmpArray=children.splice(0,1);
            children=children.concat(tmpArray);
        }
    }

    if (scrolling=="right") {
        Tweener.addTween(imageHolder,{x:(imageHolder.x+20) , time:1, transition:"easeIn"});
        tmpPoint = children[(children.length-1)].globalToLocal(new Point(stage.stageWidth,0));
        if (tmpPoint.x<=stage.stageWidth) {
            children[(children.length-1)].x = (children[0].x-children[(children.length-1)].width);
            tmpArray=children.splice(0,1);
            children=children.concat(tmpArray);
        }
    }
}
var request:URLRequest=new URLRequest(xml.pic*.image.text());
  • This line of code is causing some error to pop up too, it does’nt like “xml.pic*.image.text()” wants to see “image.png” even though that should be pretty much the same thing?

Any help appreciated!