ActionScript 3.0 :: Changing Object Properties (scale) Through Point?

Nov 9, 2009

I have developed a flash app in AS3 that allows you to drag objects around on stage, save,and load them. When the "save" button is pressed, it then loops through each item on the stage and gets the coordinates (x and y) for the bottom left corner and the top right corner. Code:

Code:
ActionScript Code:
var bottomLeft:Point = new Point(-50, -50);

[code]........

View 3 Replies


Similar Posts:


Actionscript 3 :: Flash - Center An Object Around A Point After Scale?

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

ActionScript 3.0 :: Way To Scale Up An Object From Its Center Even If Its Registeration Point Is At The Top Left?

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

ActionScript 3.0 :: Change The Rotational/scale Point On A Object/sprite?

Jul 31, 2009

When you load a object through flash, you can set the rotational/scale point, but when you load it as a loader object or sprite, how do you change this point?

In this instance, I want to change the height of a sprite that is filled with a rectangle so that it shrinks down, not up.

Right now:

var colored_bar:Sprite = new Sprite();
with (colored_bar.graphics) {
beginFill(0x9e1819, 1);

[Code]....

The way I am doing it currently is moving the y position everytime I take away soem of the height, so it looks like it's moving down, but I'd think moving the orientation point at the beginning would be faster

View 2 Replies

ActionScript 3.0 :: Changing Object Properties With Code?

Apr 21, 2011

For the first stage, I was able to build a walk-through demo in flash pro by creating buttons that when clicked caused the flash to change to different frames. easy enough. Now for the final part of this project, I need to make the interface fully interactive, as I was trying before. ie: you can click any button and lights go on and off or a loop counter increments, etc. Since there is logic involved and too many permutations to do a frame for each possible state, I'm back to trying to do this in an object oriented way. I've got some test code here.

<fx:Script>
<![CDATA[
protected function button1_clickHandler(event:MouseEvent):void
{

[code]....

debugger has some errors, so i don't know what exactly it will do. the errors are at the last two if statements where i'm trying to change the object property setting of the label. there is another error at the last curly bracket.

the idea is that there are two labels and a button. the first label starts out visible. when the button is clicked, a counter is checked, and incremented, then the counter is again checked and the appropriate label has it's visible property set to true. the intent is that in a list of several labels, pressing the button scrolls down them, until you press while on the last, which resets the counter and the first label becomes the visible one.

View 3 Replies

ActionScript :: Xml - Setting Object Properties From Other Object Properties?

Jun 25, 2010

i'm attempting to cast an object's property as an actual property of another object. here's my object variable: var propObj:Object = {prop:"width", width:50}; now i want to assign the property of a sprite using that object's properties. var sp:Sprite = new Sprite(); sp.(propObj.prop as Sprite.property) = propObj.width; now, i'm not even going to try that because i know the compiler will explode all up in my face. but you should be able to see what i'm trying to do. why i'm trying to do it is because i'm reading in an XML file with an undetermined list of usable properties for specific objects. so instead of writing something like a huge switch statement to evaluate whether the XML file has a value for that specific property, i'm trying to assign properties dynamically based on what's available in the XML file. if what i'm trying to do is possible, what's the best way to do it?

View 1 Replies

Actionscript 3 :: Scale Around Point Using BitmapData?

Jul 2, 2011

I've searched but haven't found anyone wanting to do this with a bitmapData object.I'm using the following code:

matrix.identity();
matrix.translate(pan.x, pan.y);
matrix.translate(-zoomPoint.x, -zoomPoint.y);[code].....

Panning works, but using this method scale does not scale around my mouse.Has anyone done this successfully?

View 2 Replies

ActionScript 3.0 :: How To Scale (multiply) A Point In Oneline

Jun 19, 2011

I have a point which is 3,5 I want to scale, or multiply this point, by a factor of 5. To give me 15,25 What I'd really like to be able to do is: mypoint *= 5; but that doesn't work. I can't find any suitable method in the point class either. So what I'm trying to do now, which all research indicates should work, is:

[Code]....

View 3 Replies

ActionScript 3.0 :: Scale MC About Point In Center Of Stage?

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

ActionScript 2.0 :: A Line From One Point Past Another Point And Whether It Hits An Object?

Aug 19, 2009

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 Replies

ActionScript 2.0 :: Trace The Properties Of An Object's Properties?

Jan 30, 2008

I forgot to put it in the title so I'll just place it here; I am using AS 2.0. I know that there are other ways to accomplish the goal that am after, but I was wondering if anyone knows of a way to access the properties of an object's properties?

Here is the code that I thought of, even though it doesn't work

var a:Object = new Object();
a.bproperty = 0; //lowerlevel properties
a.cproperty = 1; // lowerlevel properties

[Code].....

This really just boils down to how I am organizing the code(I have ideas on what do next, and i am 99% sure that I can get them to work), and if there is a way to dynamically access the properties of the objects properties, It will save me from creating yet another large block of code for my project. If you want to see the unfinished project, go to [URL]

View 3 Replies

ActionScript 2.0 :: Make An Object Move From Point A To Point B In An Arc?

Mar 27, 2008

how to use these in order to make an object move from point A to point B in an arc.Think of that classic game where you have to input the angle and power and try to hit your opponent.

View 1 Replies

ActionScript 3.0 :: Find Center Point Of Mc With Dynamic Scale?

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

ActionScript 2.0 :: Scale A Beam To Mouse Co-ordinates/point?

Oct 23, 2008

I have attempted to make a movieclip scale in the y axis using _yscale but I can't seem to make it scale to the exact mouse co-ordinates.

Its within a rotating movie clip (controlled by the position of the mouse) and that works fine.

Here's the code I'm using at the moment.

Code:
onClipEvent(enterFrame){
var disty = this._y - this._ymouse
var dist = Math.sqrt(disty*disty)
this._xscale = 100 + dist;
}

View 6 Replies

ActionScript 3.0 :: Rotate Around Point With 3D Properties?

May 20, 2011

The 3D rotation properties (rotationX, rotationY, rotationZ) all revolve around the objects registration point. Is there any trick to change where the rotation center is?

View 7 Replies

Actionscript 3 :: Scale A Dynamic Textfield In Flash From The Center Point?

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

Flex :: Scale To Point (Zoom Into Image Where Mouse Clicked)

Jun 14, 2010

There is an Image control that when I click on it I need to zoom in (using the center/transform point where the mouse is clicked). I have the zoom transition working great, but when I set transformX & tranformY (with autoCenterTransform false) it doesn't zoom into that point.

Here is my code that only zooms in (not to a specific point)
<fx:Script>
<![CDATA[
protected function imgLogo_clickHandler(event:MouseEvent):void {
transformer.play();
} ]]>
[Code] .....

View 1 Replies

Changing Color With Sliding Scale?

Mar 2, 2010

I am looking for a way to create a sliding scale, not unlike a horizontal scrollbar that changes the background colour of a page as it moves left or right. Whats the best graphics software for this?

View 1 Replies

Flash :: Changing Y-scale Of A Movieclip?

May 5, 2011

I'm trying to change the y-scale or x-scale of a movieclip. I've tried a few tutorials but they're always talking about "elem._yscale".. However it's no longer supported by AS5.

View 2 Replies

IDE :: Move An Object From One Point To Another Point On Graph?

Jan 9, 2006

Basically what I like to ask is how to move a object from one point to another point based on the point tat you have clicked on a graph. For example, If I click on this coordinate (2,3) on graph, the object (movie clip) will move to that point.

View 3 Replies

ActionScript 3.0 :: Rotating Around Center Point While Updating .x & .y Properties?

May 27, 2010

I want to be able to rotate the ship around the center point and be able to update the .x and .y at the same time.I've got this two versions of code.1

Code:
if (aKeyPress[38])
{

[code].....

View 2 Replies

ActionScript 3.0 :: Draw A Rectangle Or Circle Shape With Mouse And Scale By Setting The Point?

May 11, 2009

I want to make an editor like this site. [URL] If you browse this link you will find "Button. If you press this button you will navigate to a editor to design your layout. After draw a rectangle or circle or line you can resize that or can rotate that. When you finish if press the "you will back to the previous page where your desinged layout display. If you press the "" again then you will navigate the editor with the previously designed layout. I want to make a site like this. I want to use the flash cs4 to make the editor. Anybody knows how to draw a rectangle or circle shape with mouse and how to scale by setting the point and how to rotate by setting the rotation point also by using flash cs4 and as3?.

View 3 Replies

Flex :: Canvas - Change Scale Without Changing Size?

Mar 23, 2012

I'm developing a Zoom tool in my Flex App, so I'm using scaleX and scaleY property to simulate this behaviour.But when I scale my Canvas, its size change as well (obviously). The problem is that I have this Canvas inside another Canvas, so the first Canvas can't be smaller than the second one.Here is an image before and after apply zoom changing scale property in both axis:At the left, the original Canvas. At the right, Canvas after update its scale (red rectangle is the original size at 1:1, and green is after resize).I need to extend the Canvas to take up the red rectangle (not the green).

View 1 Replies

ActionScript 2.0 :: Changing MovieClip Scale When Button Pressed

Jun 12, 2002

Is there any possibility to combine those two handlers. I want a movieclip changing its scale when a button is pressed. The change I would write as this:
onClipEvent(enterFrame) {
if (_scale<200) {
_scale+=10;
}}

But I can't write
on (release) {
onClipEvent(enterFrame) {
...
Is there a way to realize it?

View 4 Replies

Copying MovieClip And Changing Properties

Dec 11, 2009

I have a movie clip with a graphic. I want to copy the clip and change its colour. How do I create a copy of the movie clip change its properties without the other movieclip's properties changing as well. I have it now. I was copying the instance not the graphics themselves.

View 1 Replies

ActionScript 3.0 :: Changing Properties Of Strokes?

Feb 3, 2009

I have a series of movieclips containing strokes on my timeline in Flash. I need to change the colour of these strokes dynamically in Flash when various actions are performed on said movieclips. I'm able to change fills successfully with colorTransform, but it doesn't seem to work on strokes

View 0 Replies

ActionScript 2.0 :: Changing Layer Properties?

Jun 2, 2002

how to change the property of one layer on a rollover of another?For instance,I want to change the color of some words on a different part of the page when I rollover a button.

View 9 Replies

ActionScript 2.0 :: Changing Properties Of A Symbol

Mar 16, 2009

I have a movieclip simply animated with motion tween. On each keyframe, I made sure to name it introPhoto_mc.Now, before the movieclip first appears, I would like to change its content (just a picture change, dynamically loaded with loadMovie). But if I do so, then the next keyframe will obviously reset the instance to the original content.So I suppose I should modify the actual symbol so that every instance will have the desired content. What is the correct approach? OOP ?

View 4 Replies

Copy A Movie Clip And Changing Properties?

Apr 17, 2009

I created a movie clip which loops some text, i would like to populate the stage with instances of it but also with some in a different colour. When I copy frames from my clip and paste them into a new symbol(movie clip) the colour of the other instances changes as well.

View 1 Replies

Flex :: Changing Css Properties For Selector At Runtime?

Oct 27, 2009

I have a css that defines de skin-class for a custom component, like this :

view|PlaceHolderView {
skin-class:ClassReference('view.skin.PlaceHolderSkin');
}

Is there a way to change that value at runtime, so that all instances of the component switch skin?

View 1 Replies







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