[mx + flash8] different mouse events for clicking or clicking and dragging

Hi there,

there’s something that nearly makes my head explode …i’m in desperate need for your help :crying:

what i want to achieve is an online magazine where you can:

  • flip the pages by clicken on the corners
  • click on the pages to zoom in
  • if zoomed in, click to drag the page around
  • click again on the page to zoom out.

like in this example: http://www1.visions-weekly.de/epaper/epaper.html

what i have so far is:

as i’d never ever be able to program the pageflip thingy myself,
i bought a pageflip component from the lovely guys at flashloaded.com, so the magazine itself is set up, all the pages are in and i can flip them by clicking on the corners …sweeet=)

now comes the tricky part (at least for me)

i put an invisible button on top of the book. i started with the zoom function and used the onClipEvent(mouseDown) and (mouseUp) functions. if clicked for the first time i scale (xscale, yscale) the book to 120%. on the next click i zoom back to 100%. That worked out of the box:pleased:

Now i wanted to integrate the dragging. the book shall be dragged only when the mouse button is pressed …but i didn’t find a function for that. What i can achieve is either drag it after it got clicked or drag it always when clicked.

for example i tried this code:

i defined 3 variables in the main timeline:

firstclick (to monitor if it is the first click or not)
clicker (to monitor if the button is clicked right now)
dragger (to monitor if the book gets dragged)

 
onClipEvent(mouseDown){
 if(_root.firstclick=="0"){
  _root.firstclick="1";
 }
 else{
  _root.clicker="1";
 }
}
onClipEvent(mouseMove){
 if(_root.clicker=="1"){
  _root.dragger="1";
  _root.mybook.startDrag();
 };
 }
onClipEvent(mouseUp){
 if(_root.firstclick=="1"){
  _root.mybook._xscale=120;
  _root.mybook._yscale=120;
  _root.firstclick="2";
 }
 else if(_root.dragger=="0"){
   _root.clicker="0";
   _root.firstclick="0";
   _root.mybook._xscale=100;
   _root.mybook._yscale=100;
   _root.mybook._x=10;
   _root.mybook._y=10;
  }
  else if(_root.dragger=="1"){
   _root.dragger="0";
   _root.clicker="0";
   _root.mybook.stopDrag();
  }
 
}

the zooming works but not the dragging (i presume because the dragging would start after the click not while the button is pressed.

i tried to work with listeners (for the first time) but to no avail, because if i listen for clicks or drags that interfered with the pageflip function where you click and drag the pages as well.

can some one …pretty pretty please … show me a better way to achieve this?

yours
Stefan