Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / July 2008



Tip: Looking for answers? Try searching our database.

custom scroller problems

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
redsox05 - 19 Jul 2008 16:44 GMT
I'm having trouble with a custom scroller. I want it to go left to right and
NOT up and down as it currently does. I thought I could just switch the x and y
coordinates and letters and it would work but it still scrolls upand down.
Thanks for any help.

stop();
var scrollLeft:Number = 107.5;
var scrollRight:Number = 666.8;

var imageLeft:Number = 23;
var imageRight:Number = -639;

var scrollRange:Number = scrollRight - scrollLeft;
var imageRange:Number = imageRight - imageLeft;

function scroll() {
    var moved:Number = scroller._y - scrollLeft;
    var pctMoved:Number = moved/scrollRange;
    var imageMove:Number = pctMoved*imageRange;
    images._y = imageRight - imageMove;
}

scroller.onPress = function() {
    this.startDrag(false,this._x,scrollLeft,this._x,scrollRight);
    this.onMouseMove = scroll;
}

scroller.onRelease = scroller.onReleaseOutside = function() {
    this.stopDrag();
}
Heroina - 19 Jul 2008 17:06 GMT
You don't have all the changes necesary to make it left to right. Here
are the changes you need:

function scroll() {
       var moved:Number = scroller._x - scrollLeft;
       var pctMoved:Number = moved/scrollRange;
       var imageMove:Number = pctMoved*imageRange;
       images._x = imageRight - imageMove;
}

scroller.onPress = function() {
       this.startDrag(false,scrollLeft,this._y,scrollRight,this._y);
       this.onMouseMove = scroll;
}

Cheers.

   Carla Macías
   http://codigometropoli.com/
Noelbaland - 20 Jul 2008 08:35 GMT
Change all your _y references in the scroll function to _x.

function scroll() {
var moved:Number = scroller._x - scrollLeft;
var pctMoved:Number = moved/scrollRange;
var imageMove:Number = pctMoved*imageRange;
images._x = imageRight - imageMove;
}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.