A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Help! Can't figure out why my script isn't working!

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    2

    Unhappy Help! Can't figure out why my script isn't working!

    So, for the life of me, I can't figure out why my script isn't behaving the way I'd like it to.

    I'm trying to have content (buttons and images) within a movie be vertically scrollable based on the position of the user's cursor, but the movie just keeps scrolling right off the page! I'm not sure what I've done wrong and/or overlooked, since I would like the movie to stop when it's reached the very top and the very bottom. I hope someone can shed some light on this. Thanks!!


    onClipEvent (load) {
    scrollMovie = this._height - Stage.height;
    topScrollMargin = 100;
    bottomScrollMargin = 600;
    horizontalScrollMargin = 0;
    acceleration = 10;
    }

    onClipEvent (enterFrame) {
    if (_root._ymouse >= 0 &&
    _root._ymouse <= topScrollMargin &&
    _root._xmouse >= horizontalScrollMargin &&
    _root.scroll._y <= 0){

    this._y -= (_root._ymouse - topScrollMargin) / acceleration;
    }

    else if (_root._ymouse >= bottomScrollMargin &&
    _root._ymouse <= Stage.height &&
    _root._xmouse >= horizontalScrollMargin &&
    _root.scroll._y >= -scrollMovie) {

    this._y -= (_root._ymouse - bottomScrollMargin) / acceleration;
    }
    }

  2. #2
    Junior Member
    Join Date
    Nov 2008
    Posts
    2
    Sorry, I forgot to mention that it's Actionscript 2.0 and I'm using Flash CS3.

    PHP Code:
    onClipEvent (load) {
    scrollMovie this._height Stage.height;
    topScrollMargin 100;
    bottomScrollMargin 600;
    horizontalScrollMargin 0;
    acceleration 10;
    }

    onClipEvent (enterFrame) {
    if (
    _root._ymouse >= &&
    _root._ymouse <= topScrollMargin &&
    _root._xmouse >= horizontalScrollMargin &&
    _root.scroll._y <= 0){

    this._y -= (_root._ymouse topScrollMargin) / acceleration;
    }

    else if (
    _root._ymouse >= bottomScrollMargin &&
    _root._ymouse <= Stage.height &&
    _root._xmouse >= horizontalScrollMargin &&
    _root.scroll._y >= -scrollMovie) {

    this._y -= (_root._ymouse bottomScrollMargin) / acceleration;
    }

    Last edited by semigh01; 11-22-2008 at 02:02 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center