User to rotate a 2d object

This newbie in flash interaction has almost figure it out! I’ve done the drag and drop part, (thanks to a kirupa tutorial :beam: ) The only script left is the furniture rotation like you see on this page: http://www.webworkshost.com/~fenwick/

[edited URL to my link]

This one uses a rotation button…is this the best way to do it?

If any one could please help me out with an action script to rotate an object, I’d be forever in your debt!

Here’s the fla file…
http://webworkshost.com/linden2.fla

The graphics are kind of lame, but I’ll be improving on those as soon as I have the scripting together :crazy:

Heather Mc

If you are using MX then there is a componant that can do this. Just drag and drop and attach to your clip :slight_smile:

http://www.flashcomponents.net/component.cfm?nav=2&id=132

I’m using Flash 5. Anyway to do it in Flash 5? Or, should I upgrade do you think?

If you can afford an upgrade… go for it, definitely.

I’ll hold off a little longer to see if anyone can help me do this in 5. $200 bucks profit loss is too much on this project…especially when I’m so close :frowning:

fingers crossed

I would see if I could set something up for you. But you wouldn’t be able to open my Flash MX file anyway so it does no good

:frowning: I am sorry :frowning:

I hope a Flash 5er who knows how to do it reads this.

Looks really good so far man… I think the only real complaint you might ever get though… Is if someone accidently drags a piece of furniture outside of the designated area… You might wanna put a drag limit on all of the clips as the size of the movie…

The Rotation thing looks great though… Or if you wanna do it like… If you press the left arrow key it rotates counterclockwise and if you press right arrow key it rotates clockwise…

If you need more info on how to do those things… Respond asap.

Good Luck
Marz <:}

Marz, thanks so much for your response! The first link is only an example of what I’m trying to accomplish…completed by others.

Would you please take a look at my ugly fla file? There is no rotation script on that one yet.

I would most appreciate your help!

A quick and dirty fix but it works

Hold down Shift when dragging to rotate anti-clockwise, hold down ctrl when dragging to rotate clockwise

I took out the pic as it was too big to post

3 parts:

Part 1
Rotation function declared on frame 1 - takes 2 paramaters: object to be rotated and rotation speed

Part 2
Button on mc to start/stop drag and to set var pressed

Part 3
Function call bracketed in if clause to only call rotation function when mc is being dragged

Thanks so much for the advice and putting that together. Unfortunately I think I need more help than I thought :*( I’ve done every suggestion, upgraded to MX, tried the component (but I couldn’t figure out how to use the component)

So now I’m using jsk’s example to create the rest of the movie clips. I’m trying to find quick answers to the following:

  1. Quickest way to import the rest of the furniture, and apply all the same scripting to the clips jsk created (probably not possible)

  2. If there is no quick way…I’m making each clip one by one racking my brain as to how you create the green transparent button/overlay to conform to the shape of the bitmap.

Well, if anyone has a little time! I just can’t seem to find the right tutorials :sigh:

Wow, I’m almost there. I found a different way to do it, but the 2 pieces of furniture start rotating the minute they grab it and move it, but I’d rather the click & drag be separate from the rotation. I know it’s got to be something simple :sure:

It’s quick to make the buttons, how many items of furniture do you have?

To make an invisible button:

  1. Copy the graphic and paste it into a layer above the original.
  2. Select the copy - click f8 and choose the button option.
  3. Double click the button to edit in place and drag the keyframe in the up frame to the hit frame - i.e. edit the button so that the only frame containing a graphic is the hit frame.

That’s it! For the button to work you only need to define the hit area.

jsk, I can’t thank you enough. Those instructions really did help me through this. Floorplan is Done!

http://www.webworkshost.com/~fenwick/

<:}

No worries, glad it worked.

Hey all :slight_smile:

A few folks say that the furniture gets stuck or refuses to drop/ release sometimes. I went back to the link and tried…sometimes the furniture sticks to the cursor, and sometimes it doesn’t. Usually this happens during a combination of dragging and rotating at the same time.

Do you know of anything that can be done to the file to prevent this? fingers crossed

http://webworkshost.com/~fenwick/

http://webworkshost.com/linden3.fla

Oops forgot to put in swapDepths -

add

this.swapDepths(1000);

to your button so it now reads

on (press) {
pressed = true;
this.swapDepths(1000);
this.startDrag();
}
on (release) {
pressed = false;
stopDrag ();
}

The error is caused when someone releases a piece of furniture behind another piece - using swapDepths adjusts the z or stacking order of the objects so by setting an arbitrarily high value e.g. 1000 - you’re forcing the object currently being dragged in front of everything else so that you can’t release it behind another piece of furniture.

This will only work if all the furniture is on the same layer in your MC - as swapDepths will only adjust the z level within a layer. You can also swapDepths with a name instance of a MC if you want to jump layers and not just z levels but that’s probably overkill in this case

Hi again!

Do you know of anywhere else that the swap depths should be added? For example, should this be on the rotate action on the clip as well perhaps?

I ask, because it still randomly won’t let go of the furniture…even if it’s away from another piece. I’d be more than willing to send you a check if you help me fix it <:}

hopeful

http://webworkshost.com/~fenwick/

http://webworkshost.com/linden3.fla

Heather Mc

I noticed the clip sticks to the mouse when you rotate the clip and the mouse isn’t over the piece of furniture. So it is over empty space around the clip.

My guess with this is that you should add an invisible area (alpha movie clip to 0) in the movie clip of the furniture so that you have your furniture and a radius area so your mouse will always be over the furniture. Does that make sense?..lol, not sure, it works in my head, but I never tried it.

Yes! that does appear to be the problem…when cursor strays to white space. Would you mind telling me how I can do what you mention? I’ll try anything :crazy: I have to admit I’m struggling.

No worries - more sloppy code on my part - I only coded for release not releaseOutside or dragOut

replace

on (release) {
}

with

on (release, releaseOutside, dragOut) {
}

and all should be well