simple scroll problems with onMouseDown
ok i used one of the tutorial on here regarding a simple scroll, using two buttons and a box of dynamic text. the code for the buttons is:
on (release) {
scrolltext.scroll += 1;
}
and
on (release) {
scrolltext.scroll -= 1;
}
what i really want to do is be able to use onMouseDown or anything that will let it scroll by holding the button down instead of have to click it repeatadly, any help would be amazing.
Sergei A. Kornev
Here it is:
Attached Files
it let me download it and open it, and i can view the swf but the fla wont open for me. :/ i have no idea why. thanks for the quick help though.
Sergei A. Kornev
what is version of Flash You use ?
mx. im on a mac as well, but even so it hasnt ever been an issue before.
Senior Member
on(press){
onEnterFrame=function(){
scrolltext.scroll += 1;
}
}
try that...or maybe this, as a frame action:
btnInstanceName.onEnterFrame=function(){
this.onPress=function(){
scrolltext.scroll += 1;
}
}
Adam
this is the error i get when using the first code:
Scene=Scene 1, Layer=CONTENT, Frame=15: Line 1: Statement must appear within on handler
btnInstanceName.onEnterFrame=function(){
i thought for sure that would do it, hmph.
Senior Member
You must be using the second code there...to get that error...use that code, but put it on a frame.
**Edit, oh, and you have to give your button an instance name and use that instead of:
btnInstanceName
Adam
haha my fault yes that wa steh second code, and its obvious why it wasnt working. so i used the first code and it works great BUT, when you click it starts scrolling and doesnt stop until it scrolls teh length haha. speed reading style. any idea how to haveit only scroll while its being pressed? thanks a ton.
Senior Member
The second code should work only while the button is pressed.
Adam
i tried the second with this code in the frame actions:
up.onEnterFrame=function(){
this.onPress=function(){
scrolltext.scroll -= 1;
}
}
down.onEnterFrame=function(){
this.onPress=function(){
scrolltext.scroll += 1;
}
}
and i got no movement. im sorry this is such a hassle seems like itd be so simple.
Senior Member
Actually it was my mistake, so don't feel so bad
up.onEnterFrame=function(){
scrolltext.scroll.onPress=function(){
scrolltext.scroll -= 1;
}
}
down.onEnterFrame=function(){
scrolltext.scroll.onPress=function(){
scrolltext.scroll += 1;
}
}
I had "this" in there which was referencing the button and not the text...hope this is better.
Adam
Sergei A. Kornev
Try this.
Attached Files
the latter one works if my text is a movieclip but its a box of dynamic text and doenst want to work. and this one
up.onEnterFrame=function(){
scrolltext.scroll.onPress=function(){
scrolltext.scroll -= 1;
}
}
down.onEnterFrame=function(){
scrolltext.scroll.onPress=function(){
scrolltext.scroll += 1;
}
}
shows up and everything but i get no movement. im going nuts haha.
Senior Member
ok...let scrap the whole thing....lol....try this in your first frame:
code:
onLoad=function(){
_root.scrollUp=false;
_root.scrollDown=false;
}
onEnterFrame=function(){
if (_root.scrollUp==true){
scrolltext.scroll -= 1;
}else if (_root.scrollDown==true){
scrolltext.scroll += 1;
}
}
and on your up button put this:
code:
on(press){
_root.scrollUp=true
}
on(release){
_root.scrollUp=false
}
and this on your down button:
code:
_root.scrollDown=true
}
on(release){
_root.scrollDown=false
}
keeping my fingers crossed on this one.
Adam
with the frame script it says:
Scene=Scene 1, Layer=CONTENT, Frame=15: Line 2: ';' expected
} onEnterFrame =function (){ if (_root .scrollUp== true ){
:/ haha im such a nuisance
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width