Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 01-27-2009, 03:37 PM   #1
klavatar
Lost and Confused
 
Join Date: Jan 2009
Posts: 19
Post [AS3] Best way to implement scrolling functionality?

Hi there,

I was wonder if there is any built-in support in Flash CS4/AS 3.0 for scrolling for basic Display Objects like Sprites and MovieClips?

So I am programatically constructing content inside a MovieClip by dynamically creating instances of Symbols, MovieClips and other native controls such as TextFields and then placing and adding these objects into the Parent MovieClip's DisplayList using addChild(). The height of the displayed data varies based on the source data (loaded from a server, etc).

I wanted to display all this data within a limited size (width, height), which necessitates scrolling when there is a lot of data to display. I tried using a ScrollPane and setting the MovieClip as its source (just like the example in the AS 3.0 documentation - sort of), but instead I get the following error when, presumably, the ScrollPane was being rendered:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.containers::ScrollPane/drawBackground()
at fl.containers::ScrollPane/draw()
at fl.core::UIComponent/callLaterDispatcher()
Cannot display source code at this location.

My code is something like the following:

ActionScript Code:
var ListPane:MovieClip = new MovieClip(); // Add display elements to ListPane ... addChild(ListPane);     // Create a scroll pane var Pane:ScrollPane = new ScrollPane(); Pane.setSize(PaneWidth, PaneHeight); Pane.verticalPageScrollSize = PaneHeight;     // Assign the Sprite as the source for the scroll pane Pane.source = ListPane;    addChild(Pane);

I'd really like to avoid having to implement my own scrollableMovieClip class extension if at all possible, so any help and wisdom will be greatly appreciated!

Thanks,
- K.
klavatar is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[AS3] How to manage large level scrolling platformer baross Gaming and Game Development 5 01-17-2009 04:09 AM
[AS3] Side Scrolling Shooter Firing Problem Lenster921 Gaming and Game Development 0 09-22-2008 06:16 PM
Flash file loses scrolling functionality in IE, Opera wmcel Flash 8 General Questions 1 05-01-2007 12:23 PM
simple scrolling help quovadimus02 ActionScript 1.0 (and below) 2 09-03-2005 09:26 PM
scrolling lists generator object ? spoonyg Server-Side Scripting 0 01-04-2002 03:41 AM


All times are GMT. The time now is 11:29 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.