ActionScript 3.0 :: Recalculate Point X / Y Value After Matrix Transformation

Jun 16, 2010

I am doing a matrix transformation on a Display Object. I got this function from another site, but basically it scales a display object around any point.
ActionScript Code:
public static function scaleAroundExternalPoint(m:Matrix, x:Number, y:Number, multiplier:Number):void{
m.translate(-x, -y);
m.scale(multiplier, multiplier);
m.translate(x, y);
}

But my problem is that I have to do multiple scales in a sequence and after scaling, the points defined in the XML no longer correspond. Let me first say that all the points being scaled around are located in an XML file. They are all relative to the display object's registration point (0,0) when it is normal, i.e. a scale of 1. Also, I have created a class that retains the target object's original Matrix so that the percentage you pass in is relative to the original scale instead of the scale after each call. But basically, with the scaleAroundExternalPoint function by itself, if I have an object that I scaled to twice it's size, the multiplier would be 2. but say I want it back to it's original size. The multiplier would NOT be 1 since that would just leave it at a scale of 2x. It would have to be .5. The important parts of the class are below.

ActionScript Code:
public function ZoomUIComponent(isKeyboardControlled:Boolean = false, disabledAlpha:Number = .25,
max:Number = 2, min:Number = .5, precision:uint = 2,
seconds:Number = 1, step:Number = .1):void{
this.disabledAlpha = disabledAlpha;
this.inControl = InteractiveObject(getChildByName("zoomIn"));
_isKeyboardControlled = isKeyboardControlled;
[Code] .....

It's retaining the original matrix and then calculating based on that EACH TIME. So how would I find the new X and Y values of the original points so that I can scale around them?

View 1 Replies


Similar Posts:


Flash 9 :: Reset Transformation Point/Set Transformation Point?

Feb 8, 2008

When I right-click a symbol the options "set transformation point" and "reset transformation point" come up. They don't seem to do anything for me. I thought it would center them or something. This is not the case. I have the white transformation point in one corner in one keyframe and a different corner in another keyframe I click "reset transformation point" on both frames and they don't move.

View 3 Replies

Flash :: Transformation Using MovieClip.transform.matrix ?

Jul 2, 2009

I have problem when dealing with transform in Flash cs4 ....When I rotate my movieclip and trace the output, my movieclip's width also changed....

View 4 Replies

Actionscript :: Get Transformations From Transformation Matrix In Flash?

Sep 1, 2010

I have transformation matrix properties (a,b,c,d). How to calculate scaleX, scaleY, scewX, scewY and rotation angle from those values?

When only one type of transformation is applied, I can figure out that:

scaleX = a
scaleY = d
scewX = c
scewY = b
rotation = arccos(a) or -arcsin(c)

But when multiple transformations are applied at once I don't know how to calculate those values.

I need to do this outside of flash so I can't use any flash helper methods.

View 1 Replies

Actionscript 3 :: Use Transformation Table In Matrix Class?

Aug 2, 2011

How can I, if it's even possible, use this transformation table provided in my question's accepted answer here in Actionscript 3 in Flash? I understand it might have something to do with Matrix, but I really have no clue if that transformation provided in the answer is possible to implement there. Is it? If so how?

View 1 Replies

Flex :: Animating A Transformation Based On Transform Matrix?

Oct 18, 2010

I have a UI component that I wish to relocate and scale, but in a rather complex way. I've figured out the necessary transformations using the transform matrix, to which I applied several translate and scale operations. I can set the new transform matrix for this UI component to be the above calculated matrix, and the results are accurate; but I need to animate the transition. I can't use the Scale/Move effects alone because they aren't as powerful when it comes to calculating the necessary transformation as the matrices are.So how can I animate the transition of an object given a source and a target transform matrix?Figured it outUsing a tweener and its onUpdate event to reassign the matrix with each intermediate value:

var animMatrix : Matrix = gi.transform.matrix;
TweenMax.to(animMatrix, 1, {
a : m.a,

[code]......

View 1 Replies

Actionscript 3 :: Get An Accurate Reading Of The Pixel Data From A Bitmap With A Matrix Transformation?

Mar 24, 2011

i've filled a circle shape with the bitmap data of a bitmap asset.i need to rotate the circle from the center, so i added the bitmap to the center of the circle and used a matrix transformation to shift the bitmapdata upward and leftward so it appears centered.
now i'm trying to read the bitmap data with getPixel() but the return value is off since it is returning the untransformed position of the bitmap data instead of the visible transformed bitmapdata.

Bitmap(Sprite(evt.currentTarget).getChildAt(0)).bitmapData.getPixel(evt.localX, evt.localY)

how can i get an accurate reading of the pixel data from a bitmap with a matrix transformation? updated with code. assume the redCircleData in my example is more colorful and something worth retrieving pixel data.

var redCircleData:Sprite = new Sprite();
redCircleData.graphics.beginFill(0xFF0000, 1.0);
redCircleData.graphics.drawCircle(0, 0, 100);[code]............

View 2 Replies

ActionScript 2.0 :: Set Transformation Point In It?

Jul 10, 2009

How would I make this grow from right to left?[code]...

View 1 Replies

IDE :: Change Transformation Point With AS?

Aug 11, 2009

Is there any way to dynamically change the Transformation or registration point of a MC with AS3? I'm trying to dynamically create shadows behind clips that skew to follow the sun.

View 3 Replies

ActionScript 3.0 :: Dynamically Setting Transformation Point

Mar 7, 2009

I am creating an interface where a user can pick up "Polaroid" stle photos and shuffle them around a virtual desktop. I want to photo to shift it's transform point to match the point at which the user picked up the photo, to create a "swinging" effect as the photo is dragged.there was an AS2 workaround floating around, but I want to find the AS3 equivalent, and seem to be unable to find it in the Geom/Matrix package/classes.

View 3 Replies

Professional :: Centering Registration And Transformation Point?

Mar 15, 2010

This is giving me such a headache.I have a movie clip and it has a centered registration point but the transformation point is in the top left corner. I want both to be in the center of the MC. I want a little circle with cross-hairs in t in the middle of my MC, if at all possible without moving my MC. But I cannot get that damn cross-hair to budge from the top left corner! When I go into the info window and change the X-Y values of the transformation point, the whole MC just moves to a new position. The infuriating things is, I've done it before but I just can't seem to work out what I did. Please don't tell me to drag the registration point in free transform mode. I can do that, but I cannot drag the transformation point in the same way.

View 9 Replies

ActionScript 3.0 :: Set An Object's Transformation / Registration Point Not The IDE?

Jun 3, 2008

This is probably really trivial, but how do I set an object's ransformation/registration point in AS3, not the IDE?

View 12 Replies

ActionScript 2.0 :: FMX Rotate Symbol On Transformation Point

Nov 11, 2002

I have a triangular symbol that I want to rotate on a transformation point (the pointy tip). The effect is supposed to be like Hollywood searchlights panning around (see pic below). I've done basic rotations with actionscript before, but a transformation point wasn't involved. How is this done? Is the transformation point determined manually on the stage or with actionscript?

View 1 Replies

ActionScript 3.0 :: Sprite's Transformation Point And Insertion Origin

Aug 5, 2011

I am making application which will dynamically create sprites via action script and copy the sprite's image to a bitmapdata object via .draw() function. I would like to store the location of the sprite's transformation point and insertion origin (which would be set within the flash editor when the sprite is created/imported.) Is there a way to access the location of the transformation point and the insertion origin via ActionScript? I just want to read it, I do not need to change it.

View 5 Replies

ActionScript 3.0 :: Senocular Transformation Tool - Registration Point

Jun 27, 2010

I am fiddling around with Senocular's Transformation Tool classes, which allow for a MovieClip to be transformed (rotated, resized, skewed, etc) upon click. Just one tiny problem. I need for the MovieClip registration point to always be centered, so that when I do begin transforming in any way, it transforms from that centered registration point. Here is a picture - I need this done in As3 rather than simply creating a new MovieClip symbol and selecting the center for its registration point, as these pictures are loaded dynamically.

View 6 Replies

ActionScript 3.0 :: Rotating Around Matrix Point To Specific Angle

Mar 5, 2010

I have a slider which I want to use to rotate an image around it's center. This normally is easy but my problem is the clip is made dynamically and the size changes so I can't use the default registration point and I need to assign the center point before I rotate it. I found the rotateAroundExternalPoint function which rotates around a center point fine. How to get it to rotate to a certain angle and then have it stop at that angle. The rotateAroundExternalPoint increments the rotation rather then allowing me to set the angle to rotate to. Is there anyway that I can set what angle to rotate my clip to? It right now increments the rotation by the x coordinate of my slider bar (slider_position.x).

Code:
import flash.geom.Matrix;
import fl.motion.*;
var mat:Matrix = clip.transform.matrix;
addEventListener(Event.ENTER_FRAME,EnterFrame3);
function EnterFrame3(event:Event) {
var center_point_x = clip.height / 2
var center_point_y = clip.width / 2 //
MatrixTransformer.rotateAroundExternalPoint(mat,center_point_x,center_point_y,slider_position.x);
clip.transform.matrix = mat;
}

View 9 Replies

ActionScript 3.0 :: Matrix Transform - Rotate Object Around External Point

Oct 14, 2010

I found the function:
rotateAroundExternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number)
to rotate an object around an external point. The top of the object will always point at the center point which is exactly what I want.

It works fine but its possible to rotate it in an oval instead of in a perfect circle...I think it should be something with the angleDegrees Parameter but im not sure what to do with it. I also tried to set up an own matrix but I failed. Any right direction to orbit an object in an oval, and where the top of the object always point at the rotation center?

View 2 Replies

Flex :: Unable To Recalculate A Value Based On Decreased Current Value?

Nov 2, 2010

I'm trying to build a minimum payment calculator and am having a problem with the minimum payment not being able to calculate based on the current monthly value. What I think should work...locks up the browser. I've commented out the line that is giving me a problem in the code below.

<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"

View 3 Replies

ActionScript 2.0 :: Matrix Algebra And Matrix Inverse?

Apr 5, 2003

Has anyone here ever developed a function (or general library of relevant functions) that will allow one to find the inverse of a matrix? I've searched the forum archives, as well as the internet more generally, but haven't found anything. If anyone has some leads, I hope you'll pass them along.

If I don't hear anything within the next few days, I might try to develop something on my own, but I'd hate to do so if someone has already done the dirty work.

A solution to this problem would be very useful for 3-D work or anyone doing mathematical programming more generally.

View 14 Replies

IDE :: 3D Transformation Of MovieClip In As2?

Feb 26, 2010

i am looking for script for movie Clip distortion and 3D transformation in action script 2.0

View 1 Replies

IDE :: Faulty 3D Transformation - How To Improve

Jan 31, 2009

I'm playing around with Flash CS4 trial and tried to 'compose' a 3d Box by putting 6 MovieClips as the side elements of the box in one clip which represents the whole box. (only using the Flash Tools, no Actionscript). Within the BoxClip (after doubleclick on the BoxClip on stage), all sides look right, each side is positioned with the correct angles and coordinates. Outside the BoxClip, back on root stage, the box sides are not parallel anymore, the angles are not 90 degrees, there is no 'box' actually. So I guess, one of the problems is the 3D Center point of the objects which is absolute to one point in coordinate space. The other problem is the faulty '3D' display in Flash, that is, changing from inside to ouside a clip changes the view also. So far, the Flash GUI seems quite useless for doing some '3D'. How to improve the workflow?

View 3 Replies

Reverse A Skew Transformation In The Flash IDE?

Sep 6, 2011

Place a 100px by 100px box on the stage (not a movieclip, just a simple shape).

Now apply a vertical skew of 30 degrees. You should get this...

Click outside of the shape to release the transformation data. The degrees for skew resets to 0 (this is expected), see image below

But What skew would you apply to the shape to return it to its original shape. Initially I would've thought it was -30 in the vertical skew, but this seems to return a weird hybrid shape.. See below:

View 2 Replies

ActionScript 2.0 :: Extended Transformation Of A MovieClip

Jul 23, 2004

i am developing a kind of (near-)isometric engine (in Actionscript 2.0), kinda simple, which is using MovieClips as wall or floor textures.This is the Wall texture i have:This is what i would like to have:The height is always 1.5 times the width. Its a simple skew transformation.Currently i have two possibilities:I am creating the finished wall in photoshop, save the file as PNG (because of transparent areas). Because i cant import PNGs at run time, i need to create all possible textured walls. A lot of work if i have a lot of textures (Say, i have about 200? )I am importing the original Texture into Flash, and perform a free transform directly in the MovieClip. I still have a lot of work because i have to do this to each textured wall!I would like to do this transformation in Actionscript, so i could import any texture JPG at the runtime (LoadMovie) and just need to have the File names stored somewhere or retrieve them and so on.

I didnt find any possibility to perform a skew transform to a MovieClip in Actionscript..The transformation is just like this: Rotate by 45 deg. (CW) and reduce the height of the finished transformation to 1/2.i am able to apply the _rotation and _height transformations, but the second transformation is always applied to the root object, which often might be very helpful, but right now its not.

View 2 Replies

ActionScript 3.0 :: Transformation Of TextField Around The Center

Sep 2, 2011

I'm developing a flash product designer... one of it's features is that customers can add their own text to product and they can move it, resize it, rotate it... but I have one problem - text is stored in dynamic TextField with embed fonts, it's created dynamically from Actionscript, but it's registration point is set to upper left corner, is there any way to transform it around center? I mean resizing and rotating around center.

View 4 Replies

Scale Transformation Of A Symbol Within A Motion Tween

Nov 29, 2009

I'm making a very simple animated flight plan with 3 airfields and six airplanes as seen from the top. To imitate the effect of take off and landing I want to be able to change the size of the plane when it flies.Only trouble is I can do that only with the Free Transform Tool. Even if I select Modify -> Transform -> Scale I have to change the shape of each object manually and they end up having different sizes. I tried editing the size in the properties box but the fields are greyed out. Any idea how I can change that.

View 2 Replies

Professional :: Motion Editor Transformation Grayed Out

Jun 28, 2010

Why are the scale x and y options grayed out on the motion editor? I tried editing width and height (W&H) in the "properties panel" under "position and size" and all that does is move the position my object diagonally for some reason, not scale the size. Also, when i do this, the Width number does not change, but the x and y position numbers above it change. Strange!

View 3 Replies

ActionScript 3 :: Transformation Of BitmapData To Triangle Points

Nov 11, 2010

I have a big code, but essentially, this part comes to transformation of a BitmapData to triangle points, using affine transformation. Also - I know that BitmapData is rectangular - the last, fourth point of the transformation is just the first one reflected over the axis defined by the other two points.

A small thing so you can see which point is which one:
1........2
. / / / /|
./ / / /
. / / / |
./ / /
. / / |
./ /
. / |
./
3 - - - -4 - 4th point reflected

This whole process would come to scaling, rotating and skewing the BitmapData based on the angles between the points... But somehow my code still does not work. Looking at a similar thing in PaperVision 3D - still didn't work?

View 1 Replies

ActionScript 3.0 :: Manipulating A Circle, Using Two Transformation Matrices?

Aug 31, 2011

I am having trouble with some code, I am trying to get a circle to rotate around a center point, as well as rotate in a circle. at the same speed as its parent circle. however I am having some trouble, and I know it is from how I am transforming the position of its matrix, however I honestly can not find the mistake. below is the code:

ActionScript Code:
import flash.display.Sprite;
import flash.geom.Matrix;
var outcirc: Sprite= new Sprite();

[Code].....

View 1 Replies

ActionScript 3.0 :: Numeric Transformation - Transform 100 Into The Scale 1 To 20?

Feb 29, 2012

I need to scale numbers. I'm using perlin noise to create a random 2d scrolling map. I'm using Blue channel data with values between 0 and 255 (I believe).Each pixel represent a value of height of a tile. For that reason I have to transform this value into a valid value.For example, If my 2d scrolling map has 20 tiles of maximum height and the pixel in the first position is 100.I have to transform 100 into the scale 1 to 20.

View 2 Replies

ActionScript 2.0 :: Fake Perspective Transformation Jazz

Mar 29, 2012

Basically that method of fitting a bitmap texture onto a parallelogram, by splitting the parallelogram into two triangles and skew/shearing the two separate copies of the texture to be lined up with it's respective triangle.Senocular wrote a pretty good tutorial on it, but I'm stuck on some little details and or conceptual stuff, I'm not sure.First question, in the transform matrix, the b and c multipliers (skew and shear), what does it mean exactly? I played around with it and found that shearing by a factor of one, the angle formed by the slope (the slope of the two top or bottom 'points') of the shape was 45˚. So, 1 = 45; 0.5 = 22.5, etc. Am I on the right track or was the 45 angle observation just a coincidence? If so, how exactly do I find the skew factor?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved