Scroll... Without A Scrollbar
Hi,
I was wondering if anyone knew of a way that you could scroll text by moving your mouse up and down the text?
Cheers g'luk
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 03-25-2006, 07:42 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Scrollbar Wouldn't Scroll
Hi,
I created a scrollbar for my text field but it's not working. The text is not scrolling. Can someone tell me what i'm doing wrong???
This is what i did:
I created two MC, downtrigger and uptrigger. In each MC i have three frames:
in downtrigger MC i put:
frame#1:
stop();
frame #2:
/text:scroll = Number(/text:scroll)+1;
frame#3:
gotoAndPlay (2);
uptrigger MC:
frame #1:
stop();
frame#2:
/text:scroll = /text:scroll-1;
frame #3:
gotoAndPlay (2);
Then on then scrolling buttons I have:
on (press) {
tellTarget ("uptrigger") {
gotoAndPlay (2);
}
}
on (release) {
tellTarget ("uptrigger") {
gotoAndStop (1);
}
}
samething for the downtrigger MC (but different target). Then I placed these two MC on the stage...
I don't know what i'm doing wrong.
Any help would be apreciated.
Anh
Scrollbar Wont Scroll
Scroll bar wont scroll if it is in the first frame, once i put it on a different layer and in frame 2 (textbox in frame 1) it scrolls but the ani loops, then if i put a stop action in, it doesnt scroll anymore, i would greatly appreciate it sum1 could help.
ScrollBar used is one provided by FlashMX
Add Scroll Buttons To Scrollbar.
I attached the movie clip. This is part of my site, it is a scrolling box with content. The scrolling works fine, but to scroll you have to click and hold the scroll bar and drag it. I want to add buttons to the top and bottom so you can just clickt hem (just like a normal html site). Thanks to anyone who could give me doce or anything. I've also posted the code below, so you dont need to download the file unless you need to.
Code:
// Jake Gelbman 11.14.01 slider script
// email: allforjake@yahoo.com
// site: allforjake.cjb.net
// ok here is the load event handler
// diff_y is the total amount that the scrollbar can movethe bound_box is a movie clip that surrounds everything. its just a clear box
// next line we set bounds to the bounding area of the bound_box clip getBounds() returns 4 variable yMin yMax xMin & xMax they are the bounding area that well use for a lot of stuff
// top is the highest amount the scrollbar can go
// bottom is the lowest
// updateScrollbar() is the function for setting the content clip to the right spot
// "scroller._y - top/diff_y" is a percent of the scroll bar's position we multiply it by the amount we can scroll of the content
// friction is how much the scrollbar should slow down by after throwing it
onClipEvent (load) {
diff_y = bound_box._height-scroller._height;
bounds = bound_box.getBounds(this);
top = bounds.yMin+(scroller._height/2);
bottom = bounds.yMax-(scroller._height/2);
function updateScrollbar() {
content._y = -(((scroller._y-top)/diff_y)*(content._height-bound_box._height));
}
friction = 0.90;
}
// this detects if you clicked on the scroller it starts a drag with the scroller to be from the "top" which we defined earlier to the "bottom"
// we then set scrolling to true
onClipEvent (mouseDown) {
if (scroller.hitTest(_root._xmouse, _root._ymouse)) {
startDrag("scroller", false, scroller._x, top, scroller._x, bottom);
scrolling = true;
}
}
// here we stop the drag and set scrolling to false
onClipEvent (mouseUp) {
stopDrag();
scrolling = false;
startDrag("_root.cursor", true);
}
// every frame it sees if your scrolling then it updates the scrollbar to the right place based on the y position of the scroller
// it also calculates the speed of your scrolling
onClipEvent (enterFrame) {
if (scrolling) {
updateScrollbar();
newY = scroller._y;
yspeed = (newY-oldY)*0.50;
oldY = newY;
done = false;
} else if (!done) {
// here it adds the speed to the y position of the scroller
// then it asks if the speed is at a number that you can see it moving if it is then it decreases the speed by multiplying it by a decimal
oldypos = scroller._y;
newypos = oldypos+yspeed;
if (yspeed<-0.2 || yspeed>0.2) {
yspeed *= friction;
} else {
yspeed = 0;
done = true;
}
// the next two if statements test if it hit the top or bottom if it had it makes the speed negative to what it is so itll change its direction - neat bounce effect to it
if (newypos<top) {
yspeed = -1*yspeed*friction;
newypos = top;
}
if (newypos>bottom) {
yspeed = -1*yspeed*friction;
newypos = bottom;
}
// here we set the scrollers y position to newyposition (the variable we are adding the speed to)
// it then sets the mc to whereever the scroller is
// then its going to keep on doing this enterFrame business untill speed has reduced itself to 0
scroller._y = newypos;
updateScrollbar();
}
}
Scrollbar Won't Scroll Text.
I followed a nice scrollbar tutorial here on Flashkit, and everything works- the buttons and whatnot- except the scrollbar itself. I can click and drag it just fine, but the arrows won't move it up and down, and the text doesn't scroll with the bar.
My code is posted below; I'm hoping someone can point out what is wrong.
I starred out what I think are the important bits.
Code:
onClipEvent (load) {
//Text in scroll box.
whoText = "<TEXTFORMAT LEADING="2"><P ALIGN="LEFT">
<FONT FACE="Georgia" SIZE="18" COLOR="#EDDABB">
Title Here</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2">
<P ALIGN="LEFT"><FONT FACE="Georgia" SIZE="12" COLOR="#EDDABB">Lots of text here.
</FONT></P></TEXTFORMAT>";
scrolling = 0;
frameCounter = 1;
speedFactor = 2;
numLines = 20;
origHeight = scrollbar._height;
origX = scrollbar._x;
function initScrollbar() {
var totalLines = numLines+whoText.maxscroll-1;
scrollbar._yscale = 100*(numLines)/totalLines;
deltaHeight = origHeight-scrollbar._height;
lineHeight = deltaHeight/(whoText.maxScroll-1);
}
function updateScrollBarPos() {
scrollbar._y = lineHeight*(whoText.scroll-1);
}
}
onClipEvent (enterFrame) {
//if (whoText.maxscroll>1) {
initScrollbar();
//}
if (frameCounter%speedFactor == 0) {
if (scrolling == "up" && whoText.scroll>1) {
whoText.scroll--;
updateScrollBarPos();
} else if (scrolling == "down" && whoText.scroll<whoText.maxscroll) {
whoText.scroll++;
updateScrollBarPos();
}
frameCounter = 0;
}
frameCounter++;
}
onClipEvent (mouseDown) {
if (up.hitTest(_root._xmouse, _root._ymouse)) {
scrolling = "up";
frameCounter = speedFactor;
up.gotoAndStop(2);
}
if (down.hitTest(_root._xmouse, _root._ymouse)) {
scrolling = "down";
frameCounter = speedFactor;
down.gotoAndStop(2);
}
//**********
if (scrollbar.hitTest(_root._xmouse, _root._ymouse)) {
scrollbar.startDrag(0, origX, deltaHeight, origX);
scrolling = "scrollbar";
}
updateAfterEvent();
}
//**********
onClipEvent (mouseUp) {
scrolling = 0;
up.gotoAndStop(1);
down.gotoAndStop(1);
stopDrag();
updateAfterEvent();
}
//**********
onClipEvent (mouseMove) {
if (scrolling == "scrollbar") {
whoText.scroll = Math.round((scrollbar._y)/lineHeight+1);
}
updateAfterEvent();
}
//**********
Scrollbar Unable To Scroll
I've create a same scrollbar in flashkit tutorial and trying to put in my website but it unable to scroll. Is the action script correct?
onClipEvent (load) {
txtbox = "<P ALIGN="LEFT"><FONT FACE="Arial" SIZE="12" COLOR="#FFFFFF">First of all, ....</B></FONT></P>";
scrolling = 0;
frameCounter = 1;
speedFactor = 3;
}
onClipEvent (enterFrame) {
if (frameCounter%speedFactor == 0) {
if (scrolling == "up" && txtbox.scroll>1) {
txtbox.scroll--;
} else if (scrolling == "down" && txtbox.scroll<txtbox.maxscroll) {
txtbox.scroll++;
}
frameCounter = 0;
}
frameCounter++;
}
Scrollbar Lock2pixel On Scroll?
Hi all,
I'm having a problem getting dynamic text in a scrolling movie clip to scroll properly. Because the movie clip scrolls through all points of a pixel ie. 1, 1.1, 1.2 it appears blurred at points.
Is there a way to keep the scroll locking to pixels with this scroll bar?
The text is in a button which is in a movieClip which is attached to the swf when needed according to the file refernces in the XML file, into another main movieClip. It will all become clear if you download the files and have a look.
If you can get another scrolling movie clip to work it would be great if you could post it up.
You will find the FLA,SWF and XML file at www.buildrebuild.com
Thx for your help on this one. It's been frying my brain for a week now.
Best
BRb
Scroll Menu Without Scrollbar
Hi there,
I have now been trying to create a scroll menu for my flash page for about two days and I don't seem to find a way to solve my problem.
I have to create the scroll menu without a scrollbar.
Inside the menu there have to be a big number of buttons.
Can someone tell me how to create a movie as a menu inside my presentation?
Any help would be appreciated,
busche
How To Scroll A Wide MC Using A Scrollbar & Buttons Too
Can anyone point me to a tutorial that can teach me how to place an mc on the stage and be abl eto scroll it using a dragable bar and also buttons if the user chooser they prefer...?
Manythanks...I seem to be able to find tutorials for one or the other, and due to the way each is achieved, its impossible to combine methods...
thanks in advance
Cheska
Scrollbar - How To Edit Scroll Height?
Hi,
I've created a movie with a scroll area for text. Upon publishin the movie, the bottom few lines of the text is not displaying. The length of the scrollbar seems to be pre-set, can anyone pls advice on where goes wrong here? Tx.
Getting The Scrollbar To Continue To Scroll On MouseDown
Ok, i'm brand new to flash, and i'm stuck.
I was starting a flash version to my existing website, and i have the text files loaded, and made controls to scroll up and down in the text.
My problem is that i can't figure out how to make it KEEP scrolling when the user HOLDS the mouse down; becase let's face it - how often does anyone ever go one-line-at-a-time? It's aggrevating.
I'm going to include my source code, and hope that someone can see what i tried to do, and maybe edit it and attach it with a post, that way i can see what i kept overlooking.
The code is very small, so it shouldn't be any trouble for anyone...
Thanks in advance for anyone who can help.
Endless Scroll With Scrollbar: How Can I Set Min & Max Positions?
Hello,
I have a scrollbar that is scrolling a textbox with XML data. The scrollbar works fine, except that it continues to scroll even after the data has left the screen. I'd like it to stop scrolling at a certain point, preferably at the bottom of the last item! Can you help?
The code I have on the scrollbar is:
Up Arrow:
Code:
onClipEvent (enterFrame) {
if (scrolling) {
_level0.player.menuRise.mc.playlist_mc.target_mc._y +=3;
}
}
Down Arrow:
Code:
onClipEvent (enterFrame) {
if (scrolling) {
_level0.player.menuRise.mc.playlist_mc.target_mc._y -=3;
}
}
I'll attach a copy of my scrollbar file, so you can see what is happening. I've asked another person about this, who suggested that I set min and max positions. I've never done this before? Can you help?
Skinning The Scrollbar And Scroll Bar Area
hi there! 2 questions.. firstly i just wanted to know if its possible to define an area like a text box... but where u can put text and images together so it can be scrolled up and down? (i am wanting to do like a timeline with pics and words on the side of the dates... so the user can scroll up and down and look)
Secondly! what is the easiest way to skin the premade scrollbar? i wanted basically just the 2 boxes with the triangles in it but with no middle bit.. ive tried just deleting it out of the library (The middle part) but the whole thing dissapears!
thanks heaps
Skinning The Scrollbar And Scroll Bar Area
hi there! 2 questions.. firstly i just wanted to know if its possible to define an area like a text box... but where u can put text and images together so it can be scrolled up and down? (i am wanting to do like a timeline with pics and words on the side of the dates... so the user can scroll up and down and look)
Secondly! what is the easiest way to skin the premade scrollbar? i wanted basically just the 2 boxes with the triangles in it but with no middle bit.. ive tried just deleting it out of the library (The middle part) but the whole thing dissapears!
thanks heaps
Scrollbar - Textfield.scroll Problem
Scrollbar - Textfield.scroll Problem
Flash Scrollbar
I'm trying to do a scrollbar in FlashMX
I'm using the following vars:
xpos = initial x position of the drag
ypos = initial y position of the drag
ruler = scroll Height area
ms = maxscroll of the textbox
In the clip of drag I've got:
onClipEvent(enterFrame){
if(scrolling){
this.startDrag(false,xpos,ypos,xpos,ruler);
_parent.txt.scroll = I NEED THIS VALUE
}else{
this.stopDrag();
}
}
onClipEvent(load){
xpos = this._x;
ypos = this._y;
ruler = 39;
dragH = this._height;
ms = _parent.txt.maxscroll;
}
I need to find out the value to scroll the text content.
If someone could help me....
THANKS
fe_address!!!
Scrollbar - Textfield.scroll Problem
Flash Scrollbar
I'm trying to do a scrollbar in FlashMX
I'm using the following vars:
xpos = initial x position of the drag
ypos = initial y position of the drag
ruler = scroll Height area
ms = maxscroll of the textbox
In the clip of drag I've got:
onClipEvent(enterFrame){
if(scrolling){
this.startDrag(false,xpos,ypos,xpos,ruler);
_parent.txt.scroll = I NEED THIS VALUE
}else{
this.stopDrag();
}
}
onClipEvent(load){
xpos = this._x;
ypos = this._y;
ruler = 39;
dragH = this._height;
ms = _parent.txt.maxscroll;
}
I need to find out the value to scroll the text content.
If someone could help me....
THANKS
fe_address!!!
ScrollBar Dosn't Scroll After Reload
hey everyone,
EDIT: I changed Devonairs example a bit to reproduce my problem and make the whole thing a bit more understandable.
I used Devonairs FullScreen Scroller Class http://www.gotoandlearnforum.com/viewtopic.php?f=12&t=11845&p=80940&hilit=scrollbar+class#p80940 to create my scroller.
In Devonairs example I put a Sprite, when you click on it the whole think is reloaded but the content is not scrolled:
Code:
package {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import com.onebyonedesign.utils.OBO_FullScrollBar;
import com.onebyonedesign.utils.events.ScrollBarEvent;
import flash.events.MouseEvent;
public class ScrollExample extends Sprite {
private var _scrollContent:ScrollContent;
private var _myScrollBar:OBO_FullScrollBar;
public function ScrollExample() {
initStage();
var t:Sprite = new Sprite();
t.graphics.beginFill(0xff0000, 1);
t.graphics.drawRect(10, 10, 20, 30);
t.addEventListener(MouseEvent.CLICK, onClick);
addChild(t);
}
private function onClick(e:MouseEvent):void {
_scrollContent = new ScrollContent();
addChild(_scrollContent);
_myScrollBar = OBO_FullScrollBar.createScrollBar(0x000000, 0x999999, _scrollContent, 5, OBO_FullScrollBar.RIGHT, true);
_myScrollBar.addEventListener(ScrollBarEvent.SCROLL_DOWN, downListener);
_myScrollBar.addEventListener(ScrollBarEvent.SCROLL_UP, upListener);
addChild(_myScrollBar);
stageListener();
}
private function downListener(evt:ScrollBarEvent):void {
_myScrollBar.scrollerColor = 0x993333;
}
private function upListener(evt:ScrollBarEvent):void {
_myScrollBar.scrollerColor = 0x999999;
}
private function initStage() {
stage.frameRate = 60;
stage.showDefaultContextMenu = false;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, stageListener);
}
private function stageListener(e:Event = null) {
_scrollContent.x = stage.stageWidth / 2 - _scrollContent.width / 2;
_myScrollBar.adjustSize();
}
}
}
Scrollbar 'scroll-area' Click Problem...
I am trying to make a bunch of scrollers work when you click on the area below and above the actual scrollbar (the scroll-area), the scrollbar goes to it (easing would be nice too) Any advice/help?:
see my scroller here:
http://www.josimar.com/scrollbar_fk.swf
the Flash MX (not 2004) .fla is here:
http://www.josimar.com/scrollbar_fla
thanks
spumker
Scrollbar Width On Scroll Pane Component
Is there a way to shrink the width of the scrollbar in the scrollpane component without modifying each and every symbol imported from the "halo.fla" file in firstrun/en/classes/mx/etc... folder?
Changing Postition Of Scrollbar In Scroll Pane?
Hello there,
I have put together a scrollpane with a MC playing buttons for a portfolio site. I have in the past left the position of everything the way in comes in the component but this time wanted to move the up and down arrows to center over the scrollpane. This has created a problem as now whatever I do, part of my MC is covered up by the scrolltrack on the right. I have tried widening the scrollpane but that doesn't seem to help. I suspect I have to change the coordinates set in the actionscript for the scrollpane but am a little lost as to how to go about it...I would really appreciate some help.
Thanks.
Need To Alter Scrollbar Component To Not Auto-scroll...
First off, I am not sure if I am using a Flash MX or MX2004 version of this component, but I am able to go in and edit its Actionscript, and despite my analysis I can't figure out how to do this:
The scrollbar is used as part of a chat interface. As such, messages often scroll off the top of the text area, and I often have to scroll back to see missed messages. Problem is, new incoming messages ALWAYS force the scrollbar back down to the bottom, and I lose track of what I was reviewing.
Can anyone suggest working changes to the code in this component such that it will NOT auto-scroll to the bottom if the text is changed AND you are currently dragging the scrollbar? Thanks so much!
[F8]How To Make A Scrollbar To Scroll The Time Line?
As the topics, how to make a scrollbar to scroll the timeline of a target movie clips? My situation is, im going to load a video to a target movieclip, but i want to make a scrollbar that can control the timeline of the video... I found some script but the script will stop the video when i drag the drag bar around, and i want the drag bar to continue moving when the video is playing too... any helps will be appreciate
[F8] Adding Mouse Scroll To Ease-scrollbar
Hello,
in the attached file I've got a working scrollbar with ease.
The dragger is working fine and the up/down buttons as well.
Now my client wants me to add Mouse scrolling to the scrollbar
and he wants the ease to remain and off course that the dragger to be
synchronized with the main content.
Any help will be great.
I'm quit stuck with it.
Regards.
Elad
Create A Scrollbar That Will Scroll A Large Symbol...
I have a symbol that is larger then my flash movie... I want to create a custom scrollbar that will use a mask, and scroll this symbol up and down so it can be viewed in it's entirety. I would also like for the scrolling action to have a smooth motion.
Can someone instruct me how to acomplish this or link me to the simplest tutoril to accomplish this, please?
All the tutorials I have been able to find give instructions for scrolling text only.
Thanks in advance for any assistance.
~Slim~
Showing And Hiding A Scrollbar If There Is No Content To Scroll?
Can anyone point me in the right direction?
I have a text box on the main stage "desc_txt".
Then I have a movieclip "scroll" on the main stage that scrolls the "desc_txt" dynamic text field.
How can I say, if no content, don't show "scroll". Or, if there is content, show "scroll"?
Thanks in advance and please someone try to help!! I'm no star actionscripter so any advice is good advice.
Loading Text With Scrollbar As A Symbol Won't Scroll Right....
Hi all,
When I create dynamic text and add scroll bar to it on different layers, they work fine but once I make them symbol and dynamically load text to it, scroll bar no longer work much less does not appear on the rail beside text field. How could I make it work right?
Scrollbar To Work With Scroll Wheel On Mouse?
Hey Everyboody,
I'm using a scrollbar and textbox that I got here at Kirupa. I was wondering if there is any way to make this scrollbar function when a user tries to scroll it with the scrroll wheel on their mouse. Does anybody know if this is possible? If so, how?
Here is the scollbar I used: http://www.kirupa.com/developer/mx/dynamic_scroller.htm
And here is my code for my scrollbar:
loadText = new LoadVars();
loadText.load("news.txt");
loadText.onData = function(myLoadedText) {
// check and make sure it loads
if (myLoadedText != undefined) {
scroller.html = true;
scroller.htmlText = myLoadedText;
// do whatever else here.....
// if it doesn't load, play a MC that says something like "loading error"
} else {
myErrorMC.gotoAndStop("loadingError");
}
}
Thanks a lot.
Stupid-ass Scrollbar Component Doesn't Scroll. Wrf I Should Just Call It 'bar' ?
what's the deal with this scrollbar component? i followed the helpfile's instructions: create dynamic textbox, name instance, drag scrollbar onto textbox, it auto snaps, matches length, and links to the box.
when i test, the scrollbar arrows are greyed out, and i can't scroll. i am, however, able to scroll the textbox itself by selecting the text. wtf?
How To Scroll A MC With A Scrollbar, Ideas? I Searched And Came Up Empty-handed...
Greetings,
I searched the boards for a "scroll AND clip" but can't seem to find something applicable.
I have 8 dynamic text boxes, loading text from a .txt file. All placed on the stage, they are too tall for my .swf and I would like to keep them all on the "same page".
I would like to put a big, tall scroll bar on the right side, similair to what you might see on your browser so the user can just scroll down to see the rest of the text boxes. I have used the "scrollBar" component for text boxes and that's similair to what I need...
any thoughts or direction??
Thanks.
Cheers,
Schimke
Flash Custom Scrollbar Doesn't Scroll All The Way Back Up Again
Hello!
I used this tutorial to make a custom scrollbar that works great and lets me scroll my buttons+text up and down, but I have one problem!
My scrollbar won't scroll all the way back to the top again, only most of the way.
See my SWF here.
Does any wise person have any insight as to why?
Thanks
Scroll Movie Clip With Scrollbar Component (Flash 8)
Hello all,
I've worked out how to scroll dynamically loaded text, but now I need to scoll a series of images using the same scrollbar component.
I've attached my working dynamic text scroller, I would like my image scroller to work in the same way, really simple just a column of images which can be scrolled up and down.
I guess I need to arrange my images within a movie clip which is then linked to the scrollbar in some way.
I'm sure this is simple I just can't quite crack it.
Any help greatly appreciated,
Cheers
Tom
Trying To Get A Vertical Scrollbar To Scroll A Movieclip Problem, Help Needed...
Hi guys
I'm trying to create a scrollbar for a movieclip
Basically when i move the scrollbar down the content movieclip should go up and vice versa,
This works, however I can't get the scrolling to stop exactly at the bottom of the content movieclip, and its turning me a bit nuts. (theres a little blue square at the bottom of the content movieclip, and that should be displayed when the scroller has reached the bottom, but it isnt :-( )
the example fla can be downloaded here:
http://www.joeprice.co.uk/temp/scrollBarProblem.fla
If anyone could have a look and try to solve the problem i'd be most grateful!
Cheers
Joe
Scroll Dynamic Images - On Mouse Move & With Scrollbar [with: F8]
Hi actionscript gurus....
I have an actionscript issue making my head implode!
I want a mouse triggered scrolling image gallery, (mouse left moves the gallery left, mouse right...etc) that bit is fine. above that i want a scrollbar that can control the same gallery of images and their scrolling position.
doesn't sound too complex, but i have a dynamic number of images, so the gallery width is not fixed.... its complex, (in my little mind)!
can anyone help get this damned bar to function? I've got a saw head now!
fla attached
I'd be soo chuffed as i need to get this one out and its completely got me flummoxed.
many many thanks in advance for any help
[F8] Full Screen Scrollbar Class (Scroll Site?)
How do I utilize this code to scroll my flash site? It is an flash class created by devonair submitted to the flash community. Having problems working with the class to scroll my entire site content as I am using full browser flash coding as well.
Quote:
import flash.geom.ColorTransform;
import flash.geom.Transform;
class com.onebyonedesign.utils.OBO_FullScrollBar {
private static var OBO_FSB:OBO_FullScrollBar;
private var _content:MovieClip;
private var _scrollValue:Number;
private var _easeAmount:Number;
private var _scrollBar:MovieClip;
private var _scroller:MovieClip;
private var _scrollTrack:MovieClip;
private var _trackColor:Number;
private var _scrollerColor:Number;
private var _position:String;
private var _useScrollWheel:Boolean;
// events
public var onScrollDown:Function;
public var onScrollUp:Function;
// dummy properties to avoid senseless compiler errors from scrollContent method
private var parent:Object;
private var onEnterFrame:Object;
private var _y:Object;
/**
*
* @author Devon O. Wolfgang
* @date 4/12/2007 7:30 PM
* @description creates a full screen scroll bar for use with full browser flash applications
*
* @param trackColor Number hexadecimal color of scrollbar track
* @param scrollerColor Number hexadecimal color of scrollbar scroller
* @param content MovieClip the content that will be scrolled
* @param easeAmount Number how much easing applied to scrolled content (1 = no ease, Number.POSITIVE_INFINITY = way too much ease)
* @param position String either "left" or "right" - determines which side of browser scrollbar appears on
* @param useScrollWheel Boolean OPTIONAL specify whether or not scrollbar is mouse wheel enabled - default is false
*
* @usage var myScrollBar = OBO_FullScrollBar.createScrollBar(0x000000, 0x535353, scrollContent_mc, 3, "right", true);
*/
private function OBO_FullScrollBar(trackColor:Number, scrollerColor:Number, content:MovieClip, easeAmount:Number, position:String, useScrollWheel:Boolean) {
if (position == undefined || (position != "right" && position != "left")) throw new Error("OBO_FullScrollBar error: constructor method requires five arguments. Two colors in hexadecimal number format, a content MovieClip, an amount of ease greater than zero, and a position, either "left" or "right". A useScrollWheel Boolean is optional.");
_trackColor = trackColor;
_scrollerColor = scrollerColor;
_content = content;
_easeAmount = (easeAmount > 0) ? Math.ceil(easeAmount) : 1;
_position = position;
_useScrollWheel = useScrollWheel || false;
initScroller();
}
private function initScroller():Void {
makeScrollBar();
adjustSize();
var sb:OBO_FullScrollBar = this;
_scroller.parent = sb;
_scroller.useHandCursor = false;
_scroller.onMouseWheel = function(d:Number) {
if (d > 0) {
if ((this._y - (d * 3)) >= 0){
this._y -= d * 3;
} else {
this._y = 0;
}
if (this.onEnterFrame == undefined) this.onEnterFrame = this.parent.scrollContent;
} else {
if (((this._y + this._height) + (Math.abs(d) * 3)) <= Stage.height){
this._y += Math.abs(d) * 3;
} else {
this._y = Stage.height - this._height;
}
if (this.onEnterFrame == undefined) this.onEnterFrame = this.parent.scrollContent;
}
}
if (_useScrollWheel) Mouse.addListener(_scroller);
_scroller.onPress = function() {
this.parent.onScrollDown();
this.startDrag(false, 0, 0, 0, Stage.height - this._height);
this.onMouseMove = function() {
updateAfterEvent();
if (this.onEnterFrame == undefined) this.onEnterFrame = sb.scrollContent;
}
}
_scroller.onRelease = _scroller.onReleaseOutside = function() {
this.parent.onScrollUp();
this.stopDrag();
delete this.onMouseMove;
}
}
private function scrollContent():Void {
var ty:Number = -((this.parent._content._height - Stage.height) * (this._y / this.parent._scrollValue));
var dist:Number = ty - this.parent._content._y;
var moveAmount:Number = dist / this.parent._easeAmount;
this.parent._content._y += moveAmount;
if (Math.abs(this.parent._content._y - ty) < .5) {
delete this.onEnterFrame;
this.parent._content._y = Math.round(ty);
}
}
private function makeScrollBar() {
_scrollBar = _root.createEmptyMovieClip("sb"+Math.round(Math.ra ndom()*1000), _root.getNextHighestDepth());
_scrollTrack = createTrack();
_scroller = createScroller();
}
private function createTrack():MovieClip {
var t:MovieClip = _scrollBar.createEmptyMovieClip("track", _scrollBar.getNextHighestDepth());
t.beginFill(_trackColor);
t.moveTo(0, 0);
t.lineTo(16, 0);
t.lineTo(16, 16);
t.lineTo(0, 16);
t.endFill();
return t;
}
private function createScroller():MovieClip {
var s:MovieClip = _scrollBar.createEmptyMovieClip("scroller", _scrollBar.getNextHighestDepth());
s.beginFill(_scrollerColor);
s.moveTo(0, 0);
s.lineTo(16, 0);
s.lineTo(16, 16);
s.lineTo(0, 16);
s.endFill();
return s;
}
/*
*
* public methods
*
*/
// singleton instantiation
public static function createScrollBar(tc:Number, sc:Number, c:MovieClip, e:Number, pos:String, sw:Boolean):OBO_FullScrollBar {
if (OBO_FSB == undefined) OBO_FSB = new OBO_FullScrollBar(tc, sc, c, e, pos, sw);
return OBO_FSB;
}
// adusts and repositions scrollbar. call this when stage or content movieclip is resized.
public function adjustSize():Void {
_scrollBar._x = (_position == "left") ? 0 : Stage.width - 16;
_scrollTrack._height = Stage.height;
_scroller._height = Math.ceil((Stage.height / _content._height) * Stage.height);
if ((_scroller._y + _scroller._height) > Stage.height) _scroller._y = Stage.height - _scroller._height;
_scroller._y = (_content._height < Stage.height) ? 0 : _scroller._y;
_scroller._visible = (_content._height < Stage.height) ? false : true;
_scroller.enabled = (_content._height < Stage.height) ? false : true;
_scrollValue = Stage.height - _scroller._height;
_content._y = -((_content._height - Stage.height) * (_scroller._y / _scrollValue));
}
// use just like MovieClip.swapDepths()
public function swapDepths(o:Object):Void {
_scrollBar.swapDepths(o);
}
// allows or disallows mouse wheel scrolling
public function set useScrollWheel(b:Boolean) {
if (b) {
Mouse.addListener(_scroller);
} else {
Mouse.removeListener(_scroller);
}
}
public function get useScrollWheel():Boolean {
return _useScrollWheel;
}
// sets the movie clip that will be scrolled
public function set scrollTarget(targ:MovieClip):Void {
_content = targ;
adjustSize();
}
public function get scrollTarget():MovieClip {
return _content;
}
// sets the amout of ease to use
public function set easeAmount(e:Number):Void {
_easeAmount = (e <=0 ) ? 1 : Math.ceil(e);
}
public function get easeAmount():Number {
return _easeAmount;
}
// sets the color of the scrollbar track
public function set trackColor(col:Number):Void {
var tColor_cxf:ColorTransform = new ColorTransform();
var trans_xf:Transform = new Transform(_scrollTrack);
_trackColor = col;
tColor_cxf.rgb = _trackColor;
trans_xf.colorTransform = tColor_cxf;
}
public function get trackColor():Number {
return _trackColor;
}
// sets the color of the scrollbar scroller
public function set scrollerColor(col:Number):Void {
var tColor_cxf:ColorTransform = new ColorTransform();
var trans_xf:Transform = new Transform(_scroller);
_scrollerColor = col;
tColor_cxf.rgb = _scrollerColor;
trans_xf.colorTransform = tColor_cxf;
}
public function get scrollerColor():Number {
return _scrollerColor;
}
}
Flash Custom Scrollbar Doesn't Scroll All The Way Back Up Again
Hello!
I used this tutorial to make a custom scrollbar that works great and lets me scroll my buttons+text up and down, but I have one problem!
My scrollbar won't scroll all the way back to the top again, only most of the way.
See my SWF here.
Does any wise person have any insight as to why?
Thanks
I Found A Great MC Scrollbar, Now Help Me Make It Scroll Dynamic Text Too.
I found this great draggable scrollbar that scrolled an MC. It works like a charm and is very snazzy. What I would like to do is have the same daggable scrollbar on my dynamic text fields. Is this possible, and if so, what in the script below would I have to change??
The way I have my dynamic text fields is a very simple:code: loadVariables("bla.txt", ""); Then have the texfield have a var. called 'text' and then have the actual .txt file start with text=blablabla
Anyway, here's the script for the draggable scrollbar:
code: fscommand("allowscale", "false");
bar.useHandCursor = dragger.useHandCursor=true;
space = 50;
friction = 10;
speed = 10;
y = dragger._y;
top = main._y;
bottom = main._y+mask_mc._height-main._height-space;
dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar._height-this._height);
dragger.scrollEase();
};
dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger._height) {
this._parent.dragger._y = this._parent._ymouse;
this._parent.dragger._y = this._y+this._height-this._parent.dragger._height;
} else {
this._parent.dragger._y = this._parent._ymouse;
}
dragger.scrollEase();
};
bar.onMouseUp = function() {
drag = false;
};
moveDragger = function (d) {
if ((dragger._y>=y+bar._height-dragger._height && d == 1) || (dragger._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
dragger._y += d;
dragger.scrollEase();
updateAfterEvent();
}
};
up_btn.onPress = function() {
myInterval = setInterval(moveDragger, 5, -1);
};
down_btn.onPress = function() {
myInterval = setInterval(moveDragger, 5, 1);
};
up_btn.onMouseUp = down_btn.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
this.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-main._y)/speed)*friction);
main._y += dy;
};
};
There were up/down arrows, but I removed those just to have the dragger and the bar.
Many thanx in advance...
Scrollbar That Returns Back To Its Origin..."The Prodigal Scroll Bar", If You Will..
hello all
TGIF, first of all, although it probably makes no difference to most of us on this board,
I have a scroll bar that controls text field. I had an idea where the scroll bar could drag up and down but always return back to the starting point.... In essence creating a rather elastic feeling scroll bar, I was wondering if anyone had done something like that before that wanted to share their knowledge.
Scrollbar Problem - How To Load Text And Have The Scrollbar Default To Bottom Onload?
Hi,
I am currently working on a project whereby I need to display text in a scrollable area that refreshes every 2 seconds. I have the text loading ok but there is some extra functionality that I require.
At the moment I have a PHP application that uploads text files and adds the latest comment to the end of each text file. If you open the text file you can see the older comments at the top and the latest comments at the end. In the flash movie, I need the text file to load and the scrollbar to default to the bottom of the flash movie - that way, the latest comments will appear at the bottom of the screen and you can scroll up to the older comments.
I am not sure how to do this as I have just used the built in Flash components to get what I have so far.
Any help is appreciated.
Thanks,
Martin
Scrollbar Problem - How To Load Text And Have The Scrollbar Default To Bottom Onload?
Hi,
I am currently working on a project whereby I need to display text in a scrollable area that refreshes every 2 seconds. I have the text loading ok but there is some extra functionality that I require.
At the moment I have a PHP application that uploads text files and adds the latest comment to the end of each text file. If you open the text file you can see the older comments at the top and the latest comments at the end. In the flash movie, I need the text file to load and the scrollbar to default to the bottom of the flash movie - that way, the latest comments will appear at the bottom of the screen and you can scroll up to the older comments.
I am not sure how to do this as I have just used the built in Flash components to get what I have so far.
Any help is appreciated.
Thanks,
Martin
Scrollbar Problem - How To Load Text And Have The Scrollbar Default To Bottom Onload?
Hi,
I am currently working on a project whereby I need to display text in a scrollable area that refreshes every 2 seconds. I have the text loading ok but there is some extra functionality that I require.
At the moment I have a PHP application that uploads text files and adds the latest comment to the end of each text file. If you open the text file you can see the older comments at the top and the latest comments at the end. In the flash movie, I need the text file to load and the scrollbar to default to the bottom of the flash movie - that way, the latest comments will appear at the bottom of the screen and you can scroll up to the older comments.
I am not sure how to do this as I have just used the built in Flash components to get what I have so far.
Any help is appreciated.
Thanks,
Martin
Scrollbar Problem - How To Load Text And Have The Scrollbar Default To Bottom Onload?
Hi,
I am currently working on a project whereby I need to display text in a scrollable area that refreshes every 2 seconds. I have the text loading ok but there is some extra functionality that I require.
At the moment I have a PHP application that uploads text files and adds the latest comment to the end of each text file. If you open the text file you can see the older comments at the top and the latest comments at the end. In the flash movie, I need the text file to load and the scrollbar to default to the bottom of the flash movie - that way, the latest comments will appear at the bottom of the screen and you can scroll up to the older comments.
I am not sure how to do this as I have just used the built in Flash components to get what I have so far.
Any help is appreciated.
Thanks,
Martin
Scrollbar Doesn't Work (tutorial: Object-oriented Scrollbar)
(tutorial --> object-oriented scrollbar: http://www.gotoandlearn.com/play?id=71).
I followed the tutorials instructions and this is the code that i have now:
import caurina.transitions.*;
var yOffset:Number;
var yMin:Number = 0;
var yMax:Number = sb.track.height - sb.thumb.height;
sb.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDown);
stage.addEventListener(MouseEvent.MOUSE_DOWN, thumbUp);
function thumbDown(e:MouseEvent):void
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
yOffset = mouseY - sb.thumb.y;
}
function thumbUp(e:MouseEvent):void
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
}
function thumbMove(e:MouseEvent):void
{
sb.thumb.y = mouseY - yOffset;
if(sb.thumb.y <= yMin)
sb.thumb.y = yMin;
if(sb.thumb.y >= yMax)
sb.thumb.y = yMax;
var sp:Number = sb.thumb.y / yMax;
Tweener.addTween(content, {y:(-sp*(content.height-masker.height)),
time:1});
e.updateAfterEvent();
}
Does anybody see what's going wrong? I'm a beginner beginner, so all could think of to do is check if everything was typed correct. (i double checked instance names and code). But can't seem te get it to work, nothing happens when i preview swf.
No compilers errors and no syntax error. Tweener class is installed properly. PLEASE help me i've been looking for hours now.
If someone could help me, would be great!!
Sorry for my english, thank you for your time.
[F8] Horizontal Scrollbar Works, But Buttons On The Scrollbar Don't?
I've done a scrollbar like this one:
http://www.kirupa.com/developer/mx/infinite.htm
It works fine.
However, I want the individual buttons (button1, button2, etc.) on the scrollbar to load an image from my library whenever they are pressed. I've loaded an MC (content_mc) above the scrollbar for which the images will be seen, and added the images to each individual frame. I used the actionscript from my last menu which works great, but this one with the scrolling MC menu does not work.
Code:
content_mc.stop();
speed = 3
target = button1._y;
for (var i = 1; i<4; i++) {
this["button"+i].pageNum = i;
this["button"+i].onPress = function() {
target = this._y;
content_mc.gotoAndStop(this.pageNum);
};
}
this.onEnterFrame = function() {
current._y += (tagert-current._y)/speed;
};
|