ActionScript 3.0 :: Find Egistration Point Compared To Its Top Left Point
Aug 20, 2009if i have a movieclip or a sprite could i find (via code) where is its registration point compared to its top left point (no rotation included) ?
View 4 Repliesif i have a movieclip or a sprite could i find (via code) where is its registration point compared to its top left point (no rotation included) ?
View 4 RepliesI once needed to pan a sprite full of movieClips (picture 1) which were draggable with no bounds so you could drag them up and left (higher than sprites registration point).
You could also drag them down and right and expand a sprite that way (as well) but that didnt matter.What did matter was how much is 'up' and 'left' from the sprite registration point so i can include that in my formula for panning.
This was easy to find, i just sorted my array of movieClips, sorted on x and sorted on y after each drag, and thats how i got my up and left points.
Now I am trying to do that same thing, exept my movieclips inside a sprite have a custom rotation (picture 2), so i also have an up and left point, except this time up and left are caused by rotations of movieClips inside a sprite... (and these are dragable as well with no bounds)
I know some basic trig. but how do i find an angle from an anchor point and a moving point?
adjecent = _root.anchor._x-_root._xmouse;
opposite = _root.anchor._y-_root._ymouse;
hypotenuse = ((adjacent ^ 2)+(opposite ^ 2)) ^ 0.5;
Do you usually set the registration point in the upper-left corner ?I usually have always troubles with the registration point in the center.. or is maybe useful in any situation ?
View 1 RepliesI seem to be having difficulty figuring out the code required for mouse over and scroll left to right. Basically, I have arrows either side of the window and I would my timeline to smoothly go to the left or the right when the cursor is over the arrow.
View 5 RepliesI'm having some troubles trying to scroll a container MovieClip across the stage.I've attached an EventListener to the stage to track the MOUSE_MOVE MouseEvent, but it scrolls in a weird way (when halfway the screen it shows about 300 px of the container, when going below the horizontal centre, it goes up and disappears from sight.This is my code:
Code:
private function moveHandler(e:MouseEvent):void
{
[code]....
I'm making a 3D room builder. The user places Sprites around the 2D stage and my script converts those Sprites to Papervision3D DisplayObject3D objects. I'm having problems with the 3D object positioning because Sprites have registration points at their top-left corner and 3D objects have registration points at their center. How can I make that conversion?ere's a scheme of how the 2 different coordinate systems work:
I've tried this code:
child3D.x = child2D.x;
child3D.z = child2D.y - child2D.y - child2D.y; // just to make it negative
[code]....
is it possible for the same actionscript 2 script to be working if its inside the frames frame frame when you get down to the point where it says LEFT RIGHT UPP DOWN?
View 0 RepliesI read the Movement using ActionScript tutorial [URL]. My question is: How can I make the box stop at a certain point, instead of disappearing. What I want to do is to have a picture move from right to left, and then have it stop when it reaches the left side of a banner that I'm trying to make. I'm working with an image of a ship, and I want to make it look like it's floating from the right, and when it reaches the end, I want it to stop there and have text appear on the right side of the pic.
View 8 RepliesI start with a question: how could I change the registration point of a movie clip created or loaded at runtime? I want to move the registration point from top/left to center.
View 2 RepliesI've got a scrolling image gallery which I have a zoom button that lets the user zoom in on the images... If they click on the stage, the scrolling stops. Now, if they try to zoom in, the image scales from the left side, since the images registration points are on the left side of the movie clip they're loaded into. This causes the images to shift right, but I want it to appear as if its a straight on zoom...
View 3 Repliesi am trying to find center point of my pie.
var myTween:Tween = new Tween(piechart,"............", Strong.easeOut,1200, 510, 1, true);
i want to animate from the center and it has a xml driven data file.
I need to make a MovieClip rotate around it's center point to the left or right depending on mouse drag. I got some basic semblance of what i want going, but it's pretty hackish. Normally i calculate the angle and such but i only really need to use the distance the mouse travels and apply it to the movieclip and for flavor add some nice easing when you let go.
public function Main()
{
var wereld:MainScreen = new MainScreen();
addChild( wereld );
[Code]....
1. Is there a way to scale up an object from its center even if its registeration point is at the top left? can that be done using TweenMax?2. can I apply the same tween on two objects at the same time? basically what I want to do is load up an image to the stage, and then tween its scale from 0 to the original size along with another movie clip behind it that would form some sort of a border for the image. and I want to scale them up from the center.
View 5 RepliesI have a column of objects down the center of the stage and I need them to randomly point either to the left or the right. They have been placed using a for loop so I can't point each one individually. I was told I could use Math.random to flip their scaleX position but I can't get it to work.
View 4 RepliesI need to have 2 kinds of masks, one with a registration point in the top left so that when I tween its height it expands downwards, and one with a registration point in the bottom left so that when I tween its height it expands upwards?how do i do that, with code ofcourse?i have made something but i dont know if its the right way:(this expands downwards, but i dont know how to get it to expand upwards)
Code:
import gs.TweenLite;
var subMask:Shape = new Shape();
[code]......
When you create shape on stage and right click and chose create object you can chose Registration point for the object you chose what corner will be used as center of coordinates for this object. Now onice you create object is there way to change this registration point e.g. i created it in center now i want to to be in upper left corner?
View 5 RepliesIm pushing Point locations into an array to Shift em out later. like this:
tempmoves.push([new Point(roundx,roundy)]);
..
ob.movestoplayer = tempmoves;[code]....
What am i doing wrong?
It's been a long time since I've done any work with actionscript, and alas I've forgotten nearly everything. I've tried to look for a tutorial that would explain basic animation with actionscript, but the one that I found on Kirupa was no longer there.
Basically I'd like to do this:On the stage I have a movieclip and I'd like the movieclip to move along the x-axis to a certain point and then back to the starting point again. The moving speed of the movieclip should also be adjustable.
I'm creating a game in flash for a university project, and learning actionscript and programming as I go. I'm very much still at a beginner level - at the moment al I have is some actionscript for drawing rectangles and moving them about the screen. This is what I'm having trouble with at the moment: I have a class called 'Creature', and I want instances of it to interact with each other. I want them to do something when they come within a certain distance of another instance. And I want them to be able to pick a random other instance to get the location of, in order to do something with that information.
What I think I need is: A function for telling the distance between two (x,y) points.
A way of referencing the nearest other instance of the class. And a way of randomly selecting from all of the instances of the class.
How to convert 3d point to 2d point? I've found next formula in Internet(camera is situated in origin)
[Code]....
But these formulae give me strange result when z are less than zero(z<0) I need build line from A(100,100,100) to B (100,100;-100) As you can see these equations give really strange result when I try to convert B point in 2D dimension
i have the follow issue :
I have a point which is setted at the border on a component, with changed transform point to the center of a component in order to match the component rotation.
the important part is when i try to get the point XY after rotation - they remains the same as before rotation.
how to get XY, after rotation ( changeing point.rotation property to specific degrees of rotaion )
I am using AS2 with Flash 8 Professional So, my problem is that I currently have a man in the middle of the screen, who shoots a line towards the mouse when I click. However, when I use hitTest to see if the line collides with another object, Flash recognizes the line as a large box if it is diagonal, so the hitTest isn't very accurate. The line only satys there for one frame, so I can't have the usual moving-bullet-style. I am either looking for a way to create an imaginary line with AS from the starting point to the mouse and beyond, and tell whether or not this line intersects with an object... or some other way that I haven't thought of to fix my problem. Keep in mind that the line rotates from a center point towards anywhere around it for 360 degrees.
View 1 Repliesmy preloader bar isn't growing smoothly. it appears to jump from point to point -- and i want to make it smooth. you can see the example here at: [URL] would anyone mind taking a quick look at the file i've attached,
View 6 RepliesHow can I move a point (or circle) slowly and the point let behind a line.When the point turn back the line will be erase.
View 8 RepliesI'm not a genius in geometry, I'd like to find a point in as3 with the radius and a angle but I don't remember the rule, I know this should be simple!
View 3 RepliesI am currently looking at a way of visualising data and a part of the algorithm needs something 99% the same as A* Path Finding but I cannot wrap my head round it fully. I know it will be a fairly simple modification. (specific cost instead of least cost)
Basically I need to plot a path (2D Grid, no Diagonals) from point A to point B in X number of steps.
E.g. If the start and end points were right next to each other and I needed the path to be 3 steps it would have a tiny loop. (moves: up, right, down). Is there a known name for this algorithm or is the use of this so rare it's uncommon? I am currently looking at this AS3 Librbay for modification as it is apparently very fast and seems clean and simple to me:[URL]..
To make this easy, lets say I have a movie clip with a diagonal line in it (top left to bottom right).
I want to start my y position at 0, and place it in a loop and increase y by 5 every time. So we start at the top left of the clip, and move to the bottom of the clip.
Now since we have our y value (0, 5, 10, etc.) would you get the x position of the line? such as (x, y):
5, 10
or
42, 15
How could I find the distance between a given point and a drawn line? I was thinking about using the point-slope formula to draw a perpendicular line between the point and the line and measuring it as the distance, but I'm not quite sure how to do this in as3.
View 0 RepliesGiven this grid (tinyurl.com/63dgoja --> This is a trapezium/trapezoid, not a square), how do you find the point clicked by the user? I.e. When the user clicks a point in the grid, it should return the coordinates like A1 or D5.
View 2 Replies