all groups > flash actionscript > november 2006 >
You're in the

flash actionscript

group:

Slider Jumping


Re: Slider Jumping Jose Guevara
11/17/2006 5:35:35 PM
flash actionscript: First your onClipEvent statements have to be on the movieclips and not on
the timeline (select the movieclip first before to edit the actions, or
check at the bottom of the action window that it's an mc and not a frame).

Then I'm not sure how it is supposed to behave because I don't know if it's
inside an mc or not, and the location of the registration vis a vis of your
_root. However, in moveRight, you are saying, if _x of my mc is greater than
0 go to -700.

That might be the jump...

JG

[quoted text, click to view]

Slider Jumping ich_kann_schnell_laufen
11/17/2006 7:37:01 PM
:mad;
I have a slider that is hopping and i can't figure why. The window is 700px
wide. Here is the AS and the error. Any help would be greatly appreciated.
Thanks.


onClipEvent (load) {
nScreenWidth = 700;
nMaxRate = 15;
// nPixels determines the speed of the slider movement
function moveLeft(nPixels) {
this._x -= nPixels;
if (this._x<0-nScreenWidth) {
this._x = 0;
}
}
function moveRight(nPixels) {
this._x += nPixels;
if (this._x>0) {
this._x = 0-nScreenWidth;
}
}
}
onClipEvent (enterFrame) {
// move slider with speed dependent on mouse position
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);
}
}
}

Error:

Scene=Scene 1, Layer=actions, Frame=2: Line 1: Clip events are permitted only
for movie clip instances
onClipEvent (load) {

Scene=Scene 1, Layer=actions, Frame=2: Line 18: Clip events are permitted only
for movie clip instances
onClipEvent (enterFrame) {

AddThis Social Bookmark Button