Hi,

if you iterate through the guides and you locate the one with the closest
distance to your object, you got the closest guide.
Now if your mouse/object is closer than 'x' pixels to the guide, set the
object x to the guide x, otherwise set the object x to the mouse x.

Is that what you are looking for?

greetz
JC

On Sun, Nov 23, 2008 at 9:34 AM, kris range <[EMAIL PROTECTED]> wrote:

> Are you talking about snapping to a guide you have setup in the Flash IDE?
>
> As far as I know you can't snap to that through code. You could easily
> take a number though ( from your mouse for ex ) and use the Math class
> to round it to a pixel or to the nearest x pixel if you knew where
> your guide was already placed. You could as well as do some testing if
> you wanted to snap to an invisible movieclip or sprite that was to be
> used as a sort of "guide".
>
> On Sat, Nov 22, 2008 at 8:09 AM, Rich Rodecker <[EMAIL PROTECTED]>
> wrote:
> > no, i mean snap to a guide while your dragging an object.
> >
> > On Sat, Nov 22, 2008 at 7:30 AM, Piers Cowburn <[EMAIL PROTECTED]>
> wrote:
> >
> >> You can do a bezier tween with something like TweenMax http://
> >> blog.greensock.com/tweenmaxas3/ , is that what you're after?
> >>
> >> Piers
> >>
> >>
> >>
> >>
> >> On 22 Nov 2008, at 15:03, Rich Rodecker wrote:
> >>
> >>  I'm looking for some code that can pull of 'snap to guide' in
> >>> actionscript.
> >>>  I've found some snap to grid code, but all of them are in AS2, so I'm
> >>> wondering if there might be a better way to do it in AS 3 as well?
> >>> _______________________________________________
> >>> Flashcoders mailing list
> >>> Flashcoders@chattyfig.figleaf.com
> >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>>
> >>
> >> _______________________________________________
> >> Flashcoders mailing list
> >> Flashcoders@chattyfig.figleaf.com
> >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> > _______________________________________________
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
>
> --
> Kris Range
>  _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to