Help - Search - Members - Calendar
Full Version: Actionscript Help
BleepingComputer.com > Software > Programming
   
yano
Problem #1: Ok, I made a clock in Flash that looks like it rotates around a fixed point in the center. It has a second hand as well as a minute and hour hand. However one of my friends suggested instead of having just buttons on the side to take you to an hour, how about making the hands of the clock draggable so you could set the time...

Does anybody know how I would do this? Would I have to refoncigure my layers to actually rotate around a "motion guide"?

Problem #2: another problem how can I get a text box with text in it, to display in a middle of my project yet have it scroll so you can read the stuff in it. I've seen websites like this but I don't know how to do this...

Problem #3: Also another problem... I have a simple game... (just clicking around looking) and I was wondering how would I be able to have an inventory, so when someone click on an opject it was be placed off to the side in the "inventroy."
JacobS
This post is over a year old, so you probably wont hear this, but i'll put it up anyway just incase someone has the same question.

The way to determine the rotation of and object that needs to be be rotated around a central point to point at the mouse is simple trig.

A triangle could be drawn that depicts the angle, and gives us two side lengths to work with. these lengths are happily the difference in x between the mouse and the pivot point and the difference in y.

In a line:
CODE
onClipEven(enterFrame){
    this._rotation = Math.atan2(_root._ymouse-this._y,_root._xmouse-this._x);
}

that will have the pointer always face the mouse.

i'd put it in a while loop for dragging.

To adress your "inventory" question:
This would best be done if the items were buttons

CODE
on(click){
_x = 500;
_y = 500;
}


or something along those lines


if the items needed to be movieclips, you could use a mouse listener and collision detection with the cursor.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.