home *** CD-ROM | disk | FTP | other *** search
- class application.screens.ScrollBarScreen extends application.screens.AbstractScreen implements application.models.IScreen
- {
- var instCounter;
- var scrollbar;
- var startPos;
- var startPosPic;
- var scrollProperties;
- var contentMC;
- var listener;
- function ScrollBarScreen()
- {
- super();
- this.instCounter = 1;
- this.scrollbar = null;
- this.startPos = null;
- this.startPosPic = null;
- this.scrollProperties = {};
- this.scrollProperties.content = {};
- this.scrollProperties.scrollBar = {};
- }
- function setContent(contentMC, viewHeight)
- {
- this.contentMC = contentMC;
- this.startPos = contentMC._y;
- this.startPosPic = contentMC.pic._y;
- this.scrollProperties.content.contentHeight = contentMC._height;
- this.scrollProperties.content.viewHeight = viewHeight;
- this.scrollProperties.content.contentToScroll = this.scrollProperties.content.contentHeight - this.scrollProperties.content.viewHeight;
- this.scrollProperties.content.maxScroll = this.scrollProperties.content.contentToScroll;
- this.scrollProperties.scrollBar.height = viewHeight;
- this.build();
- }
- function getContent()
- {
- return this.contentMC;
- }
- function forceContent(contentMC, height, viewHeight)
- {
- this.contentMC = contentMC;
- this.startPos = contentMC._y;
- this.startPosPic = contentMC.pic._y;
- this.scrollProperties.content.contentHeight = height;
- this.scrollProperties.content.viewHeight = viewHeight;
- this.scrollProperties.content.contentToScroll = this.scrollProperties.content.contentHeight - this.scrollProperties.content.viewHeight;
- this.scrollProperties.content.maxScroll = this.scrollProperties.content.contentToScroll;
- this.scrollProperties.scrollBar.height = viewHeight;
- this.build();
- }
- function build()
- {
- if(this.scrollProperties.content.contentHeight > this.scrollProperties.content.viewHeight)
- {
- if(this.scrollbar == null)
- {
- this.listener = new application.listener.ScrollBarScreenListener();
- this.listener.setHolder(this);
- Object.registerClass("scrollBar",components.ui.scrollbar.ScrollBar);
- this.scrollbar = components.ui.scrollbar.ScrollBar(this.attachMovie("scrollBar","scrollbar",this.instCounter++));
- this.scrollbar.setDataProvider(this.scrollProperties);
- this.scrollbar.init();
- this.scrollbar.build();
- this.scrollbar.addListener(this.listener);
- this.scrollbar.moveTo(721,73);
- Mouse.addListener(this.scrollbar);
- }
- else
- {
- this.scrollbar.update();
- }
- }
- else if(this.scrollbar == null)
- {
- this.scrollbar.removeListener(this.listener);
- this.scrollbar.removeMovieClip();
- this.scrollbar = null;
- }
- }
- function onScroll(pos)
- {
- this.contentMC.pic._y = this.startPosPic + pos;
- this.contentMC._y = this.startPos - pos;
- application.core.FocusManager.getInstance().onScroll();
- }
- function scrollTo(pos)
- {
- var _loc2_ = -1 * (this.contentMC._y + pos);
- this.scrollbar.scrollTo(_loc2_);
- }
- function onButtonRollOver(mc)
- {
- }
- function onButtonRollOut(mc)
- {
- }
- function onButtonPress(mc)
- {
- }
- function onButtonRelease(mc)
- {
- }
- function onButtonDisable(mc)
- {
- }
- function onButtonEnable(mc)
- {
- }
- function onUnload()
- {
- Mouse.removeListener(this.scrollbar);
- }
- function onButtonReleaseOutside(mc)
- {
- }
- }
-