Hey Guys,
This is a really annoying problem and since this is new problems and so I decide to posting new thread…
I have a mc movieclip that can be easing x,y perfectly upon clicking right side button as u can see and testing here…
http://sloppyflashguy.franzacollections.net/xycoordinates_problem.swf
This is all working ok,but the problem only starts occured when start zoom in zoom out the mc will easings to unrecognise x,y coordinates…eventhough I do have calculated the new coordinates after zooming but still got no luck…pls guys whats wrong with the code…just need to know if anyone can help with this one. Anythoughts would be great.
here’s the code I’m currently using …
ActionScript Code:
[LEFT]stop();
//import some transition stuff
import mx.transitions.Tween;
import mx.transitions.easing.*;
var coor:Array = new Array([357.6,19.9],[21.7,9.7],[367.9,287.9],[34.2,287.9]);
var len:Number = coor.length;
var orix:Number = mc._x;
var oriy:Number = mc._y;
var oriw:Number = mc._width;
var orih:Number = mc._height;
var orixscale:Number = mc._xscale;
var oriyscale:Number = mc._yscale;
var tw:Number;
var th:Number;
var currX:Number;
var currY:Number;
var currXscale:Number;
var currYscale:Number;
var currW:Number;
var currH:Number;
var onScale:Boolean = false;
var holder:MovieClip = this.createEmptyMovieClip(“holder”,this.getNextHighestDepth());
function buildMenu():Void{
for (var j=0; j<len; j++) {
var btn = holder.attachMovie(“btn”, “btn”+j,holder.getNextHighestDepth());
btn.jvar = j;
btn._x = 450;
btn._y = 50+btn._height*j;
btn.labelbtn.text = j;
btn.onPress = slideMe;
}
}
buildMenu();
function slideMe():Void{
if(currX == undefined && currY == undefined){
easing(mc,orix,coor[this.jvar][0],oriy,coor[this.jvar][1]);
}else{
easing(mc,currX ,coor[this.jvar][0],currY,coor[this.jvar][1]);
}
}
function easing(mc:MovieClip, startx:Number, endx:Number, starty:Number, endy:Number):Void {
var time:Number = 35;
var easeType:Function = Strong.easeOut;
var tweenListener:Object = new Object();
trace(onScale);
if (onScale == false){
var xTween:Tween = new Tween(mc, “_x”, easeType, startx, endx, time);
var yTween:Tween = new Tween(mc, “_y”, easeType, starty, endy, time);
currX = endx;
currY = endy;
} else{
////////calculate new coordinates after zooming////////////////////
//still got no luck here…
endx = endx - tw/2;
endy = endy - th/2;
//////////////////////////////////////////////////////////////////
var xTween:Tween = new Tween(mc, "_x", easeType, startx, endx, time);
var yTween:Tween = new Tween(mc, "_y", easeType, starty, endy, time);
currX = endx;
currY = end
}
}
///////rescale mc thingy stuff
var zoomPercent:Array = [“100”,“120”,“140”,“160”,“180”];
var zoomlen:Number = zoomPercent.length;
var count:Number = 0;
var clickable:Number = 0;
zoomout.enabled = false;
zoomin.onPress = function(){
clickable++;
onScale = true;
zoomout.enabled = true;
if(count<zoomlen){
count++;
zoomInto(zoomPercent[count]);
if(clickable == 4){
zoomin.enabled = false;
}
}
};
zoomout.onPress = function() {
clickable–;
trace(clickable);
zoomin.enabled = true;
if(count>0){
count–;
zoomInto(zoomPercent[count]);
if(clickable == 0){
zoomout.enabled =false;
onScale = false;
}
}
};
function zoomInto(zoom,duration){
//determine the 100% width & height
var ow = mc._width/(mc._xscale/100);//original width
var oh = mc._height/(mc._yscale/100);//original height
tw = ow*(zoom/100);//target width
th = oh*(zoom/100);//target height
//trace(tw+"||"+th);
var mcwidth:Object = new Tween(mc, “_width”, Zoom.easeIn, mc._width, tw, 1, true);
var mcheight:Object = new Tween(mc, “_height”, Zoom.easeIn, mc._height, th, 1, true);
}
[/LEFT]
in case wanna see my fla garb here…
http://sloppyflashguy.franzacollections.net/xycoordinates_problem.fla
Any help and concerns are really appreciated as I’m not asking someones to code for me only just to show/point me where exactly my mistakes…and shed some light …the rest I will work it out…Tq again…guys