Skip to main content
Known Participant
March 18, 2010
Question

Externally a Scroll Pane

  • March 18, 2010
  • 2 replies
  • 1064 views

Im trying to figure out if there is a way to manually scroll a scrollpane externally in flash. i have the scrollpane loading a long page of text and then have links to various parts in the text. for now i tried to change the y position of the movieclip being loaded but it just cuts off the top portion. is there a method to make it scroll to a certain spot? thanks

This topic has been closed for replies.

2 replies

Known Participant
March 19, 2010

i did some research on the topic and here is my code

hitArea_mc.aShape_mc.addEventListener(MouseEvent.CLICK, scrollA);
function scrollA(event:MouseEvent):void
{
     root.border_mc.hardwareWindow.verticalScrollPosition = 5;
}

the error im getting is

1119: Access of possibly undefined property border_mc through a reference with static type flash.display:DisplayObject.

the panel with hitArea_mc and aShape_mc is nested several layers down and loaded into a different empty frame. should i be referring to the ScrollPane from stage or root?

kglad
Community Expert
Community Expert
March 19, 2010

use:


hitArea_mc.aShape_mc.addEventListener(MouseEvent.CLICK, scrollA);
function scrollA(event:MouseEvent):void
{
     MovieClip(root).border_mc.hardwareWindow.verticalScrollPosition = 5;
}


Known Participant
March 19, 2010

TypeError: Error #1010: A term is undefined and has no properties.
    at tableContents/scrollA()

so let me explain how im doing this. once i see it in writing i might be able to understand it better. on the stage there is the 5 buttons and a border_mc. when clicked on the buttons it loads a child into the border_mc which is just a masked layer. the childs that are loaded are all ScrollPane that are referencing another swf that has all of the info on it.

on the stage i made another movieclip called border2_mc and i have the tableContents bar (which is just a bar of letters)  loaded as a child when a button is pressed. the reason i did this was so the menu bar would be visible. so the idea is have the child of border2_mc set the verticalScrollPosition of the child of border_mc. here is an example of the swf. the external data is not loaded but the bar is, just so you can visualize it.

http://megaswf.com/view/9089234c648c18cbc98a90647eae66b8.html

it gives errors when you click on a button but just continue and you can see the tableContents movieclip.

kglad
Community Expert
Community Expert
March 18, 2010

the scrollpane class has a verticalScrollPosition (as well as a horizontalScrollPosition) property that you can use.