![]() |
![]() |
||||||
|
|||||||
| Tags: background, image, scroll |
![]() |
|
|||
|
My background image (945 px wide) is larger than my Flash window (620 px wide).
When a user moves the cursor left or right, I want the background image to move in that direction but only as far as the edge of the image and when the cursor stops moving so should the image. I will also have hot spots in various places that will be clickable. I tried this code (see below), but it doesn't quite do what I need. For one thing it continues to scroll beyond the left and right edge of the background image. Another problem is that the image keeps moving even though the cursor stopped, which make it near impossible to click on my hotspots. function accelScroller(myTarget) { myMiddle = Stage.width/2; this.onEnterFrame = function() { moveDist = myMiddle-_root._xmouse; myTarget._x += moveDist/10; //border check if (myTarget._x>Stage.width) { myTarget._x = 0; } else if (myTarget._x<0) { myTarget._x = Stage.width; } } } accelScroller(mcInstanceName); |
| Sponsored Links |
|
|||
|
Hey,
I have thought of using this for the exact reason. I haven't got around to using the hotspots but check out this tutorial. I think this what you mean. http://www.kirupa.com/developer/flas..._image_pan.htm |
|
|||
|
Maxwell Hammer wrote:
> My background image (945 px wide) is larger than my Flash window (620 px wide). > When a user moves the cursor left or right, I want the background image to move > in that direction but only as far as the edge of the image and when the cursor > stops moving so should the image. I will also have hot spots in various places > that will be clickable. I tried this code (see below), but it doesn't quite do > what I need. For one thing it continues to scroll beyond the left and right > edge of the background image. Another problem is that the image keeps moving > even though the cursor stopped, which make it near impossible to click on my > hotspots. > > > function accelScroller(myTarget) { > myMiddle = Stage.width/2; > this.onEnterFrame = function() { > moveDist = myMiddle-_root._xmouse; > myTarget._x += moveDist/10; > //border check > if (myTarget._x>Stage.width) { > myTarget._x = 0; > } else if (myTarget._x<0) { > myTarget._x = Stage.width; > } > } > } > accelScroller(mcInstanceName); > Hi Maxwell, I'm really a beginner with actionscript (so I could be totally wrong) but doesn't the image keep moving because it is inside an 'onEnterFrame' function which by its very nature keeps repeating whilst in that frame so all the statements inside the function will keep repeating too? Cheers Kol |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise