Hi,
I have been trying to set the loaded image x and y to -180 in order to centre xml loaded images(they’re 360 x 360). The reason for this is to add a zoom effect but i can’t seem to apply this zoom effect to the centre of the loaded image(s). It scales to 0,0. I need to either set 0,0 to be the centre of the image or scale to 180,180. I’m currently testing this on 1 of 16 images. Hope this makes sense.
Pulling my hair out and desperate for help.
var thumbsXML:XML = new XML();
thumbsXML.ignoreWhite = true;
thumbsXML.onLoad = function(success:Boolean) {
if (!success) {
trace("XML Data not Found or Error on Loading");
} else {
rootNode = thumbsXML.firstChild;
thumbsNode = rootNode.firstChild.childNodes;
totalThumbs = thumbsNode.length;
trace("XML DATA: " + rootNode);
trace(newline);
for (i = 0; i < totalThumbs; i++) {
//attachClips and populate/tag with data
var thumbClip = visHold.attachMovie("thumbContainer_mc", "visual" + visHold.getNextHighestDepth(), visHold.getNextHighestDepth());
//dynamically place clips on stage
thumbClip._x = (visHold._width/2) - (thumbClip._width/2);
thumbClip._y = (visHold._height/2) - (thumbClip._height/2);
//declare onPress action for thumbClip
//populate loadQueue array
thumbsLoad.addToQueue(visPath+"/" + thumbsNode*.childNodes[0].firstChild.nodeValue, thumbClip);
//trace("Image added to queue: "+thumbsNode*.firstChild.childNodes[0]);
}
//load all images in loadQueue
thumbsLoad.loadAll();
}
//set the starting value for 2 variables
targXscale = 80;
targYscale = 80;
targetAlpha = 0;
visHold.visual15._alpha=0;
visHold.onEnterFrame = function() {
//smooth scaling code
visHold.visual15._xscale-=(visHold.visual15._xscale-targXscale)/5;
visHold.visual15._yscale-=(visHold.visual15._yscale-targYscale)/5;
visHold.visual15._alpha-=(visHold.visual15._alpha-targetAlpha)/5;
if(visHold.visual15._xscale>=99.9){
visHold.visual15._alpha-=34;
}
}
button1.onRelease = function() {
visHold.visual15._xscale=80;
visHold.visual15._yscale=80;
visHold.visual15._alpha=0;
visHold.visual15._alpha-=(_root.visHold.visual15._alpha-targetAlpha)/5;
_root.targXscale = 100;
_root.targYscale = 100;
_root.targetAlpha = 100;
}
};
thumbsXML.load("data.xml");
thanks