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 / May 2008



Tip: Looking for answers? Try searching our database.

hitTest mover

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sadfba - 31 May 2008 07:33 GMT
I am using the following code as a mouse mover for a movie clip.  Can anyone
tell me if there is a way to increase the dead-zone where the mc won't scroll
in the middle.

Any help would be appreciated.

function scrollPlaylist() {
    // set an enterframe function for the scrolling
    tempForward.onEnterFrame = function() {
        // scroll playlist if needed
        if (this.hitTest(_root._xmouse, _root._ymouse) == true) {
            // determine relative mouse position
            var mpos = this._xmouse/this._width*this._xscale*0.02-1;
            // determine max, min and current playlist _x
            var ply = firePlace._x;
            var maxx = this._x;
            var minx = this._x-firePlace._width+this._width;
            if (ply>maxx-5 && mpos<0) {
                firePlace._x = maxx;
            } else if (ply<minx+5 && mpos>0) {
                firePlace._x = minx;
            } else {
                firePlace._x -= Math.floor(mpos*15);
            }
        }
    };
}

scrollPlaylist();
sadfba - 31 May 2008 15:31 GMT
Solved

function scrollPlaylist() {
    // set an enterframe function for the scrolling
    tempForward.onEnterFrame = function() {
        // scroll playlist if needed
        if (this.hitTest(_root._xmouse, _root._ymouse) == true) {
            // determine relative mouse position
            var mpos = this._xmouse/this._width*this._xscale*0.02-1;
            trace(mpos);
            // determine max, min and current playlist _x
            var ply = firePlace._x;
            var maxx = this._x;
            var minx = this._x-firePlace._width+this._width;
            if (ply>maxx-5 && mpos<0) {
                firePlace._x = maxx;
            } else if (ply<minx+5 && mpos>0) {
                firePlace._x = minx;
            } else if (mpos <= -.5) {
                firePlace._x -= Math.floor(mpos*20);
            } else if (mpos >= .5) {
                firePlace._x -= Math.floor(mpos*20);
            }
        }
    };
}
 
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.