liam
April 10, 2003, 3:35am
1
im drawing a total blank here, and i can’t think straight. what i have on my movie is a little hand, and when the user drags the hand up and down, a corresponding movie clip goes to frame 2 in response to the _y position of the hand movie clip.
what i can’t figure out is how to tell flash in my if condition that i want this to occur when the _y position is between two values. how can i do this without writing a whole bunch of if/else/else if statements? what is the operator?
thanks in advance for any help!
system
April 10, 2003, 3:43am
2
if(mc._y> 15 && mc._Y <17){
trace(“it works”);
}
system
April 10, 2003, 3:45am
3
thanks man i tried something like that before but i’m so handicapped i couldn’t get it to work! :!:
system
April 10, 2003, 4:21am
5
haha k, i got it to work when you drag the hand past one clip, but when i try to make it work when dragging it up and down past multiple things, it wont work, only one mc will go to the frame desired… i tried using variables to solve this, but it won’t help.
here is the code i tried:
[AS]/////////////////////////////
// begin reveal properties//
///////////////////////////
onClipEvent (enterFrame) {
about = this._y>294 && this._y<314;
portfolio = this._y>255 && this._y<275;
downloads = this._y>217 && this._y<237;
contact = this._y>179 && this._y<199;
// for about
if(about){
_root.navButtons_mc.gotoAndPlay(2);
}else{
about = undefined;
_root.navButtons_mc.gotoAndPlay(1);
}
// for portfolio
if(portfolio){
_root.navButtons_mc.gotoAndPlay(3);
}else{
portfolio = undefined;
_root.navButtons_mc.gotoAndPlay(1);
}
// for downloads
if(downloads){
_root.navButtons_mc.gotoAndPlay(4);
}else{
downloads = undefined;
_root.navButtons_mc.gotoAndPlay(1);
}
// for contact
if(contact){
_root.navButtons_mc.gotoAndPlay(5);
}else{
contact = undefined;
_root.navButtons_mc.gotoAndPlay(1);
}
}[/AS]
This might be way out of line, but i thought it MIGHT work… lol… thanks for any help!
system
April 10, 2003, 4:38am
6
that wont work. The if statement can use the && , but you cant assign it the way you tried to assign in enterframe.
Im seeing triple right now. If no one has helped you by morning, I’ll give it a go…
system
April 10, 2003, 2:33pm
9
Hey Liam… can you post your fla? It will save me some reconstructing time.
thanks.
system
April 10, 2003, 11:31pm
11
k now i got it working for 2 rollovers, but it still doesnt work how i want it too!! haha well if you have a look at that .fla i hope it helps!
system
April 11, 2003, 4:25pm
13
liam… I looked at your code and Im having some trouble understanding it.
so, I changed the name of the hand movie clip to “hand” and of the navigation buttons to “nav”.
I deleted your code and I put the following on the main timeline.
alwaysx=hand._x;
hand.onPress=function(){
this.startdrag();
this.onenterframe=function(){
mybox.text=this._x;
if(this._x>_root.alwaysx || this._x<_root.alwaysx){
this._x=_root.alwaysx;
}
if(this._y>292 && this._y <316){
nav.gotoandstop(2);
}else if(this._y>257 && this._y <276){
nav.gotoandstop(3);
}else if(this._y>217 && this._y <238){
nav.gotoandstop(4);
}
}
}
hand.onRelease=function(){
this.stopdrag();
}
Now, this may not be the cleanest and hasnt gone through extensive testing… but I think it reflects what you’re trying to do.
Have a great day.
system
April 11, 2003, 6:39pm
14
montoya -
thanks alot, it works perfectly! thanks for all your help. :P:P