Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-14-2008, 04:39 PM   #1
overbyte
more bytes than sense
 
overbyte's Avatar
 
Join Date: Nov 2005
Posts: 66
Red face Assign ScrollBar Class to Sprite

I know i'm missing something really obvious but is there a method to assign a ScrollBar to a Sprite?

I have a movie that builds a base sprite and then adds the timeline with titles, eras, and points and i want the scrollbar class to scroll that but i cannot find a way of marrying the timeline area and the scrollbar up.

here is my main class (with the inert scrollbar)

ActionScript Code:
package com.receptacle.timeline {     //package imports     import flash.display.Sprite;     import flash.display.Shape;     import flash.display.StageDisplayState;     import flash.display.StageScaleMode;     import fl.controls.ScrollBar;     import fl.controls.ScrollBarDirection;         public class TimelineApp extends Sprite     {         // class variable declarations         private var base:Sprite;         private var timelineArea:TimelineArea                 // constructor         public function TimelineApp()         {             setVars();             setFullscreen();             addBaseSprite();             initialiseBackgroundElements();             initialiseMainTimeline();             initialiseEventNavigation();             initialiseTimelineScrollBar();         }                 private function setVars()         {             base = new Sprite()         }                 private function addBaseSprite():void         {             addChild(base);         }                 private function setFullscreen():void         {             trace ("Fullscreen");             stage.displayState  = StageDisplayState.FULL_SCREEN;             stage.scaleMode  = StageScaleMode.NO_SCALE;         }                 private function initialiseBackgroundElements():void         {             trace ("Background elements initialised");             var backgroundElements:BackgroundElements = new BackgroundElements();             base.addChild(backgroundElements);         }                 private function initialiseMainTimeline():void         {             trace ("Main Timeline initialised");             timelineArea = new TimelineArea();             base.addChild(timelineArea);                         // mask             var cp:CommonProperties = new CommonProperties();             var taPanelY:uint      = cp.taTitleBarY;             var taPanelHeight:uint  = cp.taTitleBarHeight + cp.taPanelHeight;             var taMask:Shape = new Shape();             taMask.graphics.beginFill(0xFF0000);             taMask.graphics.drawRect(0, taPanelY, 800, taPanelHeight);             base.addChild(taMask);             timelineArea.mask = taMask;         }                 private function initialiseEventNavigation():void         {             trace ("Event navigation initialised");         }                 private function initialiseTimelineScrollBar():void         {             trace ("Timeline scrollbar initialised");                         var scrollBar:ScrollBar = new ScrollBar();             scrollBar.direction  = ScrollBarDirection.HORIZONTAL;             scrollBar.x    = 10;             scrollBar.y    = 550;             scrollBar.setSize(280, 40);             addChild(scrollBar);                                 }     } }

i'm sure it's something really blatant but i got nothin'
overbyte is offline   Reply With Quote
Old 03-15-2008, 03:42 PM   #2
overbyte
more bytes than sense
 
overbyte's Avatar
 
Join Date: Nov 2005
Posts: 66
Default

i've amended the code slightly which makes it react to the scrolling sprite (timelineArea) but it still doesn't actually scroll it along

amended code
ActionScript Code:
private function initialiseTimelineScrollBar():void         {             trace ("Timeline scrollbar initialised");             var cp:CommonProperties = new CommonProperties();             var taPanelY:uint = cp.taTitleBarY;             var taPanelHeight:uint  = cp.taTitleBarHeight + cp.taPanelHeight;                         var scrollBar:ScrollBar = new ScrollBar();             scrollBar.direction = ScrollBarDirection.HORIZONTAL;             scrollBar.x = 10;             scrollBar.y = 550;             scrollBar.setSize(280, 40);             scrollBar.maxScrollPosition = timelineArea.width;             scrollBar.minScrollPosition = 0;             scrollBar.pageScrollSize = 20;             scrollBar.pageSize = stage.width;             addChild(scrollBar);         }     }

hope you guys can help
overbyte is offline   Reply With Quote
Old 03-17-2008, 10:31 AM   #3
overbyte
more bytes than sense
 
overbyte's Avatar
 
Join Date: Nov 2005
Posts: 66
Default

noone?
overbyte is offline   Reply With Quote
Old 07-29-2008, 06:11 PM   #4
elnoctis
Registered User
 
Join Date: Jul 2008
Posts: 1
Default

Hi... I have the same problem, so I wonder if you could tell me what was wrong in your code.

I guess you need to declare scroll is targeting base sprite, don't you?
elnoctis 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
Using the mx.util.Delegate class within your classes! madgett ActionScript 2.0 3 09-02-2007 11:11 PM
AS3 F9 - How to have main class path without carring around instance refer? FLXERmaster ActionScript 3.0 3 01-07-2007 11:17 PM
quick question - assign class to multiple objects calipoop ActionScript 2.0 2 11-08-2006 01:02 AM
How can I implement a two-way relationship between classes in AS 2.0? MHH ActionScript 2.0 5 10-13-2004 04:35 PM
card game: designing Deck class and good OOP? pigpen Gaming and Game Development 1 11-26-2002 11:41 AM


All times are GMT. The time now is 09:07 PM.

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