FORUMS: list search recent posts

Advanced camera panning

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Tyler Freeman
Advanced camera panning
on Apr 22, 2012 at 2:25:06 am

I have the following code which lets me pan an image with mouse movement in a simultaneous x and y pan. (I will post my code following this post). I have made sure that my background image is a bit larger than my stage to account for movement. My results show the background moving upwards the top stopping nicely at the edge of the stage, however the bottom comes up just a little bit to far revealing bare stage. Why does the left and right work just fine but the up and down are screwed up. The "X" script is identical to the "Y" script. (with the exception of the x and y's).


Return to posts index

Tyler Freeman
Re: Advanced camera panning
on Apr 22, 2012 at 2:25:40 am

My code:
import fl.transitions.Tween;
import fl.motion.easing.*;
import fl.transitions.TweenEvent;
var picTween:Tween
stage.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoved)
function mouseMoved(e){
var yPercent = mouseY / stage.stageWidth;
var newYPos = (stage.stageWidth - pic.width) * yPercent;
picTween = new Tween(pic, "y", Circular.easeOut, pic.y, newYPos, 1, true);
import fl.transitions.Tween;
import fl.motion.easing.*;
import fl.transitions.TweenEvent;
var picTween:Tween
stage.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoved)
function mouseMoved(e){
var xPercent = mouseX / stage.stageWidth;
var newXPos = (stage.stageWidth - pic.width) * xPercent;
picTween = new Tween(pic, "x", Circular.easeOut, pic.x, newXPos, 1, true);
}
}


Return to posts index

demetri tashie
Re: Advanced camera panning
on Apr 26, 2012 at 2:34:47 pm

i would check the registration point of the image within the movieclip 'pic', as well as then the placement of the movieclip 'pic' on the actual stage.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]