View Full Version : nav that remembers
gonda
10-01-2003, 11:46 AM
Hi,
I think there's a simple answer to this, but I can't find it. How can I make actionscript remember something?
For example :
I have a navigation that works really simple, with labels along the timeline :
onRollOver = function () {
gotoAndPlay("over");
}
onRollOut = function () {
gotoAndPlay("out");
}
onRelease = function () {
gotoAndPlay("press");
}
Whenever I press my button(which is a MC), and I don't keep my mouse on it, the timeline jumps to "out" again. Fair enough I guess, cause that's what I say in the script, but how can I change that?
I just want my MC to stay on "press" when I clicked it.
I think when I know how to do that I can also make actionscript remember what MC was clicked and then remove it whenever I click another MC ... no?
If you only have the slightest idea ... reply me plz!
;)
sandman9
10-01-2003, 02:58 PM
Are you targeting _root? ..... Are you saying gotoandStop instad of gotoandPlay?
How about if after the onRollOut fuction you added a If statement saying If mouse is not pressed then "gotoAndPlay("Out"); ..... I'm sure there is a command for it, maybe onesome can help us out with what that command is?
Unless it's as simple as "on roll out, if MouseUP, go to and play ....."
Don't know if this is write for I just made it up off the top of my head but you get the idea
onRollOut = function () {
if (MouseUp){
gotoAndPlay("out");
}
}
Sandman9
webguy
10-01-2003, 04:19 PM
use a variable reference to the clip.
// function to remove clip referenced by the variable clipToRemove
function remove() {
clipToRemove._visible = false;
}
this.onRelease = function () {
// when this btn is clicked go to and Play Skippy
gotoAndPlay("Skippy");
// then invoke our function to remove our referenced clip
remove();
// then assign this clip to the variable
// clipToRemove so when the next clip is
// clicked this clip will be removed, as long as
// it has a remove() call in it
_global.clipToRemove = this;
}
webG
gonda
10-02-2003, 07:11 AM
Thx for ur help already, but I'm not quite there yet ... :(
I also think my second question was wrong formulated. What I mean is :
I have 2 buttons that are made up the exact same way (with the labels and the script that I copied in my first message) and are both MC's. On a MoveOver they change color and grow a little. onRelease they should stay in a darker color.
When I press one of them another swf opens next to it with some content.
Now my problem is that all of this works. But not as I want it to :)
I want my MC to stay on the label "press" when pressed and also when I move my mouse away (now the onMoveOut action makes that impossible)... untill!! I press my second button. Then the first button had to go to label "out" again.
This is just to help my viewers so that they know what section they are in when they pressed an MC in the navigation. (the pressed button has a darker color)
Is that clearer?? Or am I to confusing? :D
webguy
10-02-2003, 10:36 AM
check out the file btntest.zip in this thread. Might help you out.
http://www.actionscript.org/forums/showthread.php3?s=&threadid=35055&highlight=button
web
JEBoothjr
10-02-2003, 11:08 AM
There is also something similar in this thread:
http://www.actionscript.org/forums/showthread.php3?s=&threadid=31734
with a zip file to look at.
gonda
10-02-2003, 12:17 PM
Thank you for the links! :D
One of the zips of webguy helped me out ... although again I'm stuck. I guess I'm almost there ... that's why I'll post my fla here so you understand what I mean.
If you click a button and then click another you'll understand what's still going wrong.
I hope ... :rolleyes:
webguy
10-02-2003, 12:20 PM
if(prevClip != this) {
prevClip.enabled = true;
prevClip.gotoAndPlay("out"); // just add this
prevClip("press");
_global.prevClip = this;
}
was that the problem?
web
gonda
10-02-2003, 12:27 PM
PERFECT :D
Thank you soooo much !!!
webguy
10-02-2003, 12:44 PM
welcome :p
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.