Flash :: Get Scale Of A Matrix Object?
Mar 14, 2011
Most often, questions are asked about how to scale a DisplayObject, and the answer is usually to use a Matrix.
My question is, how to you GET the scale of a Matrix (scaleX and scaleY)?
There's a Matrix.scale method to set the scaleX and scaleY, but it doesn't return a value, and no other properties exist to read it back.
The reason I ask, I'm using object burried deep down into a Display list, and each may be transformed. So I use the child object's sprite.transform.concatenatedMatrix getter, but am stuck at this point on how to read the scale from it.
View 2 Replies
Similar Posts:
Jun 22, 2011
my problem is that if i scale, rotate or translate a display object using its transform.matrix i am not getting the value in the display object but the transform is happening like displayObject.scaleX or displayObject.scaleY etc. i get this new transform value using the dislayobject? as i am using a matrix transform manager which actually changing the transform matrix of the display object.
View 8 Replies
Jun 29, 2011
I'm using a transform matrix as part of a bitmap draw to select an area of my target rather than drawing from 0,0:
var bmd:BitmapData = new BitmapData(target.width,target.height,true,0);
var mat:Matrix = new Matrix(1,0,0,1,-target.x,-target.y);
bmd.draw(this,mat);
[code]......
View 1 Replies
Feb 4, 2008
how to scale down flash images using BitmapData and Matrix?? I'm using it for fullscreen so that the images are always perfect. I've been tampering with this, but cannot get it to work properly.
View 3 Replies
Jul 21, 2009
Unfortunately geometry is not my strong point and I am on a deadline. I am trying to determine if a textfield is larger than a displayObject and that it does not sit outside the x and y of said object. If it is larger, I need to scale it and make sure it is always in the confines of the displayObject space. On a side note, i need to scale the size of the text accordingly.
View 0 Replies
May 31, 2011
Im currently building a little 3D particle engine in flash the uses sprites.to set the position of each sprite I am using the projectVector function below. (the viewTransform matrix is the particles world matrix concatenated with a perspective projection matrix)
var projectedPoint:Vector3D = Utils3D.projectVector(viewTransform, point);
sprite.x = projectedPoint.x;
sprite.y = projectedPoint.y;
[code].....
View 1 Replies
Jan 11, 2012
I've been working on an FXG Editor, and I'm using the the senocular transform tool to move, rotate, scale and skew an object.
Is it possible to detect if the the Display object has been skewed just from inspecting the matrix of that DisplayObject? even if said object has been move, scaled and rotated as well.
I want to only serialize the matrix of an object to FXG if has been skewed and not if it has just been rotated, moved, or scaled.
View 1 Replies
Jan 28, 2009
i want to assign a transform matrix to an object, but i want to assign the values myself (as in, no 'rotate, scale etc'), but for example, set a matrix like
[Code]...
which if applied, would have no effect, but would be valid (actually not exactly that matrix, but you get the idea). i want to set the values of the matrix and the object should be affected by those values that i set by myself, no scale rotate or any predefined operations. how can i set my own matrix?
View 4 Replies
Nov 10, 2010
I tried many Flash .swf before and they all can be scaled freely -- by using a width and height in the HTML, and sometimes in the URL params or flashvars. But is it true that all Flash object can be scaled? For example, can some Flash objects using absolute coordinates to plot graph so that every 10 pixels it marks 1, 2, 3, 4, 5, and no matter what is done at the HTML or any where else, it just won't scale and the browser can't do anything about it either? Is there a way to scale it to half the size for that graph? (that is, 1, 2, 3, 4, 5 is separated by 5 pixels instead of 10 pixels)
View 1 Replies
Oct 2, 2010
I have a question concerning the use of the matrix objecThe following code works well to rotate the sprite from its center if its x and y properties don't change.However, if I drag and drop the clip somewhere else after having rotated it, and then add a new rotation, it keeps rotating from the previous rotation point. Even if I add point =new oint(myspr.x+myspr.width/2, myspr.y+myspr.height/2); in a function that is called at the end of the drag and drop, the rotation point remains the same.So,how to update the position of the matrix rotation point if the x and the y of the clip change on the scene after a rotation?
Code:
var myspr=new Sprite();myspr.x=100;myspr.y=100;addChild (myspr);var point:Point=new Point(myspr.x+myspr.width/2, myspr.y+myspr.height/2);rotateAroundCenter(myspr,45);
[code].....
View 1 Replies
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
Jun 29, 2011
I have a div with a flash object in it. That div is going to pop up in a modal triggered when a user clicks a thumbnail of the flash presentation. The problem occurs when I try to use the scale effect to scale in or out, it errors out.
Here is the HTML:
<div id="modal">
<object id="presentation" width="720" height="576" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="[URL]" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value=" video.swf" />
<param name="quality" value="high" />
[Code] ......
View 1 Replies
Oct 27, 2011
I've created an mc which functions as my map and controls to go with that which allow the map to be moved around and key points navigated to and zoomed in on at varying zoom levels.I'm using scaleX and scaleY to scale the map mc and a list of x and y positions to correctly position the map for each key point.When I want to go to a certain area I perform this calculation (offsetX and offsetY are the center of the screen):
newX = posX * scale + offsetX;
newY = posY * scale + offsetY;
Then I tween the position and scale of the map to smoothly scale and move the map to the correct position:
var tween = new TweenLite(_background, EASING_SPEED, {x:newX, y:newY,scaleX:scale.getScale(),scaleY:scale,ease:EASING_TYPE,onComplete:moveToComplete,onCompleteParams:[room]});
I now need to implement a zoom in / out function and this is what I'm struggling with. The zoom should use the center of the screen as the reg point for the scale, so I've been trying something along the lines of the following to get the correct positioning:
var newX = offsetX - (offsetX - _background.x) * scale;
var newY = offsetY - (offsetY - _background.y) * scale;
So in my mind this gets the distance from the current position of the map relative to the center point of the screen (offsetX, offsetY) then scales that distance by the new scale. However, this is clearly wrong because it's not working and the positioning of the map is wrong.I've also tried using a transform matrix to get the correct values but I know even less about them and not got the right results.
function scale(target:MovieClip, center:Point, scale:Number):Point {
var m:Matrix = new Matrix();
m.translate(-center.x, -center.y);//move the center into (0,0)
[code]....
View 3 Replies
Feb 7, 2012
What I am doing now is loading a .png image with a Loader object. After loading the file I cast the loaderInfo's content to a bitmap and set the smoothing value to true. This works without a problem until I reach a ScaleX and ScaleY value less than 0.5.
For example, if I have a 1000x1000 object, scaling it down to 200x200 causes the bitmap smoothing to no longer work.[code]...
View 1 Replies
Dec 9, 2003
getting a bitmap to apply smoothing properly after being scaled very small.What I am doing now is loading a .png image with a Loader object. After loading the file I cast the loaderInfo's content to a bitmap and set the smoothing value to true. This works without a problem until I reach a ScaleX and ScaleY value less than 0.5.
For example, if I have a 1000x1000 object, scaling it down to 200x200 causes the bitmap smoothing to no longer work.I can reproduce the problem using all of the following Sizing methods:
Change the scaleX and scaleY properties on the bitmap. Directly change the height and width properties of the bitmap. Add the bitmap as a child of another sprite and change the scaleX and scaleY properties of the sprite. Add the bitmap as a child of another sprite and change the height and width properties of the sprite. Creating a new BitmapData object with a matrix scale and then drawing the original BitmapData onto it.I've also tried some other workarounds that I found when searching, such as:setting the scaleX of the image to 1.001 or 0.999 forcing the height and width of the Bitmap object to be even numbers.
Below is some sample code for reproducing the problem. (I am running this locally so I have a copy of testimage.png in my bin-debug folder)
public class MainObj
{
public var comp:UIComponent;
public function MainObj()
[code]....
View 2 Replies
Nov 7, 2009
I am working on a project where I need an interactive matrix of 500x500 clickable elements. I thought this would be an easy task in actionscript3 but boy was I wrong. I was able to create a matrix where each element was a Sprite object with attached Mouse click event. But here the performance problems begin. FlashPlayer10 can handle up to 100x100 matrix, but when I increase my matrix I start getting script timeout in browser player... Here is how my "unfinished" matrix looks like.So how should I approach this problem? I was hoping flash will be able to handle so many elements, but I guess I was wrong. I want to have a pan control to pan around for objects off screen and of course zoom in/out control.It's true I'm not very professional in Flahs and actionscript but a friend who is told me this would be no problem implementing in AS3? I need this in flash as the thing needs to be hosted on website.
View 6 Replies
Aug 18, 2011
Background: Sorry for the complex title, but can't think of a better way to describe this. So I have an image which is constantly moving and rotating (using matrix rotation around a specific point) on the stage. Problem: So I'm looking for a way that, when the user presses a button, a smaller image (exactly the same as the original one, only 3 times smaller) to position itself so that the smaller image's location is proportional to the the larger one's location. This means that the exact point of the larger image where it is rotating should be the corresponding part of the smaller image, thereby causing a kind of zoom out effect.
The truth is, I'm finding it even difficult to match just the x and y positions so they correspond, ignoring rotation, assuming the position is relative to the rotation point. Even this would be useful.
View 5 Replies
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
Jan 20, 2010
I have a video inside of another movieclip. When I go full screen, I scale up the outer movieclip to fit the screen. So that OuterMovieClip.width is equal to screenWidth etc. How do I maintain the aspect ratio on my video so it does not get distorted? Whats the proper math for that?
View 1 Replies
Feb 19, 2010
I want my flash content to scale when I scale my browser window.
View 5 Replies
Aug 15, 2004
How to scale an object using actionscript?as you know scaling using motion tween is not as smooth as using as.
View 1 Replies
Oct 11, 2002
I know it's possible to scale and rotate an object by using some actionscript. Is it also possible to distort an image?
For example; keep the topleft corner and the bottomleft corner of an object at the same position and put the topright and bottomright corner of the same object 25 pixels down.
View 14 Replies
Dec 4, 2009
My Flash image will not scale.if you zoom in, it gets chopped up. if you zoom out, it has a big blank area.What should I change in order to have this Flash image scale just like the rest of the site? [URL]It is the Flash in the center.
View 1 Replies
Oct 5, 2009
Let's say I have a movieclip, which contains a simple circle draw on it. What I need is to scale the movie clip along a random line (not vertical or horizontal only). The picture attached probably illustrates what I mean. The only idea I can have is to combine usual scaling and rotating.
View 0 Replies
Oct 24, 2009
i'm trying to get randomly moving objects to scale up as they move further away from their point of origin, I'm haveing trouble with this. I've attached the current random movement code below:[code]
View 0 Replies
Feb 26, 2005
I need to scale and move a object at the same time.
Like in this example but with actionscript instead of motion tweening.
View 1 Replies
Sep 4, 2005
I have a little problem, I'm writing an app, where flash attaches a movie with attachMovie and in addition, I add an object with its _x,_y,_xscale and _yscale. Now what I need to do, is not to attach a movie, but to load it with MCL. The problem is,that I don't know how to attach an object with its _xs and _ys to a movieclip loaded. Furthermore, when loaded,it doesn't appear in a library, so I could attach it. Setting parameters manually would take tons of time, so I'm looking for most "economical" solution.
View 4 Replies
Oct 27, 2007
I'm trying to get the same effect as this page[url]...
View 9 Replies
Jul 30, 2009
When I created a Bitmap object from drawling the pixels of an image and then scale that Bitmap too large (or even too small) the image disappears or in some cases distorts in what appears to be random pixels barfed all over my screen.
In order to show you this I have made an example: [URL]
(click the plus button any more than 8 times and poof! the bitmap disappears)
And source: [URL]
(Flash CS4)
View 3 Replies
May 24, 2010
I have had some help but still not understanding this.
How can I scale an object from center after it is dragged by the user?
Currently I have this:
function onSliderChange(e:SliderEvent):void
{
scaleClip(slider.value);
}
[Code]...
With this code the movieclip jumps back to the center of the stage each time I call the scaleClip() (move the slider). I would like the object to scale from it's own center regardless of where it is on the stage.
View 2 Replies