ActionScript 3.0 :: Scale From Center After Drag?
May 21, 2010
I have an image inside a movie clip that a user can scale from its center using the slider....works great.However the use can also drag the movie clip.After the movie clip is dragged to a new location it and then scaled using the slider it jumps back to the center of the stage and then scales.I have tried modifying the x y of the movie clip but then the scale is no longer from the movie clip's center.
var clipNativeX = holder_mc.x;
var clipNativeY = holder_mc.y;
function scaleClip(val:int):void[code]......
View 2 Replies
Similar Posts:
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
Nov 29, 2010
I am very new to AS3 and I am running into some issues creating a simple class that will allow you to drag and drop and object but then also scale when it is over a hit area. Here is my current code:
[Code]....
View 5 Replies
Nov 25, 2009
I have created a movieclip with programming and added a image via xml loader. I am scaling it down using tweenlite. But it scales as if the registration point is on the top left of the image. Do you know how to change it so it scales from the center?
View 6 Replies
Dec 16, 2006
Each time the square is clicked it scales up a little. What must be added or changed to prevent it from moving off center from its original position, and to have it scale evenly in all directions from its own center?
Code:
package {
import flash.display.Sprite;
import flash.display.Shape;[code]....
View 2 Replies
Dec 8, 2010
i have a simple rectangle. i would like to scale it to 200 but the scaling always begins from top-left corner of the rectangle. how can i scale it from the center?
[Code].....
View 3 Replies
Jan 21, 2010
when i edit an objects z value in flash, the "scaling" is not centered, i want to emulate the same effect as center scaling x and y but using Z, how fo i do this?
View 1 Replies
Aug 17, 2009
how I could setup an Image so when it loads, and I change its Z value, it doesnt keep shifting in reference to the upper left. Right now, when I change the Z value of a Sprite containing the Image, it appears to move x, y (even though I know they are not changing). I thought that by putting it inside of a sprite, and then moving the image to so that its center was at 0,0 inside the sprite, that when I changed the z value of the sprite and not of the bitmap itself, it would fix my problem, but its not.
bmp = new Sprite();
var bmp1:Bitmap;
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, fileLoaded);
[Code].....
View 1 Replies
Nov 25, 2011
I am using AS2 and I'm looking for a way to scale an MC from the center meaning that the width will expand equally on both sides.For example .. If the movie clips needs to expand +10 then it would be +5 on the left and +5 on the right.So, in order to simulate the movie clip going forward the position on the left would offset -5 then scale.
View 2 Replies
Sep 8, 2011
basically just wondering if its possible to scale an MC about the center of the stage as opposed to the top left of the MC? I thought about setting the X & Y as stage width / 2 + MC width / 2 but cant as the user needs to be able to move the MC which is much bigger than the stage and zoom in on a point in the center rather than just the center of the MC.
View 2 Replies
Jan 16, 2012
I have a list of artist, each one a mc, in a vertical display. Next to them, I have a holder in which I load the thumbnails one the mouse is over a mc.This images, are being loaded via loadclip.. resize-center and then shown with alpha..But sometimes, the image are shown huge, and instantly resized and positioned.This a dvd project.. so images are not being downloaded..this is the part of the code..
Code:
thumb.onRollOver = function() {
this.gotoAndPlay("rollOver");
[code].....
View 3 Replies
May 1, 2010
I am using a slider component to scale a movie clip. Currently it scales from the bottom right corner (I guess this is default). I would like the MC to scale out from the center.
Current Code
// slider
slider.addEventListener(SliderEvent.CHANGE, scaleObject);
slider.minimum = 1;
[Code]....
View 2 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
Dec 1, 2010
I'm trying to add some zooming functionality. The problem is that when you zoom in and out, it scales the MC up and down from where the registration point is. This means That when I'm far from the position of the registration point instead of zooming the in straight it also makes it appear as if you are travelling towards the registration point.
To offset this effect I want to calculate the amount of pixels I need to offset the Map by so that it appears as if you are zooming in directly.
So just as a test I've put a little ball inside the map(called "center") which I'm trying to keep in the center of the map.[code]...
View 1 Replies
Feb 16, 2010
I'm trying to make a text effect where on every frame the textfield increases in size and decreases in opacity. I'm using the scaleX and scaleY properties of my dynamic textfield to enlarge, but it's doing so keeping the left registration point fixed. I want to make it scale up radially outward, or with the center point fixed.
View 4 Replies
Oct 3, 2009
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 Replies
Aug 19, 2006
I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:If anyone knows of a tutorial or example out there, I'd love directions to it(them). or,
View 1 Replies
Jan 20, 2009
When you drag the screen in any direction the background scales and rezises.But How do I make the text stay center and a certain size so that it wont scale to fit the screen and will stay a certain size
View 1 Replies
Jun 21, 2010
Basically, there will be two images, which participants are to choose between. Below the pairs of images will be a horizontal bar with arrows at both opposite ends. I would like the participant to be able to drag and drop a small rectangle somewhere along the bar to represent their choice (and the degree of their endorsement).Basically, I'm asking how to make an interactive scrollbar on its side (without buttons, just the drag). I would also like it to start in the middle of the bar and be able to be moved in either direction.
View 2 Replies
Jul 4, 2004
[URL]like the drag and scale part? kinda of understand how to do it but had some difficulty structuring it in Flash MX.
View 2 Replies
Jan 31, 2010
does anyone know a code which would let you drag and drop objects and also be able to scale them at the same time.
View 0 Replies
Sep 14, 2009
I'm trying to create this drag and drop sequence where the "temperature_small" movie clip is dragged and dropped onto a spot on the stage. I've got the drag and drop part of the ActionScript ready, but the trouble comes when I want to re-size the movieclip to make it smaller, I keep getting the error code:
[Code]...
View 4 Replies
Feb 8, 2011
I drew a farm and I want to be able to move the animals around, also to make it a bit more real, they need to scale down proportionally along the y axis, I have been searching for a tutorial or download to no avail.
View 9 Replies
Jul 19, 2009
I have a AS2 movie clip that has a drag navigation. The movie clip is bigger then the visible area. How can I find the center xy of the current visible area when I stop the drag?
View 2 Replies
Aug 19, 2011
I have a movieclip, that is draggable (horizontally), i have this code (helped achieved by Kglad!):It has a nice effect, but when i click to drag the movieclip jums to its registration point.
var completeTween:Boolean;
var finalMouseY:int;
var startMouseY:int;
mc.addEventListener(MouseEvent.MOUSE_DOWN, onDown1);
[code]....
View 19 Replies
Oct 23, 2010
I have a round movieclip ( like a ring or clock ) and i want to press and drag it to rotate it around it's center ( AS3 ). I tried hundreds of ways but none of them works perfectly. I think i miss something in trigonometry and flash's rotation concept.
View 8 Replies
Apr 19, 2006
I nedd to build a "See if you have the right weight" wheel in Flash. It have to be a small wheel over a bigger one. The top one have to be drag and drop like it was pined to the other one, so it rotates around the center axis (when click and drag with the mouse over), allowing us to match the scales in the wheels as we like.
I've found a lot of tuturials about drag and drop objects in Flash, but freely, not around a fixed center axis.
View 1 Replies
Jan 31, 2010
I am learning AS3 and trying to get an object to be able to move / rotate / scale and drag and drop. I found 2 seperate tutorials one does button clicks to move and rotate code.[code]When I add the second lot of code to the first app (ie add a layer and insert the script ) change myPoint to rocket . I get the following errors:'{' expected
View 1 Replies
Apr 11, 2006
how can i scale a movieclip by clicking it and drag the corner points of it.
View 3 Replies
Jun 25, 2010
'i am doing a game for children where users can drag and drop resize and scale movie clips on stage!The drag and drop is not an issue...
View 2 Replies