Actionscript 3 :: Algorithm - Scale Rotated Objects Properly?

Mar 17, 2010

This is unfortunately a quite complex issue to explain, so please don't get discouraged by the wall of text - it's there for a reason. i'm working on a transformation manager for flash, written with Actionscript 3. Users can place objects on the screen, for example a rectangle.

This rectangle can then be selected and transformed: move, scale or rotate. Because flash by default rotates around the top left point of the object, and I want it to rotate around the center, I created a wrapper setup for each display object (eg. a rectangle).

[Code]...

Now, to the question: should I use a different kind of setup, system or structure? Should I maybe use matrixes, if so, how would you keep a static width/height after rotation? Or how do I fix my current wrapper system for scaling after rotation?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Get Scale Value From Rotated Image?

Aug 21, 2009

I have made an application where you can design your own greeting cards. I use matrices to scale and rotate images, and I always need to know what scale the image has.

It works when the image isn't rotated, by taking the value from matrix.a or .d which are the scaleX and scaleY values. But when I rotate the image, using the matrix.rotate() function, the a and d values no longer corresponds to the scale of the image.

How can I get/calculate the scale value of an object that is rotated? And I don't want to scale the image by using the scaleX and scaleY methods.

View 9 Replies

ActionScript 3.0 :: Lining Up 3D Rotated Objects Mathematically

Jan 4, 2010

Is there a simple way to take a few square images and set rotationY for each one to be the same degrees, then using an equation line each clip up after the previous one? For some reason the width property of the rotated clips is not lining them up correctly for me. I managed to get the desired result by trial and error (see below), but really need to get an equation for this so I can move the clips around with little hassle.

View 4 Replies

ActionScript 2.0 :: Testing For Collisions Between Rotated Objects

Oct 14, 2006

I'm writing a general physics engine and I've come across the problem I've always had with flash. So far all my hittests in my physics engine have been calculated by using x/y coordinates and the 2 objects dimensions. This has worked fine for the objects so far because they have been very square-ish and do not rotated. How ever now I am trying to detect if 2 rotated objects are hitting. How can I do this ? I would really like to avoid using any .hitTest() functions.

View 5 Replies

Professional :: Why Imported Ai File Won't Scale Properly

Feb 24, 2010

The stroke on one of my symbols(rivet) becomes increasingly thicker for no reason when i import my ai file. .

View 2 Replies

AS2 :: Scale Objects With It?

Sep 7, 2010

I have a purple box on the stage. I turned this box into a movie clip with the instance name of "purple." onEnterFrame, I want to increase the wdith of that box. It is currently 11.75px. I want it to ease into 40px. I want this to happen onEnterFrame.

View 2 Replies

C# :: Properly Create Game Objects?

Dec 30, 2009

I am making sims like game and right now I am trying to figure out how I will structure my objects. right now I am thinking to create a class called GameObject, the psuedo is below

public class GameObject {
name:String
width:int
height:int
}

This way I could create objects like bushes, trees, and buildings. But then I began to think. what if I wanted to create multiple buildings and trees of the same type ?? I would have to keep making instances of GameObject and giving it a new name and height and width. The properties would have to be the same values in order for me to duplicate one object. That seems a little tedious. Then I figure , maybe that isnt the right way to go. So I was thinking, I would have to extend GameObject like below

public class Tree extends GameObject{
birdHouse:Boolean
}
public class Building extends GameObject{

[code].....

Now this way I can create a class that has a method that loosely accept accepts any type that inherits GameObject.

Selector.loadObject(gObject:IGameObject);

Depending on what type it is (i.e tree, building, house) I can use a case statement to figure out which type it is and evaluate it accordingly.

I also created a Tile Class that will pass through the loadObject method. It also will be a child of the GameOject class. if the case statement finds that it is type Tile, it will highlight whatever Tile depending on what tile my mouse is over.

My second question is if a class inherits a class that implements a interface, is that class child class considered to be a IGameObject as well. or does it have to implement that interface directly. does all this sound like I am going in the right directions lol, as far as organization is concerned.

View 3 Replies

ActionScript 3.0 :: RemoveChild() And Cleaning Up Objects Properly?

Jun 26, 2011

I'm a relatively experienced programmer, but I'm completely new to as3my question is how can I remove one object and subsequently all it's child objects and their listeners?I need to remove all objects from a certain object called "world". My objects are all on top of this "world" object. the game has a level object which is on top of this "world" object and it produces enemies among other things on an enter frame event.To remove this from the stage I call the world.destroy() method from the main timeline.

Code:
// * Destroy the world
public function destroy()

[code].....

View 5 Replies

Flash :: Repositioning Objects Based On A Scale?

Jan 19, 2010

I have airplanes that are flying past the screen from a top down view. when the air planes crash, I scale them down to make it appear as if they are falling closer to the ground and farther away from the screen. I have turrets on these crafts as well. they are seperate objects from the air plan. I scale them down as well. The only problem is they dont reposition correctly. they stay in their x and y positions even though they are being scaled it looks as if they are being pulled away from the air plane. is it possible to reposition them correctly based on the size on the object they sit on (i.e. the air planes)

View 1 Replies

Scale Multiple Objects And Motion Paths At Same Time In CS4

Oct 19, 2009

I have a CS4 document with many objects, motion paths over multiple layers. I want to scale everything, including the motion paths of each object. I've tried to do this by Clicking 'Edit Multiple Frames', then 'Selecting All Frames' and finally scaling everything via the Transform panel. Everything appears to have been scaled apart from the motion paths. Is there a way to do this?

View 2 Replies

ActionScript 2.0 :: Scale Objects When Switched To Full Screen

Jan 30, 2008

Would anybody happen to know if there is a way to scale objects accordingly on stage when switching to fullscreen.. It's sort of like when the stage is set to "scale", and all the objects scale accordingly, but I'm trying to scale the objects while having the stage set to "noScale"..

View 1 Replies

Actionscript 3 :: Calculate An Objects Scale Using A Perspective Projection Matrix?

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

Ruby On Rails 3 :: HTTPService Not Properly JSON-encoding Nested Objects On Send()?

Nov 22, 2011

i am creating an object like this:

var myObj:Object = new Object();
myObj["someProperty"] = {
anotherProperty: "someValue",
whateverProperty: "anotherValue"
}

now i want to send it to a web server (rails):

var service:HTTPService = new HTTPService();
service.url = "http://server.com/some/path/entry.json";
service.method = URLRequestMethod.POST;
service.send( myObj );

the problem is that the server receives the json like this:

{"someProperty"=>"[object Object]"}

is this a problem with HTTPService? should i use the good old loader/urlrequest and serialize myself? by the way, serializing and then passing the string doesn't work, webserver receives empty request as GET.but i kinda want to use the httpservice class though...

View 2 Replies

ActionScript 2.0 :: Rolledover Clip To Scale Up And All The Others To Scale Down And Blur?

Mar 8, 2007

Scenario: main moveiclip with 4 other clips in it. I want the rolledover clip to scale up and all the others to scale down and blur.

Question: What is the most effiecent way to code this. Would it be a "for in loop"? I am trying to minimize the code and would rather not use a whole bunch of if then statements.

View 3 Replies

IDE :: Flash Content To Scale When Scale Browser Window?

Feb 19, 2010

I want my flash content to scale when I scale my browser window.

View 5 Replies

ActionScript 2.0 :: Initialize X Scale And Y Scale Into Percentages?

Jan 14, 2006

How can I convert the current scale of the instance to 100% so I can easily "visualize" and manage the instance when I modify its scale? Here's the actionscript, it works, but I just want the temp._xscale and temp._yscale to be in percentages, not real numbers.

Code:
USflag.onMouseDown = function ()
{
var temp = USflag;
onEnterFrame = function ()

[code]....

One last thing, what's the tag you have to put that is designed for boxing actionscripts? I'm suing [ code ][ /code ]

View 1 Replies

Actionscript 3.0 :: What Algorithm I Should Use?

Dec 20, 2010

[flash=]
package app.demo.MyTouchApp{
import flash.display.Sprite;[code]..........

how to perform a search in XML, so I use the above method, kinda hard code I know...for example, I try to search " keyIn:String = "BR1014"; " means I wanna search BR1014 in 4 XML files, so I load the XML info into an array, and using for loop to loop the XML array (in this case TitleArray1[i], TitleArray2[i]...) and compare it with keyIn (which store the value BR1014), some how the value is located in TitleArray4[i] which have the length of 12 (trace(TitleArray4[i].length) = 12)

so everytime I run it, I will overwrite abc 12 times... and out put 12 time the abc value, in this case BR1014 was located in TitleArray4[3], so the 4th output of "abc" is BR1014 but others is all 999...

View 2 Replies

ActionScript 2.0 :: Crossing Algorithm?

Jun 4, 2011

I have table

words = [aaaa, bbbb,cccc,dddd,eeee,ffff]
and i want to make table like this:
words2 = [aabb,bbaa,ccdd,ddcc,eeff,ffee]

View 1 Replies

Sql :: Realization Of An Algorithm In SQL Query?

Dec 14, 2011

I have a database which has 2 tables:

CREATE TABLE RecipeDB (
RecipeID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR,[code]........

I also have an actionscript, in which I have ingArr:Array of ingredient strings.Now, I would like to realize the following queries here:

1) Select (all fields) one recipe which has the most of ingredients from the array. If more than one record have the same amount of matches, then divide the number of matches by total number of ingredients in recipe and return the one with the highest ratio. If there are no matches return nothing.

2) As above, but return 10 recipes with the most matches and do not perform check for equal number of matches. Sort the results by the number of matches.

View 2 Replies

Scale A Flash Using Dreamweaver - Can't Get It To Scale

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

ActionScript 3.0 :: Algorithm - Stimulate Sea Wave

Dec 15, 2011

I want to stimulate sea wave,but I have no idea about it. Is there an example code for it? I know as3 can make many good graphics and text effect, so I want to learn it eagerly,but I don't know which book should I read. Anyone could introduce a good book for me about as3 algorithm? More example code are better in the book.

View 3 Replies

Java :: Sha Or Md5 Algorithm Encrypt And Decrypt?

Feb 25, 2010

I am developing my application in flex and JSP, so when I am passing values through HTTP Service Post method with request object but these values are tracing and modifying by testing team so I am planning to encrypt values in flex and decrypt it in jsp.so is there any algorithms like SHA or MD5 more secure algorithms,

[Code]...

View 4 Replies

AS3 :: C - Implementation Of Upper Power Of Two Algorithm

Mar 1, 2011

I have been trying to implement the Round Up Power Of 2 algorithm outlined in the following link in AS3.

[Code]...

The algorithm works great for most of the values I've tested. It is mentioned that this will return 0 when given an input value of 0 which is technically incorrect but I'm ok with that output. What I'm not ok with is when given an input of 1 I get and output of 1. I'm thinking that this must be a caveat of AS3 and its wonky uint implementation but I can't seem to figure it out. I have also tried using the >>> logical shift operator to the same result. My C is a little rusty, but I'm not sure how this would even return 2 in C. Can someone explain to me whats going wrong here? I assume if an input of 1 was a special case it would have been mentioned in the above link.

View 1 Replies

Flash :: Erase Algorithm To Be Implemented Using AS3?

Jun 10, 2011

Is there any algorithm to perform erase operation in a bitmap? I would like to create functionality similar to how photoshop or other graphic application performs erase. Is erase operation so difficult that there isn't much help (for bitmaps) available? I am OK even with name of an algorithm, I can proceed from there.

View 2 Replies

Flash :: Algorithm To Create Concertina?

Sep 12, 2011

I've searched and racked to no avail.. so, does anyone have an algorithm to create a concertina type rectangle, ideally horizontally. The desired effect is exactly like that of normal horizontal Window Blinds (assume they're closed- doesn't matter) of say 30 parts (or slats) of equal height and uniform width.

When such a blind is raised half-way up notice how the parts at the bottom go from dead flat to an increasing value in height, with perhaps the top-most part hanging normally.

Similarly, when the whole Blind is all the way up, all parts are flat. Conversely, when the whole Blind is fully extended, all parts hang at their own, uniform height. It's this "slightly differing but related to my neighbors height" I'm stuck on.

View 1 Replies

ActionScript 2.0 :: A Algorithm Of The Number's Sequence?

Dec 13, 2004

how to implement this algorithm: I have number (1-100), however, it will return to 0, when it meets 10, likewise 11 returns to 1, 12 to 2...

90 -> 0
91 -> 1
...

View 3 Replies

ActionScript 3.0 :: Button Animation Algorithm?

Apr 26, 2008

I have 5 Button movieclips, each with different states, (OVER, OUT, and ACTIVATED)Obviously when you rollover the button, itll play the over animation, itll also apply for the rollout event of the button. When you click the button, itll go to the activated state.Here's my question...What condition will i use so that when a certain button is activated and i click on a different button, the activated button will play its rollout state before going to its idle state.. What's happening to me is itll just quickly go to its idle state without playing his roll out animation.

View 8 Replies

ActionScript 2.0 :: Making Algorithm Using Two Arrays?

Jul 25, 2008

I am programing with AS2 so here goes my question: I want to create an algorithm that looks up an array and finds the nearest integer in it. Lets say i have different numbers like 1, 2, 4, 5, 8, 9 and i want to find the nearest member to 6 from those numbers. How should i build the algorithm. So far i'm using two arrays and two inside loops, but cant find the right way to make it.

View 3 Replies

ActionScript 2.0 :: Cyclic Algorithm In Flash

Jun 5, 2004

my program calculates ax,ay -> using this variables -> vx,vy -> after that I calculate the little step that my mc will make, in other words I calc x,y position [code]as you can see all depend on each other...but the problem is that after getting new x,y I want this x,y to be used to calculate next step!fo every new coordinate I want new vx,vy ax ay!

View 8 Replies

ActionScript 2.0 :: An Algorithm Of The Number's Sequence?

Dec 13, 2004

I met a problem while I am learning the flash actionscript 2.The question is how to implement this algorithm: I have number (1-100), however, it will return to 0, when it meets 10, likewise 11 returns to 1, 12 to 2...

90 -> 0
91 -> 1
...

View 3 Replies







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