ActionScript 3.0 :: Create Polygon From Array?

Jun 30, 2009

I'm trying to figure out how to draw a polygon from an array. I've found a few examples, one which the author says works, but am not getting anything to appear. I've traced the array (it's registering) and am getting no errors.

Code:
//called from constructor
polygon(thisArray);

[code].....

View 1 Replies


Similar Posts:


Flex :: Calculating The Area Of A Polygon When The Polygon's Points Are Lat Longs: Which Function Is More Accurate?

Jul 28, 2010

I'm trying to find a way to calculate the area of a polygon using lat long coordinates in a Flex 3 site. Hong007 on Google Maps for Flash group was cool enough to post the following function:

[Code]...

I was also playing around with the area calculator at [URL]. These functions produce slightly different results. I'm trying to figure out which one is more accurate. It seems that hong007's function produces results that are on average slightly larger than freemaptools' function. However, I don't know which one is more accurate.

View 2 Replies

ActionScript 3.0 :: Polygon Drawing App?

Aug 10, 2011

I want to create an app for drawing polygons with a variable number of vertices, with the following requirements (very similar to a vector drawing program such as Adobe Illustrator):

-each click of the mouse on the stage sets a vertice (e.g. draws a small square or circle to mark the spot), which draws a line to (e.g. LineTo) the prior vertice, and so on, until the final click, if close enough to the first vertice, will complete and close the polygon

-each of the vertices of the completed polygon should be draggable with the mouse, so that that completed (or partially completed) polygon maintains its integrity while changing shape, that is, so the user can modify the polygon shape without having to redraw it. it's the second step I'm having the most difficulty with...in general terms, how would I implement this? Perhaps each vertice should be a draggable Sprite containing a small square or circle graphic?

View 8 Replies

Professional :: Getting Points Position From A Polygon?

Jul 1, 2011

if there is a way to get by Actionscript the position of points in a polygon made using Pen Tool?

View 3 Replies

ActionScript 3.0 :: Get Pixels Of Bitmap From Polygon?

Mar 20, 2011

I know that I can collect the pixels of a rectangular area within a Bitmap using getPixels(), but is there a way to collect the pixels of a polygonal area with more than 4 points? Or at least determine whether a particular pixel lies within a polygonal area of a Bitmap?

View 7 Replies

Actionscript :: Fill A Polygon With A Solid Color?

Oct 8, 2009

I'm building a map editor for a project and need to draw a hexagon and fill it with a solid color. I have the shape correct but for the life of me can't figure out how to fill it. I suspect it may be due to whether the thing is a Shape, Sprite or UIComponent. Here is what I have for the polygon itself:

import com.Polygon;
import mx.core.UIComponent;
public class greenFillOne extends UIComponent {

[Code].....

View 2 Replies

Actionscript 3 :: Breaking A Concave Polygon Into Convex Ones

Mar 16, 2010

I'm using a game physics library (Box2D) which only supports convex polygon shapes. However, I'd like the level builder to be able to just specify concave polygons without having to worry about that. So, how can I automatically break apart a concave polygon into convex ones (or even all triangles). Speed would be cool, but ease of implementation is more important. The breaking apart will only be done on game initialization.

View 2 Replies

Flex :: 3D Object Compression (By Polygon Reduction)

Jun 11, 2010

I wish to develop a software for 3D object compression (by polygon reduction) in flex using papervision 3D.

View 1 Replies

Add A Polygon As A Marker In Google Maps Flash Api?

May 9, 2011

I am creating a project in Flash using the Google Maps API and docs. I'm trying to add a marker to the map, which is draggable but I don't want it to look like the standard Google Maps bubble-style marker. Is it possible to have a custom polygon or image but still keep the draggability?

View 2 Replies

Actionscript 3 :: Creating A Polygon From A Set Of Coordinate Pairs?

Dec 12, 2011

I'm making an app in Flash, and I want to define some polygons which I can bind hover events to to add annotations to an image.I can create these normally in Flash, but I want to load some external data, a list of coordinates, and create the polygons with ActionScript.

Obviously they're just hotspots, so I want them to be invisible, but searching for my problem only shows results for drawing polygons from coordinates using the graphics property of a movieclip.The data doesn't ever change, so it would be possible to just draw all the polygons manually with the pen tool, but the data is being used elsewhere, so it would be much easier to maintain if I could add new zones just by updating the text file.

View 2 Replies

ActionScript 3.0 :: Line - Polygon Intersetion Detection?

Aug 25, 2011

I'm working on a method to do more accurate path finding for a special project. I haven't yet found any sources on this so i have to write it myself.

The idea was to use a polygon mesh, draw waypoints between all points then discard ways intersecting with a polygon. After that use dijkstra's algorithm to find the closest path.

Detecting whether a line intersects with a polygon mesh is the tricky part. I haven't yet come up with any viable solution that is fast. how i can determine whether a waypoint travels through a polygon?

View 9 Replies

ActionScript 3.0 :: Flash Autofill Polygon In Real Time

May 25, 2011

I am creating a game where I have some red balls on the screen and some blue balls on the screen and I would like to draw a polygon around all balls of the same color and have this polygon automatically fill as soon as the polygon shape is closed. How to achieve this as I haven't really done much with the drawing API before. My current code will allow me to draw a polygon and for it to fill when I release the mouse but what I would like it to do is automatically fill as soon as the shape is closed.

Here is my code so far
Code:
var graphix = new MovieClip();
addChild(graphix);
var points:Array = [];
stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
[Code] .....

View 2 Replies

ActionScript 2.0 :: Create Array Inside An Array Dynamically From An Unknown XML Tree?

Dec 28, 2010

Actionscript Code:
<root><node><child><grandChild></grandChild></child></node></root>

Actionscript Code:
Arr[0]=rootArr[0][0]=nodeArr[0][0][0]=childArr[0][0][0][0]=grandChild

Help needed to create Multidimensional Array from Recursive XML.

All I need create Array inside an Array dynamically from an unknown XML tree.

View 3 Replies

ActionScript 3.0 :: Create Dynamic Array Element Names Based On Another Array?

Jun 28, 2009

Is it possible to, if you have an array of class names like ActionScript Code: var city01names:Array = ["pic_01", "pic_02", "pic_03" ...] make a new array which would read these names, instantiate them, and push them into a new array containing the instances of all these pictures, which I could then use for a slideshow?

[Code]...

View 7 Replies

Professional :: Can't Close Marquee Performed By Lasso's Polygon Tool?

Mar 18, 2011

When I double click to close the selection, the marquee vanishes instead of closing the selection.  Yes, I double click on the starting point.Here's what the manual proclaims (step 4):
Draw a straight-edged selection area1 Select the Lasso tools Polygon Mode modifier in the options area of the Tools panel.2 Click to set the starting point.3 Position the pointer where you want the first line to end, and click. Continue setting end points for additional line segments.4 To close the selection area, double-click.

View 1 Replies

ActionScript 3.0 :: Function - Drawing The Polygon Based On The Number Of Sides

Dec 29, 2011

I'm trying to create a function that draws a polygon with two parameters that are: number of sides and length of sides. You would input a number for side length and a number for the number of sides. Then it would draw the side length, then turn at a angle based on the number of sides, then draw side length again... until it has finished drawing the polygon based on the number of sides that were put in.

View 1 Replies

Flex :: Determine If A Series Of Points (or Polygon) Is Within A Rectangular Region?

May 20, 2011

I have been looking at posts about determining if a point lies within a polygon or not and the answers are either too vague, abstract, or complex for me. So I am going to try to ask my question specific to what I need to do.I have a set of points that describe a non-straight line (sometimes a closed polygon). I have a rectangular "view" region. I need to determine as efficiently as possible whether any of the line segments (or polygon borders) pass through the view region.

I can't simply test each point to see if it lies within the view region. It is possible for a segment to pass through the region without any point actually inside the region (ie the line is drawn across the region).Here is an example of what I want to determine (red means the function should return true for the set of points, blue means it should return false, example uses straight lines and rectangles because I am not an artist).

Another condition I want to be able to account for (though the method/function may be a separate one), is to determine not just whether a polygon's border passes through the rectangular region, but whether the region is entirely encompassed by the polygon. The nuance here is that in the situation first described above, if I am only concerned with drawing borders, the method should return false. But in the situation described here, if I need to fill the polygon region then I need the function to return true. I currently do not need to worry about testing "donut" shaped polygons

Here is an example illustrating the nuance (the red rectangle does not have a single vertex or border segment passing through the on-screen region, but it should still be considered on-screen):For the "does any line segment or polygon border pass through or lie on screen?" problem I know I can come up with a solution (albeit perhaps not an efficient one). Even though it is more verbose, the conditions are clear to me. But the second "is polygon region on screen?"PS I have a function for determining line intersection, but it seems like overkill to use it to compare each segment to each side of the on-screen region because the on-screen region is ALWAYS a plain [0, 0, width, height] rectangle.

View 2 Replies

ActionScript 3.0 :: Get The Polygon Boundary Points Of A Sprite Or Movie Clip?

Feb 5, 2009

I'm working on a pathfinding algorithim using A* and using irregular polygon shapes as obstacles rather than a grid. I don't fancy plugging in all the points and links by hand and was wondering if there was some way I could just get them from a Sprite or MovieClip?

View 1 Replies

ActionScript 2.0 :: Create A New Array That Is The Same As The Length Of Array?

Apr 21, 2005

I have 2 arrays:

Array 1 = [1,3,5,7,9,10];
Array 2 = [5,7,10];

Now, I wanted to create a new Array the is the same as the length of Array 1. The output should look like this:

New Array = [0,0,5,7,0,10];

View 3 Replies

Flex :: Develop A Softare For 3D Object Compression (by Polygon Reduction) In Flex Using Papervision 3D

Jun 11, 2010

I wish to develop a softare for 3D object compression (by polygon reduction) in flex using papervision 3D. Could you please suggest me an efficient algorithm for the same?

View 1 Replies

ActionScript 2.0 :: [CS3] Dynamically Create An Array?

Feb 10, 2009

I have a glossary that I am trying to build. Each letter is in an XML, I want to create an Array to store letter "A", then dynamically create a "B" array and so on. this is what I have so far:

PHP Code:
var iTempNum = 0;
var iTermTotal;

[code].....

View 4 Replies

ActionScript 3.0 :: Create An Array Of Functions In It?

Oct 7, 2009

Suppose you have a round based RPG type game. The player issues directives to his units, your enemy AI issues directives to its units. The problem is that the functions for those directives then have to be executed in a specific order with no relation to the order they were input in and all at the same time with the push of one button.

I just need a little direction here, I just spent the last fifteen minutes searching "AS3 Array of Functions" before figuring out that maybe that's not the way you do it in AS3.

Essentially, I'm looking for the way to store functions, put them in a list to be sorted in a specific order and then execute them in said order.

View 4 Replies

ActionScript 3.0 :: Create An Array Of Functions?

Aug 1, 2010

Suppose you have a round based RPG type game. The player issues directives to his units, your enemy AI issues directives to its units. The problem is that the functions for those directives then have to be executed in a specific order with no relation to the order they were input in and all at the same time with the push of one button.

I just spent the last fifteen minutes searching "AS3 Array of Functions" before figuring out that maybe that's not the way you do it in AS3.Essentially, I'm looking for the way to store functions, put them in a list to be sorted in a specific order and then execute them in said order.

View 9 Replies

Flash8 :: Create A New Line In An Array?

Aug 24, 2010

I created a multidimensional array and I am having a hard time using .push to start another line. I have tried many thing however this is where I am at right now:

Actionscript Code:
arrayName = new Array(new Array());arrayName[0].push("cats");arrayName[0].push("dogs");arrayName[1].push("panthers");trace("arrayName[0][0] = "+arrayName[0][0]);trace("arrayName[0][1] = "+arrayName[0][1]);trace("arrayName[1][0] = "+arrayName[1][0]);

As you can see the last trace (arrayName[1][0]) comes back undefined. How do I add the [1][0] level of the array?

View 2 Replies

AS3 :: Create Unsigned Array With Keys?

Feb 14, 2010

how to create unsigned arrays with keys in actionscript 3?

in php its simple:

array('key' => 'val');

in ac3 you can create unsigned arrays like that:

['val']
['key': 'val'] // breaks

View 2 Replies

Flash - Create A Particular Type Of Array?

Jan 13, 2012

I have a Class as follow:

class com.flightstatus.SpecificationFlight
{
public var Airline:Airline;
public var FlightNumber:String;

[code]...

Now I want to create a array of above type like below:

var myArr:SpecificationFlight = new Array();

This type is very crucial as it will be sent over webservice.

View 1 Replies

ActionScript 3.0 :: Create An Array Of ListItems?

Jul 28, 2009

how to create an array of ListItems... like {label:X, value:0}? What type of object is that as well?

View 0 Replies

ActionScript 2.0 :: Create A Map Using Tiles And An Array?

Nov 9, 2009

This is my first time using Actionscript in probably 4 years and I'm learning everything all over again. For example, here's what I tried to jump right into doing and just realized I don't remember how. I'm trying to generate a world map out of tiles I created in Photoshop. I've created a symbol in the library for each tile and want to use an array and a for loop to create the full map.

So far I seem stuck on creating the array itself. I've started by creating a variable for each tile that exists such as m73 = "Lake South" where "Lake South" is the name of the symbol in the library. The full map will be a 32x32 grid of tiles but for now (until I get it working) the array is much smaller. An example of it is like this:

worldMapArray = [m4,m4,m4,m4]
[m0,m4,m4,m4,]
[m17,m16,m16,m16];

Hopefully this is enough to convey what I'm trying to do. However, when I use something like trace(worldMapArray[0][1]); it comes up as undefined. I've already created the needed for loops that use attachMovie for each iteration in the array, but as the array itself isn't set up right nothing happens.

View 1 Replies

ActionScript 3.0 :: Create A TextField Like An Array?

Nov 14, 2009

I want to load many data form xml file so I want to create TextField and put my xml data to that TextField in other hand I have to create many TextField and Control them, how can i create a TextField like an array?

View 4 Replies

ActionScript 3.0 :: Create Array For Dropzones Of Mc's

May 6, 2010

I want to be able to drop a mc at any given spot that has the same event.target.name as it self PLUS a number. Ex: The mc "leaf" must be able to be dropped at both leaf1_mc and leaf2_mc etc. Right now leaf can ONLY be dropped at leaf_mc. Should I make an array?

[Code]....

View 0 Replies







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