Yeah its just wired how it works in FP9 and not FP10 and I was wondering if it was this code or if it could be something else!? ----- Original Message ----- From: sebastian To: Flash Coders List Sent: Wednesday, November 05, 2008 10:23 PM Subject: Re: [Flashcoders] AS2 - Code not working in FP10
Hi, I'm sure someone else can give a reason, cause I wouldn't know; but short of that, you could use a tween engine to center it. AS2 has several good tween engines available. Seb. FlashDev wrote: > Hi guys, ive got a bit fo code that works fine in flash player 9 but in 10 it completely messes up! > > Its suppose to centre an image, any ideas why it no longer works? > > center_content.onEnterFrame = function() { > // CENTER Y > contentYTarg = Math.round((Stage.height - center_content._height)/2); > contentYDist = contentYTarg - center_content._y; > center_content._y += contentYDist/contentEase; > if (contentYDist > 0) { > center_content._y = Math.ceil(center_content._y); > }else{ > center_content._y = Math.floor(center_content._y); > } > if (Math.abs(contentYDist) < 1) { > center_content._y = contentYTarg; > } > // CENTER X > contentXTarg = Math.round((Stage.width - center_content._width)/2); > contentXDist = contentXTarg - center_content._x; > center_content._x += contentXDist/contentEase; > if (contentXDist > 0) { > center_content._x = Math.ceil(center_content._x); > }else{ > center_content._x = Math.floor(center_content._x); > } > if (Math.abs(contentXDist) < 1) { > center_content._x = contentXTarg; > } > // WHEN CENTERING IS COMPLETE... > if (contentYDist == 0 && contentXDist == 0) { > delete center_content.onEnterFrame > } > } > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders