
Copy link to clipboard
Copied
hi ppl,
im new to actionscript 3. I have some problems in creating mouseover scroll.
wat i want to do is to scroll the text (which was created as movie clip) when i mouse over on the button. and stop the scrolling when i mouse out.
thou i have some examples on how to make it work with actionscript 1 and 2, i dunno how to change it to actionscript 3.
so can u guys help me pls.
thanks alot in advance!
1 Correct answer
There are a few ways you could approach this, so here's one. All code goes in the timeline where the buttons live (on the actions layer).
The only thing I am uncertain of is what I did with the scrollV in the scrollUp and scrollDown functions. I have not used this before, so I am assuming it is the same property that AS2 uses "scroll" for.
function scrollUp(evt:Event):void {
textbox.scrollV += 1;
}
function scrollDown(evt:Event):void {
textbox.scrollV -= 1;
}
function upOver(evt:MouseEvent):void
...Copy link to clipboard
Copied
What to do you already have for code?

Copy link to clipboard
Copied
Hi ned murphy,
thanks for ur reply.
i only have codes which are in as 1.0 and 2.0.
the code below is under actions: Frame1...
moveup = new Boolean();
movedown = new Boolean();
up_btn.onRollOver = function() {
moveup = true;
};
down_btn.onRollOver = function() {
movedown = true;
};
up_btn.onRollOut = function() {
moveup = false;
};
down_btn.onRollOut = function() {
movedown = false;
};
this is the codes under text box movie clip..
onClipEvent (enterFrame) {
if (_root.moveup == true) {
textbox.scroll += 1;
}
if (_root.movedown == true) {
textbox.scroll -= 1;
}
}
but i dunno how to change them to as3.
thanks murphy!
Copy link to clipboard
Copied
There are a few ways you could approach this, so here's one. All code goes in the timeline where the buttons live (on the actions layer).
The only thing I am uncertain of is what I did with the scrollV in the scrollUp and scrollDown functions. I have not used this before, so I am assuming it is the same property that AS2 uses "scroll" for.
function scrollUp(evt:Event):void {
textbox.scrollV += 1;
}
function scrollDown(evt:Event):void {
textbox.scrollV -= 1;
}
function upOver(evt:MouseEvent):void {
stage.addEventListener(Event.ENTER_FRAME, scrollUp);
}
up_btn.addEventListener(MouseEvent.ROLL_OVER, upOver);
function upOut(evt:MouseEvent):void {
stage.removeEventListener(Event.ENTER_FRAME, scrollUp);
}
up_btn.addEventListener(MouseEvent.ROLL_OUT, upOut);
function downOver(evt:MouseEvent):void {
stage.addEventListener(Event.ENTER_FRAME, scrollDown);
}
down_btn.addEventListener(MouseEvent.ROLL_OVER, downOver);
function downOut(evt:MouseEvent):void {
stage.removeEventListener(Event.ENTER_FRAME, scrollDown);
}
down_btn.addEventListener(MouseEvent.ROLL_OUT, downOut);

Copy link to clipboard
Copied
Hi Murphy,
when i test the code, it doesn't show any error or output. and it also not working. (practically it doesn't do anything)
thanks for ur effort thou.
Copy link to clipboard
Copied
You probably don't have everything properly named or something. The code will work just fine as long as you have the instance names assigned, the publish settings set for AS3, and sufficient text assigned to the textfield to require scrolling.
Here is an example if you still don't know how to get it working...

