Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
//Scroll the content relative to the mouse this.onEnterFrame = function() { //Only fire if mouse is over the content area if ((this._xmouse>Math.floor((initialWidth-currentWidth)/2)) && (this._xmouse<Math.floor(initialWidth+2*((currentWidth-initialWidth)/2))) && (this._ymouse>contentClip._y-((contentClip._height/2))-100) && (this._ymouse<(contentClip._y+((contentClip._height/2)+100)))) { //Make sure the content width is larger than the currentWidth if (contentClip._width>currentWidth) { positionContent(); } } }; var speedX = 300 // positionContent = function () { // minX = (0+_root.contentClip.holder0._width/2)+(buffer*2); maxX = -(contentClip._width-currentWidth); // // Total available movement of the content minus screen width availMovement = maxX; if (this._xmouse > (currentWidth/2)) { trace("more") trace("contentX = "+contentClip._x+" && maxX = "+maxX) if (contentClip._x > maxX) { newX = contentClip._x-speedX } else { newX = maxX; } } else { trace("less") if (contentClip._x < minX) { newX = contentClip._x+speedX } else { newX = minX; } } }; //Set the initial position to the left side of the screen if content width is more than currentWidth, else center the content if (contentClip._width>currentWidth) { newX = Math.floor((initialWidth-currentWidth)/2)+buffer; } else { //Center the content //newX = Math.floor(initialWidth/2-contentClip._width/2); } // holder = contentClip._x; minX = 0+_root.contentClip.holder0._width; maxX = contentClip._width-currentWidth; easeContent = function () { // Don't fire if the destination position is met if (newX<>contentClip._x) { destx = newX; posx = holder; velx = (destx-posx); holder += velx/speed; contentClip._x = Math.round(holder); } }; // updateLocations(); // stop();
This paste will be private.
From the Design Piracy series on my blog: