<script type="text/javascript">
</script> <script src="http://www.actionscript.org/ads/www/delivery/ajs.php?zoneid=13&target=_blank&block=1&cb=47467526699&exclude=,bannerid:15,&loc=http%3A//www.actionscript.org/resources/articles/726/6/AS3-Photo-Viewer-Tutorial/Page6.html&referer=http%3A//www.actionscript.org/resources/articles/726/1/AS3-Photo-Viewer-Tutorial/Page1.html&context=YjoxNXw%3D" type="text/javascript"></script> <script type="text/javascript">
</script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>
<script type="text/javascript">document.context='YjoxNSNiOjE1I2I6NzN8'; </script>
![](https://i-blog.csdnimg.cn/blog_migrate/7ec79d4b1c085da9d38d26b53f1e4610.png)
Now we assign to the holder of all the images an ON_ENTERFRAME event and in it we perform some calculation to update the holder and the imgHolder postion and scale to have a nice transition between the images. Code
private function dispatchOnEnterFrame ( e ) { //if the diffrence=0 do nothing if (diffX== 0 ) return; //else update the sliding of our image holder with easing imgHolder. x+= (finalX-imgHolder. x ) / 6; //and also update the current X aside but with a greater easing coef to have some retard in time //between the 2 transition cX+= (finalX-cX ) / 12; //generate a percentage var per= 100 * ( 1- (finalX-cX ) /diffX ); //and ease the current percentage depending on the current generated percentage //this will assure the smoothing and the continus animation percentage+= (per-percentage ) / 12; //update the scaling to have the zoom in out effect holder. scaleX= 1- (. 5 ) * Math. sin ( Math. PI *percentage / 100 ); holder. scaleY= 1- (. 5 ) * Math. sin ( Math. PI *percentage / 100 ); }