Calculate Centre Point Of Rectangle In Flex?

Feb 23, 2012

I have two rectangles: var rect1:Rectangle = new Rectangle(66,147,89,67);

var rect2:Rectangle = new Rectangle(155,147,89,67);

How to calculate the centre point of these rectangles based on their x and y positions. I want the centre point to be calculated with relative to stage

View 2 Replies


Similar Posts:


Alignment - Centre The Number In Relation To The Rectangle Behind It

Oct 6, 2009

thought I'd posted this but clearly not I created a rectangle and in the centre using the text tool places the number 1 try as I might I cannot find an easy way to centre the number in relation to the rectangle behind it. Is there an easy way? tried the alignment tools but failed

View 1 Replies

Flex :: Actionscript 3 - Find Upper Right Point Of Rotated Rectangle?

May 2, 2010

I have a rectangle of any arbitrary width and height. I know X,Y, width, and height. How do I solve the upper right hand coordinates when the rectangle is rotated N degrees? I realized if it were axis aligned I would simply solve for (x,y+width). Unforunatly this doesn't hold true when I apply a transform matrix on the rectangle to rotate it around its center.

View 2 Replies

ActionScript 3.0 :: Calculate Inner Rectangle?

May 20, 2010

how to find the biggest possible area within a rotated image (the black rect in attached image), but can't figure out how to calculate the points TL, TR, BR, BL to draw my rectangle (the red rectangle in attached image).

View 3 Replies

ActionScript 1/2 :: Change The X - Y Cordinates So The Centre Point Is In The Middle Of The Dynamic Text Box?

May 16, 2010

I need to make the "rcheck2_txt" rotate 180. With this script it does what I need. But currently the centre point is in the top-left corner of the dynamic text box. How do i change the X Y cordinates so the centre point is in the middle of the dynamic text box?

[CODE]...

View 3 Replies

AS3 :: Auto-Centre - MovieClip Always Stays In The Centre Of The Stage On Resize?

Jul 22, 2009

Just a quick one. Using AS3, how would I ensure that a movieClip always stays in the centre of the stage on resize?

View 1 Replies

ActionScript 1/2 :: Calculate By Math The X Position Of Point 1?

Oct 28, 2010

I´d like to know if there´s a way to calculate by math the x position of point 1. There´s some coordinates at the image here attached. The "mc" movie clip is the main triangle.

View 5 Replies

ActionScript 3.0 :: Calculate Mouse's Distance To A Certain Point?

Dec 4, 2009

What I am trying to do with AS3 in Flash cs4 is calculate the cursor's distance to given point (let say 400,300) and use that distance to constantly (20 fps) change my curtain's alpha value. (which is basically a box turned into a movie clip) [code]...

View 5 Replies

ActionScript 3.0 :: Check If Point Is Within A Rectangle?

Mar 16, 2010

I'm trying to create a drag-to-select feature. Basically, I'll have several dynamically created mc's and want to be able to click and drag to select several of them at once.I have it so I can drag to draw a square and I have the x/y coords of my mc's. My question is, how do I tell if the x/y coord of the mc is found within the area of the square?

View 7 Replies

ActionScript 3.0 :: Mathematically Check If A Point Is Inside A Rotated Rectangle?

Oct 12, 2009

i need to check if a point is within a rotated rectangle. I have to do this mathematically, as none of the objects are on the stage so i can't use hitTestPoint. I know the position and rotation of the rectangle, and if necessary can get the four corners as points as well.

I kind of feel silly asking this, because i am pretty sure it's not a hard thing to do, i just can't work it out and so far any google searches just bring up hitTestPoint.

View 14 Replies

Actionscript 3 :: Draw A Rectangle Using The Graphics Class, But Move The Registration Point?

May 18, 2011

I have the following code to create a Sprite with a rectangle in it:

container = new Sprite();
container.graphics.beginFill(0x00CCFF, .5);
container.graphics.lineStyle(1, 0x00CCFF);[code].......

The only thing is, I'd like the registration point to be in the middle (not the top left corner). Is there a way to set up the registration point in the middle of the rectangle, but still have the position of the rectangle be correct?

i.e. not moved over so that the top left corner of the rectangle is in the "middle" of where I want the rectangle to be...

View 1 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

Actionscript 3 :: Trigonometry - Radius Out To The Outer Concentric Circle And Calculate The Position Of That Outer Point?

May 29, 2011

I've got two concentric circles with their centers at (centerX,centerY). The inner circle has a radius of 100 and the outer circle has a radius of 400. If take a point on the circumference of the inner circle, I can draw a line from the center to that point. Let's call that point x1,y1). I now want to continue that radius out to the outer concentric circle and calculate the position of that outer point (x2,y2).

I'm adding a 3px 'dot' just to show where x1, y1 is on the screen. (Subquestion: I can't see it...not sure why.)This is what I'm trying:

var x1:Number = 100;
var y1:Number = 50;
var x2:Number;[code].............

View 1 Replies

Flex :: Making Background Image To Centre?

Feb 15, 2011

CustomAppSkin Class

<?xml version="1.0" encoding="utf-8"?>
<s:Skin name="CustomApplicationSkin"
xmlns:fx="http://ns.adobe.com/mxml/2009"

[code].....

View 1 Replies

ActionScript 3.0 :: Calculate Age From XML Data; Calculate Dates

Jul 1, 2011

I as this working in AS2 and need to update to AS3...shows that AS3 doesn't like sloppy coding. Here's what I need: I pull data from an XML and that works when I put the data into a dynamic text box. However, I can't seem to get the date of birth into a variable. I have some code that calcs age in years but uses a string literal that I thought I could just replace with a variable from my XML...ain't a workin'. Here's the code I have:

ActionScript Code:
import flash.display.*;
import flash.text.*;
import flash.events.*;

[Code]......

View 0 Replies

Actionscript 3 :: Scrollbar With Sprite And Rectangle Won't Move Text, Just The Rectangle It's Painted On?

Mar 8, 2010

For those of you still with me, I am tasked with making some scrollable content in Flash. Load in a TextFile using LoadURL(), then display it. To get the text, we've written our own class TextFieldExtended, which is basically just there to give the textfile location to the constructor and then have the class do the various steps of getting it and loading it for you.So I needed to get a Scrollbar, which I got hereThe thing is, it works with Sprites.After trying to get it to accept TextFieldExtended, I bumped into a block, since the scrollbar relied heavily on a Sprite property that TextFieldExtended didn't have or could have.

So I tried adding the TextFieldExtended instance to a Sprite instance using addchild.A problem occurs here that I do not know how to handle. It seems that a Rectangle is drawn and the Text is drawn on that. I say this because the scrollbar moves the Rectangle up and down a bit, but the text doesn't scroll, just the Rectangle it is positioned in and the text then moves along with it.My question: can this be fixed, or is does this implementation of scrollbars need a lot of adaptations before this is possible?

View 1 Replies

Flex :: How To Calculate The Xmldata

Aug 18, 2010

i'm getting the xmldata from the httpservice (using cgi) and i have not set resultformat(it is coming as an object only),the xml data in this format

[Code]...

when i was tried to count the employee tag,i getting the problem, my code will like this:

[Code]...

View 1 Replies

Draw Rectangle Should See Little Bold Circle To Indicate A Perfect Rectangle

May 20, 2009

I draw a rectangle i should see a little bold circle to indicate a perfect rectangle, I seemed to lost mine, can somebody please tell me how to get it back!

View 2 Replies

Flex :: Calculate The Sum Of A Datagrid's Rows?

Jun 6, 2010

I have this datagrid which has columns with a NumericStepper as an itemEditor where the user can change the number of items he wants to buy. How can I calculate the sum of all cells when the user updates datagrid's values?

EDIT 1

My datagrid is about colors and sizes of a product. The columns are generated dynamically from this function

private function getColumn(dataField:String, headerText:String,editable:Boolean) : DataGridColumn
{
var column:DataGridColumn = new DataGridColumn(dataField);

[Code]....

the row.size28 is generated dynamically. So it could be row.size29,row.size30 etc.

How can I loop through all my cells without knowing their data.property?

View 1 Replies

Flex :: Calculate Absolute Height Of Dropdown?

Apr 5, 2012

I have many dropdowns in my flex application. Now I want to set rowCount property so that as many rows as possible so there is less scrolling when see the dropdown items.The flex application was running on a popup window. So I think I have to know the distance from dropdown to bottom border of window, and then calculate what number should be for the rowCount. Like Height/per row height.As I known, the dropdown.y is the relative y coordinate of itself. But my dropdown has many parent UI layout component, and also I have many dropdowns, it is hard to calculate one by one.

View 1 Replies

Actionscript 3 :: Flex - Calculate Hours Between 2 Times?

Oct 23, 2009

I am building a scheduling system. The current system is just using excel, and they type in times like 9:3-5 (meaning 9:30am-5pm). I haven't set up the format for how these times are going to be stored yet, I think I may have to use military time in order to be able to calculate the hours, but I would like to avoid that if possible. But basically I need to be able to figure out how to calculate the hours. for example 9:3-5 would be (7.5 hours). I am open to different ways of storing the times as well. I just need to be able to display it in an easy way for the user to understand and be able to calculate how many hours it is.

View 2 Replies

Flex :: Calculate The Height Of Parent Element?

Jun 3, 2010

I have three datagrids inside VBox container. Since I don't want scrollbar in my flex widget i am increasing the height of SWF through javascript, which increases with each addition of row in my datagrid. My query is how can I get the exact height of my VBox which is the parent element of datagrid. I am not able to get the height of VBox. I have tried to use measuredHeight,height with no success.

View 1 Replies

Actionscript 3 :: Flex - Calculate Checksum Of Different Files?

Aug 11, 2010

I am developing an application in flex in which I need to calculate checksum of different files. I would like to know if there is a direct method in actionscript to calculate that or do I have to go for any external libraries?

View 2 Replies

Flex :: Calculate Drop Location Using Dragcompletehandler()

Apr 8, 2011

I have this <s:list> with an itemrenderer and arraycollection as dataprovider. Now my problem is I want to be able to drag and drop to reorder those items. To do so I need to know the dragged item index, and the drop location. I have the selected item index but when I want to calculate my drop location using this code in my dragcompletehandler()...

[Code].....

View 1 Replies

Flash :: Packet Loss Calculate In Flex

Feb 21, 2012

How I can calculate packet loss from Flex.

View 1 Replies

Flash :: Packet Loss Calculate In Flex?

Feb 21, 2012

How I can calculate packet loss from Flex.

View 1 Replies

ActionScript 3.0 :: Convert Rectangle To Curved Rectangle?

Aug 2, 2011

I am trying to convert a rectangle(actually multiple rectangles) to a curved rectangle. I think it should be pretty easy but I guess i am stupid. Basically I would have a start position and stop position (many of these), and they would be converted to curved rectangles and follow in a cicrle around.

View 0 Replies

ActionScript 3.0 :: Creating A Rectangle Inside Of A Rectangle?

Jun 26, 2010

I would like to create a rectangle inside of a rectangle, starting approximately 15% inward from the right side of the other rectangle.

I know how to create rectangles with:

Code:
var newHotRect:MovieClip = new MovieClip();
newHotRect.graphics.beginFill(0x00FF00);
newHotRect.graphics.drawRect(0, 0, 100, 100);
addChild(newHotRect);

But how would I make another rectangle on top of that (the black one pictured) that is approximately 15% from the right?

I toyed around with .right, and .bottomright with no success. Can anyone lead me in the right direction? or even finding the x and y of the upper right or bottom right side of a rectangle?

View 10 Replies

ActionScript 3.0 :: Rectangle To Rectangle Collision Response?

May 20, 2011

how to respond when a rectangle hits another rectangle? I already know how to detect the collision, I just don't know how to respond to it. I'm just trying making a simple side-scrolling platform game where I have platforms I can walk on and bump against on all sides. I have searched everywhere and just can't find the tutorials I'm looking for.

View 6 Replies

Flex :: Calculate Start And End Angle Of Piechart Slice?

Jul 18, 2009

In Flex 3 how to calculate start and end angle(point) of every pie chart slices?

View 1 Replies







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