Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 scroll buttons on one page, only one of them works 1

Status
Not open for further replies.

decibelle

Technical User
Feb 1, 2005
27
US
the problem:
while pressing on a button, the text should scroll down continuously while pressing. the problem is that it only scrolls down one line at a time while pressing, so you have to keep clicking instead of keep on press.

the problem only occurs when there are 2 sets of scroll buttons (first for dynamic text field 1 and second for dynamic text field 2). if there is only one, then it works fine. when there are both sets, only the second one works and the first does not. (i deleted the code for the second set of scroll buttons, and when i do that, the first set now scrolls fine while pressing.)

any clue as to why this is happening? here's the code:

TIA,
decibelle

//SCROLL ARROWS1


up_btn.onPress = function(){
press1 =true;
move1 = -1;
play_text.scroll = play_text.scroll + move1
};


up_btn.onRelease = function (){
press1 = false;
};

down_btn.onPress = function(){
press1 =true;
move1 = 1;
play_text.scroll = play_text.scroll + move1

};

_root.onEnterFrame = function(){
if (press1 ==true){
play_text.scroll = play_text.scroll + move1
}
}

down_btn.onRelease = function (){
pressing = false;
};

//SCROLL ARROWS2

up2_btn.onPress = function(){
pressing2 =true;
movement2 = -1;
play2_text.scroll = play2_text.scroll + movement2
};

up2_btn.onRelease = function (){
pressing2 = false;
};

down2_btn.onPress = function(){
pressing2 =true;
movement2 = 1;
play2_text.scroll = play2_text.scroll + movement2

};

down2_btn.onRelease = function (){
pressing2 = false;
};

_root.onEnterFrame = function(){
if (pressing2 ==true){
play2_text.scroll = play2_text.scroll + movement2
}
}

 
hiya, oldnewbie

do you mind if i emailed it to you? i think i still have your email address from last time *smile*

thanks mucho,
decibelle
 
sorry for the delay. had to step away from my desk. it's on it's way to you now...

thanks so much,
decibelle
 
Should of catched that by looking at your code... But didn't!

Simply because when you define your second _root.onEnterFrame, you're in fact clearing the first one, and replacing it with the second one...

Just combine the 2 in one onEnterFrame... You also had an error on your down_btn's onRelease handler... You had pressing rather than press1...

Code:
...
//SCROLL ARROWS1


up_btn.onPress = function(){
	press1 =true;
	move1 = -1;
	play_text.scroll = play_text.scroll + move1
};

up_btn.onRelease = function (){
	press1 = false;
};

down_btn.onPress = function(){
	press1 =true;
	move1 = 1;
	play_text.scroll = play_text.scroll + move1
	
};

down_btn.onRelease = function (){
	press1 = false;
};

_root.onEnterFrame = function(){
	if (press1 ==true){
		play_text.scroll = play_text.scroll + move1
	}
	if (pressing2 ==true){
		play2_text.scroll = play2_text.scroll + movement2
	}
}

//SCROLL ARROWS2

up2_btn.onPress = function(){
	pressing2 =true;
	movement2 = -1;
	play2_text.scroll = play2_text.scroll + movement2
};

up2_btn.onRelease = function (){
	pressing2 = false;
};

down2_btn.onPress = function(){
	pressing2 =true;
	movement2 = 1;
	play2_text.scroll = play2_text.scroll + movement2
	
};

down2_btn.onRelease = function (){
	pressing2 = false;
};
...

Regards. Web Hosting - Web Design
03/13/05 -> OLDNEWBIE VS FLASHKIT
 
Works great now, thanks so much, Oldnewbie! *smile*

best,
Decibelle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top