Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

MouseOver Scroll in actionscript 3

Guest
Jul 18, 2009 Jul 18, 2009

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!

TOPICS
ActionScript
4.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jul 19, 2009 Jul 19, 2009

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

...
Translate
LEGEND ,
Jul 19, 2009 Jul 19, 2009

What to do you already have for code?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 19, 2009 Jul 19, 2009

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 19, 2009 Jul 19, 2009

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 19, 2009 Jul 19, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 19, 2009 Jul 19, 2009
LATEST

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...

http://www.nedwebs.com/Flash/AS3_scroll_textfield.fla

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines