**** 2 Simple questions ****

Question 1

on (press, release) {
button1.onRelease = function() {
_root.gotoAndPlay(“scene 2”, 1);
};
}

I have the _root with a sliding menu. In the sliding menu I have buttons. I want the buttons to change scenes, however the buttons only seem to function as long as my request is in within the same scene.

ex:
gotoAndPlay(“frame 10”);

Do you mean the buttons in your sliding menu don’t work, or they buttons in a different scene?

Your code should either have the first or the second line, you should take one out because one of them goes on a keyframe and the other inside button1.

Question 2

onClipEvent (load) {
xcenter = 250;
speed = 1/10;

lowX = _root.box._x;;
highX = lowX - (this._width - _root.box._width);}

onClipEvent (enterFrame) {

var distance = _root._xmouse - xcenter;
_x += ( distance*speed );

if (this._x >= lowX) {
	this._x = lowX;} 
else if (this._x<=highX) {
	this._x = highX;}

}

How can I get the sliding menu only to function only when the mouse is over it ?

I have tried a number of variations of hittest but couldn’t get none to work.


if
(hitTest( _root.slide_xmouse, _root.slide_ymouse, false) &&
this._x >= lowX) {
this._x = lowX;}

else if (this._x<=highX) {
this._x = highX;}


There are 2 ways, an easy way would be to put invisible buttons over them, one on each side. And do on(rollover) blah blah blah. But theres another way without doin that…

on (press, release) {
button1.onRelease = function() {
gotoAndPlay(“scene 2”, 1);
};
}

This is the script I am using for my buttons on the main time line. I have a sliding menu with more buttons on it, but they dont work.

Say I have scene 1, 2, 3, 4, 5,

on “scene 1”, I have a button to go to “scene 2”,
on “scene 2”, I have a sliding menu.

When the sliding menu is double clicked on it becomes
“scene 2”, “menu”.

it is on this “menu” layer that I have more buttons, the buttons will jump to different frames on that “menu” layer, but I canot get them to go to “scene 3”.

I thought it might have something to do with _root _parent but I couldn’t get either to make a difference.

You can’t tell the buttons to go to layers, you just have to directly tell it to go to a frame. I’m not too sure what you want to do…

Oh yea, your code should be:

[AS]
on (press) {
gotoAndPlay (“scene 2”, 1)
}
[/AS]

you shouldn’t have the other line under it (this is if the code is placed inside the button). You also don’t need both press and release because if you do one, you must do the other…

onClipEvent (load) {
xcenter = 250;
speed = 1/10;

lowX = _root.box._x;;
highX = lowX - (this._width - _root.box._width);}

onClipEvent (enterFrame) {

var distance = _root._xmouse - xcenter;
_x -= ( distance*speed );

button1.onRollOver = function() {
if (this._x >= lowX) {
this._x = lowX;}
else if (this._x<=highX) {
this._x = highX;}


}
}

Sorry I dont know if this is what you meant, Create invisible button over the menu, then do a mouse over ?

this or any other code I have tried stop the menu from working properly. It just slides off the screen.

This is what ilyas made for me ages ago like last year :slight_smile:

[AS]
midScreen=Stage.width/2;
speed=5;
scroller.onRollOver=function(){
this.onEnterFrame=function(){
if (_xmouse>midScreen) this._x += speed;
else this._x -= speed;
if (this._x>0) {
this._x = -300;
}
if (this._x<-300) {
this._x = 0;
}
}
}
scroller.onRollOut=function(){
delete this.onEnterFrame;
}
[/AS]

You don’t need any other code, just place that inside the sliding thing (with the instance named scrollbar). I havnt’ looked at your fla but i’m guessing you didn’t tell it to go back to its original position once it slides off the screen.

on (press, release) {
button1.onRelease = function() {
gotoAndPlay);
};
}

I did it this way because I found that sometimes I would have to click on a button twice, I wasn’t sure why and doing it that way solved the problem.

on (press) {
gotoAndPlay (“scene 2”, 1)
}

nope lostinbeta helped me with the sliding menu a few months ago.

it has 2 parts.

A box (mask)

and the sliding menu.

the sliding menu looks at the size of the box so it knows where its edges are and when to stop.

yea…thats what mine does. Isn’t that what you wanted?

Thanks for this

scroller.onRollOver=function(){

I will give it a go…