|  | Click and drag constrained? |  | |
| | | simplestar44 |  |
| Posted: Wed Jul 16, 2008 8:08 pm Post subject: Click and drag constrained? |  |
Im trying to simulate dragging or scrolling of a web page in an iphone. I know some of the code to create the click and drag but i dont know how to constrain the dragging to just horizontal and vertical.
any help would be great! |
| |
| | | David Stiller |  |
| Posted: Wed Jul 16, 2008 8:08 pm Post subject: Re: Click and drag constrained? |  |
simplestar44,
| Quote: | I know some of the code to create the click and drag but i dont know how to constrain the dragging to just horizontal and vertical.
|
Fortunately, that's built right into the startDrag() method as an optional parameter. What version of ActionScript are you using?
David Stiller Co-author, Foundation Flash CS3 for Designers LINK "Luck is the residue of good design." |
| |
| | | David Stiller |  |
| Posted: Thu Jul 17, 2008 3:40 pm Post subject: Re: Click and drag constrained? |  |
simplestar44,
It sounds like you're using ActionScript 1.0 or 2.0, then. Prior to AS3, you can't really nest your mouse-related events, because the outer-most symbol overrides everything beneath it.
The usual workaround in this case is to use the MovieClip.hitTest() method on the inner symbol. You'll still be looking for a press (or release) on the parent clip, but hitTest() will tell you when the mouse happens to be within the confines of the inner clip (or whatever arbitrary area you specify).
David Stiller Co-author, Foundation Flash CS3 for Designers LINK "Luck is the residue of good design." |
| |
| | | simplestar44 |  |
| Posted: Thu Jul 17, 2008 5:04 pm Post subject: Re: Click and drag constrained? |  |
hey there! thanks for the info. I figured that out!
Now i have a bigger problem though. I set the image to be a draggable element. ( this means the cursor becomes a hand obviously ). What I want is to make one portion of this graphic a button so the user drags the image into view and then clicks on the area of the graphic that has a button to navigate to another scene.
The problem is, when i create a button and place it in the movie ( image ), it doesnt recognize it as a clickable button.
Essentailly its a web page that scrolls as the draggable element and at the bottom of the page has buttons. I dont know how to put them in this.
:confused; |
| |
|
|