-
dynamic _x/_y + _xscale/_yscale movement
hi
i want to control an mc using the cursor _x/_y pos so that:
• the mc scrolls left/right and up/down
• the mc also increases or decreases in size via _xscale/_yscale
i have a script that does the first one but am unable to successfully get the second part working. as it is a downloaded script that i only understand partially it may make sense for me to start from scratch..
any ideas how i should best proceed would be much appreciated, thanks.
-
post the working code you already have.
gparis
-
hi
here is the slightly adapted code i'm working with. basically the mc currently scrolls seamlessly horizontally and moves vertically up + down only a small amount (deliberately). i'd like to add x+y scale to this but when i tried there was a clash with the way the mc is currently set up to repeat scroll.
the code:
onClipEvent (load) {
nScreenWidth = 700;
nMaxRate = 10;
function moveLeft(nPixels) {
this._x -= nPixels;
if (this._x<-1400 ){
this._x = 0;
}
}
function moveRight(nPixels) {
this._x += nPixels;
if (this._x>0) {
this._x = -1400;
}
}
nScreenHeight = 500;
function moveDown(nPixels) {
this._y -= nPixels;
if (this._y<-160) {
this._y = -160;
}
}
function moveUp(nPixels) {
this._y += nPixels;
if (this._y>=40) {
this._y = 40;
}
}
}
onClipEvent (enterFrame) {
if (_root._ymouse>=500 || _root._ymouse<=0) {
nMaxRate == 0;
} else {
if (_root._xmouse<nScreenWidth/2 && _root._xmouse>0) {
moveRight(nMaxRate-_root._xmouse*nMaxRate/(nScreenWidth/2));
} else {
if (_root._xmouse>nScreenWidth/2 && _root._xmouse<nScreenWidth) {
moveLeft(_root._xmouse*nMaxRate/(nScreenWidth/2)-nMaxRate);
}
}
}
}
onClipEvent (enterFrame) {
if (_root._ymouse<nScreenHeight/2 && _root._ymouse>0) {
moveUp(nMaxRate-_root._ymouse*nMaxRate/(nScreenHeight/2));
} else {
if (_root._ymouse>nScreenHeight/2 && _root._ymouse<nScreenHeight) {
moveDown(_root._ymouse*nMaxRate/(nScreenHeight/2)-nMaxRate);
updateAfterEvent();
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|