Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
WILLIE8768 #1
snapping
hi
I have a problem in my scripting in which i want to snap one model to the
other.
I have two model's sphere01 n sphere02.
To move the model's i have used the `Drag Model Behaviour' and a `Mouse Left
Trigger'.
I want sphere01 to snap to sphere 02 when i drag it near to sphere02.
The position of sphere01 is (vector(-140,37,95)) n after snapping i want it to
be (vector(-46,0,0)).
The script i have written is like this:
property pSprite
property pMember
property pPosition
on beginSprite me
pSprite = sprite(me.spritenum)
pMember = pSprite.member
pPosition = pMember.model("sphere01").transform.position.loc
end
on mouseUp me
if pPosition>=(vector(100,0,0)) and pPosition<=(vector(-10,0,0)) then
put pPosition = (vector(-46,0,0))
end if
end
PLz can someone solve my problem out.
William
WILLIE8768 Guest
-
tutorial file for snapping
hi can some one plz help me with some tutorial file on snapping 3d objects in 3d world. william -
snapping flash components together
I'm piecing together all these flash components and they aren't connecting the only gaps we are trying to fix are: 1. between bottom of black... -
Need help snapping...Please!
Hi guys, a buddy and I have been trying to figure this one out - maybe someone out there has either done this or seen something similar. We're... -
Help Please :- Common Snapping Distance
Hi all, I have a lot of sprites on stage which represent magnets. All these sprites have the same height but different widths. I want to write a... -
rectangular marquee tool snapping
Richard, Thank you! I thought there must be a "snap to grid" button somewhere. Silly me - I looked for it under Edit>Preferences>Grid. Eric -
Ex Malterra #2
Re: snapping
maybe you could use the vector object's distanceTo() method. i've not tried
this modification of your code, but i think it or something like it will work.
change SOME_FLOATING_POINT_NUMBER to be however close the two have to be
together to trigger the snap. you'll probably have to experiment to see what
you want it to be. let us know how it goes.
property pSprite
property pMember
property pPositionS1
property pPositionS2
on beginSprite me
pSprite = sprite(me.spritenum)
pMember = pSprite.member
pPositionS1 = pMember.model("sphere01").transform.position
pPositionS2 = pMember.model("sphere02").transform.position
end
on mouseUp me
if pPositionS1.distanceTo(pPositionS2) <= SOME_FLOATING_POINT_NUMBER then
pMember.model("sphere01").transform.position = (vector(-46,0,0))
end if
end
Ex Malterra Guest
-
Flexism #3
Snapping
Hi,
I'm realy new to Flex and gaining some experience at the moment. I wanted to
make a programm where I can drag panels around and if I come close to an other
panel they will snap to each other. (Like in Winamp or other programms)
I know how dragging is done but how can I make the panels "snap" to each other?
Flexism Guest



Reply With Quote

