-
Rotate Object
Hello there,
I'm trying to rotate an object by using actionscript. I managed to rotate the object once. Further clicking on the object to make it rotate again does not work. here's my simple script look like:
onClipEvent (mouseUp) {
_root.right_mc._rotation = 45;
}
How do I make the object to rotate again subsequently everytime I click on the object?
I appreciate your help.
cmec
-
You want to tell flash to rotate your object an addtional 45 degrees on each click...
_root.right_mc._rotation = _root.right_mc._rotation + 45;
-
Thanks for your reply. Ya, it works well. Thank you very much.
cmec
-
Rotate and Drag An Object
Hi, is it possible to drag an object and rotate it at the same time. I've tried the script below but there seem to be a confusion going on. I have replaced onClipEvent with "on (press)" since I want single object to rotate independently. Any idea how to make an object rotate and drag?
--------------------------
on (press) {
_root.right_mc._rotation = _root.right_mc._rotation + 45;
}
on(rollOver)
{
Mouse.show();
}
on(press) {
startDrag(this);
}
on(release) {
stopDrag();
Mouse.show();
}
on(rollOut)
{
Mouse.show();
}
on () {
}
--------------------------------------------
Appreciate your help.
-
I think the problem is, that when you rotate the object, there is a chance that the mouse will no longer be over the hit area of the object and there is confusion, as you say, and there is never any way to obtain your on(release).
You could take the object you want to drag and rotate, and put it inside another movieclip. This "holder" movieclip would have an invisible object that covers both the object's original location and rotated location. You could put your action script to drag on the "holderMc" and have a script to rotate your movieClip inside.
-
does anyone know how to do this in AS3?
i want to click on an object (like a dial), drag the mouse up and down to make it spin either direction.
even better would be to drag up and down, and it would scroll through a series of images (that way i could take a picture of the dial in each position, it wouldn't be as smooth of an animation but it would work better for the application im building, becasue the shadows would show up in each position).
the AS3 code for either of these methods would be really helpful thanks!
-
i knwo hwo to make all sorts of sliders and buttons, but rotating an object wiht mouse click and drag has proven more difficult.
i'm wondering if you can use one of hte rotate functions (rotateAroundInternalPoint etc..)
but i'm not sure how to set it up.
also can i start out my code like this?
(assuming the name of my spinning object is "dial")
dial.addEventListner(MouseEvent.MOUSE_DOWN, spinObject);
function spinObject(e:Event):void{
dial.rotateAroundInternalPoint();
or somethinglike that? anyone familiar with this part of AS3? i've been looking around on google for ages, found a lot of GREAT AS2 examples, but none wiht AS3......
-
Freshman ActionScript Dev
Have you tried this yet?
Example:
PHP Code:
addEventListener(MouseEvent.CLICK, rotateListener, false, 0, true);
function rotateListener(e:MouseEvent):void {
yourMovieClip.rotation += 45;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|