# Image viewer

**URL:** <https://forum.kirupa.com/t/image-viewer/106326>\
**Category:** Uncategorized\
**Created:** [April 4, 2004, 7:22pm UTC](https://forum.kirupa.com/t/image-viewer/106326 "2004-04-04T19:22:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hondo311](https://avatars.discourse-cdn.com/v4/letter/h/6a8cbe/32.png) [@hondo311](https://forum.kirupa.com/u/hondo311)\
**Post date:** [April 4, 2004, 7:22pm UTC](https://forum.kirupa.com/t/image-viewer/106326/1 "2004-04-04T19:22:30Z")

</div>

here is some code for a rotating crank that controls an image gallery.  
refer to the “image viewer stops?” thread in the flash mx forum (sorry don’t know how to link to a forum yet!) for more info. attached is the fla.

i want to be able to crank clockwise to scroll images forward and counterclockwise to scroll images backwards. If i keep cranking, i want the images to continue to change, if i stop cranking, i want it to stp on that image. it doesn’t sem tooooo hard, i’m just numb from tryig to figure it out.

thanks!

* * *

```auto
 code for crank
---------------------------------------
mc.btn.onPress = function() {
	scrolling = true;
};
mc.btn.onmouseUp = function() {
	scrolling = false;
};
mc.onEnterFrame = function() {
	if (scrolling) {
		var dx = mc._x-_xmouse;
		var dy = mc._y-_ymouse;
		var rad = Math.atan2(-dy, -dx);
		var angle = (rad*180)/Math.PI;
		mc._rotation = angle;
		if (angle&gt;85 && angle&lt;=90) {
			_root.changePhoto(1);
		} else if (angle&gt;175 && angle&lt;=180) {
			_root.changePhoto(-1);
		}
	}
};
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 1:46pm UTC](https://forum.kirupa.com/t/image-viewer/106326/2 "2004-04-06T13:46:10Z")

</div>

Then, for the sake of code clarity, your first action should be ‘onMouseDown’, so you have 'onMouse(Up)Down as a pair, or ‘onRelease(Press)’ as another type.  
(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 2:27pm UTC](https://forum.kirupa.com/t/image-viewer/106326/3 "2004-04-06T14:27:13Z")

</div>

> [@divarch](#):
>
> Then, for the sake of code clarity, your first action should be ‘onMouseDown’, so you have 'onMouse(Up)Down as a pair, or ‘onRelease(Press)’ as another type.  
> (-:

for some weird reason, when i tried to put in ‘onMouseDown’ i lost the little finger thing that let’s you know you’re near a button. i don’t have flash on this computer so i can’t double check to see if i’m wrong.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 2:28pm UTC](https://forum.kirupa.com/t/image-viewer/106326/4 "2004-04-06T14:28:26Z")

</div>

any thoughts on the crank scrolling issues brought up a few replies back?

thanks!
