ActionScript 3.0 :: Scaling Bunch Of Point Objects Relative To Center Stage
Jan 8, 2012
All though I can scale down the size of my objects and can shift them to their correct positions when scaling. I cannot shift them to the correct relative positions, relative to the screen centre.
Code:
level=1; //starting scale level
public function scaleOut(level:int) // scale to a level 1-4{
for (var r = 0; r < Main.ballArray.length; ++r){
// scale radius
Main.ballArray[r].bRadius *= (oldLevel / level);
[Code] .....
View 8 Replies
Similar Posts:
Nov 9, 2010
I'm trying to figure out how to find a point relative to the center of an object, modified by its rotation. For example, in the attached swf, I've been messing around trying to draw trails to a bitmap, coming out of the thrusters. I didn't have a problem at first, but as the ship rotated, the lines that were being drawn wouldn't remain relative.
http:[url]....
I'm sure this is because I have no idea what I'm doing, and I've just been sort of idioting my way through it. That aside, is there an easy way to find the point I'm looking for? For instance, say I want a point at Y -14 of my ship, but I want that to remain relative to the ship as it rotates.
View 14 Replies
Sep 16, 2011
So let's begin. I want to build a wheel which you can spin, similar to a roulette wheel. You can do this both ways (CW and CCW, this issue causing the bug, actually). The wheel has some acceleration to it too, and I achieve this by measuring the start and final angle of the drag movement, using Math.atan2(dy, dx). The problem is the following: atan2 outputs the following angle scheme, assuming the point relative to which the math is done is in the center of the circle.
atan2 returns a value measured in radians, so I'm using the classic angle*180/Math.PI formula. I've changed this original scheme into the following, using some simple math to shift the angles a bit, to resemble more accurate circle angles (going up to 360 degrees) The problem that I'm facing at the moment is should the user decide he wants to swipe clockwise, and moves through the right point, where 0 turns into 360 or 180 turns into -180, the whole angle difference thing is capsized. It registers a CCW movement (as if the user swiped his mouse all around the circle). So, I'm looking for some ideas as to how I can work around this small issue.
View 1 Replies
Jan 30, 2009
how to proportionally scale multiple movieClips relative to the stage size.
I understand movieclip placement relative to the stage, and I have been using a code to scale MovieClips as a fullscreen background (also proportionally)
But
I can not figure out for the life of me how to scale other movieclips in relation
to the stage size.
for example I have a background_mc that proportionally scales with the stage
to fill without distortion.
HOW do I then place another MC say center aligned (I know how to do that) that will scale with the background without distortion?
Ideally I would like to place several MC's on my stage all scaling in proportion with the stage yet independently.
I have not been able to find any documentation on this. lots of tutorials on backgrounds and color fills and the like but nothing on proportional scaling of independent mc's
this is the code I use for my background_mc (can it be modified or should it be thrown out the window to achieve independent scaling?)
Code:
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
[Code]....
View 7 Replies
Jan 30, 2009
I need some assistance on how to proportionally scale multiple movieClips relative to the stage size. I understand movieclip placement relative to the stage, and I have been using a code to scale MovieClips as a fullscreen background (also proportionally) But I can not figure out for the life of me how to scale other movieclips in relation to the stage size. for example I have a background_mc that proportionally scales with the stage to fill without distortion.
HOW do I then place another MC say center aligned (I know how to do that) that will scale with the background without distortion? Ideally I would like to place several MC's on my stage all scaling in proportion with the stage yet independently. I have not been able to find any documentation on this. lots of tutorials on backgrounds and color fills and the like but nothing on proportional scaling of independent mc's this is the code I use for my background_mc (can it be modified or should it be thrown out the window to achieve independent scaling?)
[Code]....
View 2 Replies
Oct 19, 2011
I'm writing a web based flash app that's written entirely in AS3. I have objects on the screen as part of a GUI. I would like the user to be able to resize the window, or make it full screen. I would like everything to auto-scale with the resize, but also remain in the same relative position on the stage.
View 1 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
Dec 26, 2005
I was wondering how "relative alignment" such as on the easybit-site (take the window and resize it) is done? All objects on the stage are positioned always relative to the actual window-size without losing quality, but how???
View 2 Replies
Dec 24, 2009
I have an swf in which objects go outside the boundaries of the stage (but are properly masked). Whenever I externally load this swf into a container it scales down to fit in the objects located off stage. EX:I have tried removing the objects outside the boundaries and the stage does not shrink the image. The container is the same dimensions as the external swf.
Code:
function open_puzzle(openSWF:String)
{
//Load SWF
container = new MovieClip();
[code]....
View 1 Replies
Aug 15, 2009
I have a center window and a background in my flash file. I am trying to get the center window to stay in the center of the web browser screen and get the background to expand and fill the entire web browser screen below center window layer. Sort of like this site [URL] I've currently converted the background to a movie clip and have this code.
[Code]....
View 11 Replies
Feb 23, 2011
i am looking for class or something to proportional outside scaling of stage and all included objects (internal or external).I know SWFfit and LiquidStage. I have got many problems with integrating SFWfit to my code (resizing is not affected to included objects). LiquidStage seems to be ok but it`s not freeware . I am looking for free possibilities to do it.I am trying to connect that with GAIA framework.
View 3 Replies
Feb 20, 2004
I have a dragable movie clip that on release I want to scale, depending on the mouse position, the further the mouse up the screen (y) then the smaller the clip scales on release.
View 6 Replies
Aug 31, 2010
I don't seem to be able to find the right wording to find my answer anywhere.How do I determine where an MC's center is relative to its edges?I'm developing a tool that a variety of noobs (as if I'm not still a noob) will be using, and I don't trust them to keep art with 0,0 being the top left corner.How do I figure out that the left edge is now at -111px, and the top at -52, and the right at 12, and the bottom at 334?
View 3 Replies
Sep 8, 2009
I have a bunch of objects that are dragable. You click and hold the mouse button to drag them around, then release the mouse button to put them back down. The problem is that when an object is dragged so that another object is between it and the mouse cursor, and the mouse button is released, the object gets stuck to the cursor. Clicking and releasing the mouse button is the only way to drop the object. Is there any way to fix this? Or, better yet, is there a way to make it so an object is immediatelly moved in front of every other object when it's clicked on?
View 3 Replies
Feb 21, 2011
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]....
View 1 Replies
Mar 11, 2008
I've search through all the threads with "scaling" and "resizing" and can't find the solution.
Basically I have a GUI element on a gallery that I don't want to scale, while the rest of the page is free to resize/scale.
I think I need to add a listener of some sort to the stage, but I'm not sure how to do this.
View 2 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
Jun 1, 2010
I've had the nagging thought of eventListeners vs container looping. For example, you could create a bunch of objects and store them in an array; make a loop that traverses the array and tells each object to execute a method. In contrast I could tie an eventListener to the object in it's constructor function that tells it to perform a task every frame.
View 6 Replies
Sep 23, 2011
After adding an image to the stage, turning it into a Movie clip, and setting linkage in library to Export for Actionscript, I'm now using a timer to add a bunch of roses to the stage as a video plays.How can I get rid of all these clips once the video is over?Do I need to add all of them into an extra container and then just removeChild that container at the end? Or do I need to use something like getNumberOfChildren and then create a loop that removes them one by one?The clips (myRose) are fairly small and do not have any event listeners added to them. I just use TweenMax to move them from top to bottom of the screen.
public function roseTimer():void
{
MonsterDebugger.trace(this, "in roseTimer");[code]......
View 4 Replies
Dec 6, 2002
I am making a thing where a bunch of square shaped movie clips will be placed on the desktop, and will be draggable. I was wondering if there was a way to get them to stick together... similar to the snap to objects tool. Like say I am dragging one and I want to make a large square out of the smaller squares. I want them to snap together...
View 5 Replies
Jun 25, 2009
i was trying to scale with mouseWheel into a map with _root._xscale and _root._yscale. it works fine but i cant center my map after the scaling.i want the map to be centered at _root._xmouse and _root._ymouse.
View 1 Replies
Jan 26, 2011
I have been looking to scale an object up if it's less than 70-px from the center of the object. I started to use the below and at least the distance was working but when combined with the conditional it all falls apart as the object mousePoint changes rapidly.This works fine when tracing:
ActionScript Code:
var mousePoint:Point = new Point(this.mouseX,this.mouseY);
var mcPoint:Point = new Point(0,0);
[code]....
View 6 Replies
Sep 17, 2010
But i have a rectangle and i want to scale it using actionscript with a tween (part of a series of functions that i am writting for one of my buttons) so i am able to adjust with a tween its width but it uses the left part of the rectangle. I want to scale the width of the rectangle from the center point of the rectangle and not the upper left corner. How can i actionscript that?
View 2 Replies
Feb 12, 2010
I've tried using:
[Code]...
on frame 1, but they don't seem to work. I'm going to be putting this project on a CD and the client wants to make sure it will open centered on the user's screen, which has not been the case so far. It seems to open at different spots on different computers. They also want the title bar changed from "Adobe Flash Player 10" to their own title.
View 4 Replies
Jun 23, 2009
I want to create an animation which simulates a camera pulling backward through a forest of trees. I've created a tree symbol and I can scale it down over time, which looks pretty good. So theoretically I can generate a whole punch of these trees on either side of my stage and gradually scale them down toward a common vanishing point in the middle of the stage (and I will also gradually move the vanishing point off to the side to simulate the camera pull back transitioning into a sideways pan). The problem is that scaleX, scaleY attributes always scale down toward a preset registration point on the symbol that I don't seem to be able to change programatically at runtime, whereas I need to be able to scale the tree toward the vanishing point.
The only solution I've come up with is to parent the tree symbol to another invisible symbol whose registration point IS at the vanishing point, then scale down that invisible symbol so that the tree scales down and also transposes itself in the direction of the vanishing point. But this feels cumbersome. I bet there is a way to do this with matrix math, if only I had a better understanding of it.
View 1 Replies
Nov 4, 2010
I am trying to delete a bunch of different things from the stage all at once.I have 3 dynamically created text fields and 2 dynamically created movie clips.I added them to the stage through my document class buy creating them, editing their properties and then...
addChild(myText1);
addChild(myText2);
addChild(myText3);
[code].....
View 3 Replies
Apr 13, 2011
I am testing with scaling a cube, like so
Code:
private function growCube():void {
TweenLite.to(cube3, 2, {scaleX:1.5 , scaleY:1.5, scaleZ:1.5} );
[code].....
View 1 Replies
Feb 20, 2009
I have a loop which creates a bunch of movieclips and sets them on the stage.As I create each one I attatch an eventListener to it.My problem is that when the eventListener fires, the function it calls always works on the first mc added to the stage, not the one that fired the listener.How do I fix this?Here's a bit of the code:
Code: Select allfor (var i:int=0;i<numOfItems;i++) {
item = new Item();
//etc etc[code].....
View 1 Replies
Jul 16, 2010
How can I draw objects relative to one another in AS3? For example I have a small object in the middle of a large object. Then I move the small object to the left (subtract x) but visually I see the large object move to the right and the small object stay still.
View 4 Replies
Nov 4, 2010
I have a scale up and down function that increases or decreases the size of an external loaded image inside a loader. What i am now trying to do and having trouble with is playing certain messages when the scaling reaches a certain point.
For instance when the user uses the 'increaseScale' function and scales 'image_Content' up by 40% its original size then 'warning_msg.visible = true;'
When they increase it by 65% then 'stop_msg.visible = true;'
This will then respond the same way if the user decreases the scale back to 40% and so on.
I cannot work this one out, i have posted the code below and have attached the fla file...
Code:
//------------------------------------------------------------------------------------
// Messages
//-----------------------------------------------------------------------------------
[Code]....
View 2 Replies