ActionScript 2.0 :: Rotating Mc In Its Center?
Feb 18, 2003
my problem is that even if the registration point of the MC I want to rotate is in its center it keeps rotating in its upper left corn.The MC is a jpg I load dynamically.The syntax I use is : _root.photo._rotation += 90;
View 14 Replies
Similar Posts:
Dec 10, 2009
how to do an effect like the one seen on this page?: http:[url]....
View 1 Replies
Jan 31, 2010
I have been working on this and thinking about it for days but I just can't seem to get it right. I want to have a circle that I can "pick up" with the mouse and then rotate (with the rotation point in the center). Currently I have done this with the following code:
PHP Code:
var radians = Math.atan2(mouseY-circle.y, mouseX-circle.x);
var degrees = Math.round((radians*180/Math.PI));
circle.rotation = degrees + 90;
I have added a mouse listener for movement to the circle mc and then checked if a button was down. On button down this code would be executed on enter frame. This code works but the main problem is that I want to be able to "pick the circle up" at any angle and rotate it. If I pick it up with this code the circle automatically rotates to 90 degrees.
View 1 Replies
Dec 14, 2009
All I need to do is rotate an object (which could spawn at any point along each of the four edges of the screen) so that it faces towards the centre of the screen. Obviously this will be done using the .rotationZ property. I will know the starting point of the object, and the centre point of the screen (400, 300). The object begins facing directly 'up' (e.g. if it spawned directly below the centre of the screen it would already be at the correct angle).
View 2 Replies
Nov 4, 2010
a movieClip that contains a polygon and some circles at the angles of the polygon. I want to use the circles as rotation handles.Now the code below works but it terribly, terribly slow.I've seen a couple of other examples of rotation using the mouse position, but I want the polygon to rotate via the handle; I think that means the angle of rotation needs to be updated each time the mouse moves.Is there a cleaner/more efficient way to do this?Also, this works only for one direction right now no matter the x/y direction you move the mouse.
public function mouseDownRotate(event:MouseEvent):void {
// get the global x and y of the dragged piece (offset so it looks like it's rotating around the polygon's center
[code]......
View 6 Replies
Aug 9, 2011
I searched online and found this script that is supposed to rotate and image but I'm not sure how to use, where to put in the degree angle that I want my sprites to rotate by. Also, I get an error. 1084: Syntax error: expecting identifier before leftparen. 1084: Syntax error: expecting rightparen before leftbrace.
var point:Point=new Point(spr_box.x+spr_box.width/2, spr_box.y+spr_box.height/2);
rotateAroundCenter(spr_box,45);
function rotateAroundCenter (ob:*, angleDegrees) {
[Cde].....
View 1 Replies
Jan 27, 2006
I have spent hours trying to figure out how i could rotate a loaded movie through the centre axis rather than the set point set by flash in the left corner.
View 1 Replies
Sep 6, 2006
I'm doing a little photo rotation front-end for a site I'm working on. It's a custom photo gallery site that needs to have a photo rotation functionality to it. The back-end developers couldn't find a decent way to do it in Javascript, so they've come to me to figure it out in Flash.They pointed me to the Flickr rotation tool as an example. Seems like it should be straightforward:Load photo into empty movie clip on stageRe-center photo movie clip to the stageUse left/right rotation buttons to rotate image in 90 degree incrementsThat said, I'm having a tough time, after I load a photo into the empty movieclip, using a rotate left and rotate right button to spin the photo around. Obviously, the registration point is in top-left corner of the photo movieclip when the photo is loaded.
I've read that rotation can be managed by putting the clip to be rotated into an outer clip, but...there's a catch......I won't ever know what the exact size of the photo being loaded is going to be, so I can't set the outer clip to a certain size. I only know that it will never be wider than 100px.
View 3 Replies
Mar 9, 2009
I am trying to rotate some points around the center of the circle(0,0), however I'm getting weird values from the output. I've commented the problem code..
Code:
var r:Number = 10;//radius
var y:Number;
var x:Number;
var a:Number = 90;//angle of which the semi-circle is facing.. could be a random angle.
var ax:Number;//rotated points
[Code] .....
I am using the semicircle in BitmapData collision checking with getPixel(), with a moving circle...
View 1 Replies
Feb 21, 2011
I am in the midst of finishing up a design application where you can upload images and colors. I use the greensock transform manager. I am taking anything a user does and recording it so I can recreate what they made on larger scale behind the scenes (to be exported for printing purposes)
The problem I am running into is with rotation and moving x and y values. The transform manager does everything relative to a center point, but when i recreate the image object the registration point is at the top left. I have found how to rotate around the center of the object using the transform matrix, but I can't seem to move the x and y correctly because these values change when you rotate. I want to just move the image to the left or right relative to the center. How could I go about doing this.
Here is how I rotate.
private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point) {
var m:Matrix=ob.transform.matrix;
m.tx -= ptRotationPoint.x;
[Code]....
View 1 Replies
May 12, 2009
i have a triangle that i generate using the following code:
Code: Select allinternal function generateTriangle(w, h, topPoint, color = "0xFF9900") {
var triangle:MovieClip = new MovieClip();
with (triangle.graphics) {
[Code]....
I use this function and a foreach loop to generate 9 differently colored and sized triangles, which works fine when i place them on the canvas. But if i try to rotate them they rotate around the 0,0 point - i want them to rotate around the center of the individual triangles, how do i do that?
1. How do i move a dynamically generated triangle inside a movieclip? Solved using [URL]
2. How do i access each of the triangles inside the movieclip, or even better, place them in 9 different movieclips using addChild so that i can move them around individually?
View 4 Replies
Nov 30, 2009
I have 4 movie clips rotating around a center axis. I know how to make each one pause individually, but I don't know how to get them all to pause when you roll over just one of them. Right now it only pauses the one you roll over and the others continue to rotate. I have this code pasted into the actions of each movieclip that is rotating.
Code:
onClipEvent (load) {
var radius = 220;
var speed = .6;
var xcenter = 450;
var ycenter = 300;
[Code] .....
View 1 Replies
May 27, 2010
I want to be able to rotate the ship around the center point and be able to update the .x and .y at the same time.I've got this two versions of code.1
Code:
if (aKeyPress[38])
{
[code].....
View 2 Replies
May 4, 2010
[URL]I'm using this code and I made some changes like freezing the rotation when the mouse is over the rotation entities. But I'd like to stop rotation when the mouse leaves the stage. How can I do?This is my code
Code:
import flash.filters.BlurFilter;
import mx.transitions.Tween;
import mx.transitions.easing.*;
[code]....
View 2 Replies
Nov 1, 2005
I have a rotating menu that sets the selected button to the 3:00 position once clicked. I need the labels for the buttons to stay in the upright position as they rotate with the button. I have attached an image. Anyone know of an action script that would keep the labels upright?
View 8 Replies
Aug 15, 2009
I have a center window and a background in my flash file. I am trying to get the center window to stay in the center of the web browser screen and get the background to expand and fill the entire web browser screen below center window layer. Sort of like this site [URL] I've currently converted the background to a movie clip and have this code.
[Code]....
View 11 Replies
Mar 23, 2009
My flash movie is 1440x900 but the area where all the important stuff happens in within 1024x768, i am trying to keep the middle in the center regardless of browers size or aspect ratio.
I can center the page but it doesn't work as i need it to. If the browers is small (1024x768) the swf is justified against the left edge, but not keeping the middle in the middle of the brower.
[URL] is an example of exactly what i am trying to achieve.
View 13 Replies
Jul 1, 2009
would anyone beable to direct me to a tutorial on how to create a rotating circle menu that is driven by xml.
View 6 Replies
May 12, 2010
I have a circular diagram with approximately 8 icons around the outter part of the circle. These points are all buttons. When Clicked, I want the diagram and icons to animate round to the top point (360 or 0 degrees). Then, when another icon is clicked they will all move round so that one is at the top.It would be a great bonus to have a slick easing in motion too but not essential - just a 'nice to have'.I have looked over forums and responses and there is quite a bit of info on this but I'm finding it difficult to apply it to this particular project.
View 2 Replies
Nov 29, 2011
When you drag a mc it rotates. And when you release drag, it stops rotating and it stays at that point.
View 5 Replies
Jun 22, 2009
I have been given the task to create something similar to the flash navigation on the link below. I have tried googling things such as "flash image rotation", "flash rotation circle", etc?[URL]
View 1 Replies
Sep 17, 2009
I am trying to get an object to rotate similar to the globe on this sitei have found the
code:
onClipEvent(enterFrame){
_rotation += (Math.floor(180*Math.atan2(_ymouse,_xmouse)/Math.PI)+90);
[code].....
View 5 Replies
Sep 12, 2008
I have a rotating dial coded in AS3 but I cannot get it to follow with the mouse - It works the way I want it to if I grab opposite to the pointer (so 90 to 180 degrees from the pointer) to rotate the dial. The problem is that I am using the rotation degrees to set a value only in positive numbers ranging from 0 to 240 instead of 0 to 360. If I change the standard rotation code so it tracks with the mouse, it reveals angles -180 to +180 which would screw up the number conversion to positive 0 to 240. I am thinking if I have to change "var r", then "var tr" needs changing to get it back.
View 4 Replies
Nov 28, 2009
how i could make the transition from my last photo to the first photo a more correct transition. maybe my explanation was difficult to understand?? take a look at these two sites(owendawsonphotography.com / owendawsonpga.com) and look at the rotating slide show. when the last image fades out it goes to complete white and the first image comes in at full opacity. I want it to look like the other transitions in the slideshow.
View 1 Replies
Apr 16, 2010
I'm trying to rotate a movieClip from it's original position, to a random anglehere's what I have:
function getRandomNumber(min:Number, max:Number):uint{ var randomNumber:Number=Math.round(Math.random()*(max-min)+min); return randomNumber;}
particles.rotate(angle:getRandomNumber(0,180));
[code]........
View 2 Replies
Feb 9, 2011
I am a complete and utter newbie when it comes to flash. I've bought Flash Professional CS5, and I am looking for a tutorial/help to create a rotating banner ad similar to the one on [url]...
Example: I've got four different pictures I want to rotate within let's say 3-4 seconds per picture. Each of the picture needs its own link, so people can click to get to the correct place. I want the pictures to "fade out to the left" when changing)
View 4 Replies
May 27, 2011
I have a MC that i am moving on to the stage that i want to look as if it rolls in to position. I cant find any referance on how to do this. my code so far is:
//Pic1
PicHolder1.x = 1800;
PicHolder1.y = 322.4;
Tweener.addTween(PicHolder1, {x:161.2,y:322.4, time:1, transition:"linear"});
this gets the motion across but how do i roll it then stop at the end position?
View 3 Replies
Jul 16, 2011
Background info: I am using ActionScript 2.0 and Flash CS5I was working on a game and I used photoshop to save a little gif image. I imported it into flash, "broke it apart", turned it into a movie clip, and put this bit of code on it. It rotates the image when the mouse is moved around it.
Code:
onClipEvent (enterFrame) {
// find x and y differences
[code]........
View 11 Replies
Nov 1, 2011
I am trying to rotate a button in my program that has a large hit box. Obviously, when I do this, the hit box is also rotated and is now in the wrong place. Is it possible to get this hit box to remain static, or to just keep it there?
var turnButton:Tween=new Tween
(sections.lower, 'rotation', Strong.easeOut, 0, 180, 3, true)
View 1 Replies
Apr 16, 2011
I have a problem with rotating and moving my map. I need to spawn buildins along the road and move them. Check the picture. What I want to do is have my player in the middle and rotate the map randomly while the buildings are sliding along the road.
imgur.com/14Ha6 <- Link to the pic
View 1 Replies