ActionScript 2.0 :: Rotating A Loaded Movie In The Center?
Jan 27, 2006I 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 RepliesI 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 Repliesi was wondering if there was a way to center a loaded movie to the object it was loaded in to..using this
loadee.loadMovie("load1.swf");
to load the movie into clip loadee , the clip is located the the center of the main movie, now i want the clip that was loaded into the placeholder clip to be in the center of the movie, instead of the upper left corner of the movie being were the placeholder clip was
// VoS
i was wondering if there was a way to center a loaded movie to the object it was loaded in to..
using this
loadee.loadMovie("load1.swf");
to load the movie into clip loadee , the clip is located the the center of the main movie, now i want the clip that was loaded into the placeholder clip to be in the center of the movie, instead of the upper left corner of the movie being were the placeholder clip was
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 Replieshow to do an effect like the one seen on this page?: http:[url]....
View 1 RepliesI 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.
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 Repliesa 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]......
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].....
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.
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...
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]....
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?
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] .....
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].....
[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]....
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.
how to rotate an image loaded using CameraRoll on an AIR for iOS app. This code below works fine (displayImage() is called when CameraRolls media event returns completed, and imageArea is the scrollPane where the image is shown.
function displayImage():void
{
var image:Bitmap = Bitmap(imageLoader.content);
[Code].....
With the second version the image seems to load because the scroll bars expand to the size of the image I choose, but I don't see anything on the stage.
I got an error saying "Attempted access of inaccessible method rotation through a reference with static type flash.display:Sprite.ssd.rotation(90)}" I just want to know how to rotate my image by 90degrees when I double click on it.
var shootingstar:Loader = new Loader();
shootingstar.load(new URLRequest("http://i51.tinypic.com/m8jp7m.png"));
shootingstar.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadingComplete);
var ssd:Sprite = new Sprite();
[Code].....
how to rotate about the center an image loaded dynamically through AS? I've already asked this question, no one answered, I searched, searched some more, looked through my fairly voluminous collection of example flas and have come up with nothing.The following code does rotate a mc about its center, but only (apparently) if the mc contains something when the swf loads.
Code:
onClipEvent(load){
this.rotation_speed = 2;
function origin(){[code].....
center the loaded .swf(external swf) using as3 and it will still stay centered when the browser is resized?
View 6 RepliesThis is the code I'm using which loads in external swf's in 2 loaders, replacing each other. I just to center the main clip(tl) in the main swf, and can't figure it out![code]...
View 13 RepliesI have a question to center an animation within its container.This is the container or loader:
public function Main():void
{
trace("Constructor...");[code]......
In canvas, I have the code:
onClipEvent (enterFrame) {
// Make canvas dynamically resize to whatever is loaded in imageClip clip and width and height matches (and only when ttally loaded )
[code].....
I just want to center my dynamically loaded movieclip, into it's container box. Not center on the stage, but make it center with the container_mc it loads in.
You know when you load a external swf, it loads from the top left corner. How can the loaded image or movie load centered instead of aligned top-left?
I am actually using the XML thumbnail gallery here at kirupa. [URL]
I've got these images that are being loaded into an MC called imageClip, and another MC called Canvas underneath it.In canvas, I have the code:
onClipEvent (enterFrame) {
// Make canvas dynamically resize to whatever is loaded in imageClip clip and width and height matches (and only when t�tally loaded )
[code].....
I have several images that are loaded dynamic.Now I want them to center in the container.How is that done? I can get the width and height but I can't adjust the x values on the loaderinfo object. Heres part of the code:
... part of function ...
for (var i:uint=0; i<numPictures; i++) {
var pictLdr:Loader = new Loader();[code].......
How do I center dynamically loaded picture?[code]...
View 3 RepliesThe code is in the first frame of the timeline. I want to center an externally loaded image, but I just can't make it work:
[Code].....
I've read a few of the other threads on this subject but still had no luck. I'm loading jpgs via an xml file and the pics are all diffrent sizes. I'm trying to figure out how to center the image once loaded, but am running into brick wall after brick wall.[code]...
View 1 Replies