Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 2 of 2
  1. #1

    Default X-axis scrolling gallery AS2

    Hey guys and gals!

    I have been creating a gallery and there are some specific task's it needs to do.

    1) scroll only X-axis when user clicks image
    2) when release images move with inertia
    3) if images are not resting in final position then the image must move.

    so I guess the first thing I have been having trouble with is using

    startDrag() but to specify only the X-axis??

    any help would be nice!

    Little more about the project. Images must scroll off the stage.. Images are all lined up in a row on the x-axis. user can sellect images and scroll feature is implemented when selecting a thumb OR user drags to the left to reveal no image coming in from the right.

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2

    Default heres the code for my last post

    I am trying to disable the y axis move so it only scrolls X-axis.

    MovieClip.prototype.onPress = function() {
    this.drag = true;
    this.startDrag(false);
    this.xPos = this._x;
    this.yPos = 0;

    this.onEnterFrame = function() {
    if (this.drag) {
    this.xSpeed = this._x - this.xPos; // x mouse speed
    this.ySpeed = 0; // y mouse speed
    this.xPos = this._x;
    this.yPos = this._y=0;
    } else {
    this._x += this.xSpeed;
    this._y = 0;
    this.xSpeed *= 0.8; // decrease x speed by 20%
    this.ySpeed *= 0; // decrease y speed by 20%
    if (Math.abs(this.xSpeed) < 0.1 && Math.abs(this.ySpeed)< 0.0) { // if almost no movement, end enterframe loop
    delete this.onEnterFrame;
    }
    }
    }
    }

    MovieClip.prototype.onMouseUp = function() {
    this._y=0;
    this.drag = false;
    this.stopDrag();
    }

    MovieClip.prototype.onRollOut = function(){
    this._y=0;
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial