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


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

ActionScript 3.0 :: Determine Which Of The Rectangle's 4 Sides The Line Is Drawing Out Of?

Sep 7, 2009

I have a line within a rectangle.The line can draw outwards 360 degrees.I need to determine which of the rectangle's 4 sides the line is drawing out of.

View 1 Replies

ActionScript 3.0 :: Mathematical Function That Will Return A Number Based On A Graph That Starts At 0?

Sep 23, 2009

I'm completely useless at maths due to paying no attention whatsoever to it in school when I was a kid so forgive my lack of knowledge of basic terminology.I need a mathematical function that will return a number based on a graph that starts at 0, curves to (eg.) 100 and then curves back down to 0. I have a feeling it has something to do with Math.sin or somesuch wizardry but am not sure.Basically, I want to feed it a number between (eg.) 0 - 60 and for it to return a number on aforementioned curve. The purpose of this is to be applied as a lateral force on some basic ball physics. The idea of the 'curve' is that (depending on timing of the shot) there will be a 'sweetspot' in the timing.

View 5 Replies

IDE :: Function - OnImageData Event - Listen To The Final Image Based On It's Number Id

Apr 21, 2010

I am using a SildeShowPro for my project. I am trying to write an event listener to the onImageData event and create a conditional that will listen to the final image based on it's number id. Basicly I neet my movie to go to frame 60 after my gallery loads in its last image (number 10). Now, since I am not really familiar with the subject here is what I put together and it does not work...:

[Code]....

View 1 Replies

ActionScript 3.0 :: Drawing Shapes Based On Button Selection?

Jan 3, 2011

I am in the process of learning AS 3 and Flash on my own and currently using the Actionscript 3.0 Adobe Classroom in a book CS4 version. Having a problem with the Lesson Adendum if anyone has done it. This lession requires you to create two buttons. They both draw shapes on the stage. When one is clicked, it draws Rectangles on the stage following the mouse movement. When the other is clicked, it draws Ellipses instead. The problem I am having is that it just draws rectangles and not ellipses when the 2nd button is clicked. Would be greatful if someone could tell me what i am doirng wrong. Here is the code that I have so far. Apologize for the commented out code, I left it in to show what I have tried:

[Code]...

View 4 Replies

ActionScript 2.0 :: Drawing Curve Based On Data Points?

Jun 25, 2007

I'm trying to draw a curve based on 24 data points. I want to draw a curved line based on the average of these 24 points. I can draw a line from point to point no problem, but would like a smooth curve. The white dashed line is what I'm trying to achieve:

View 2 Replies

ActionScript 3.0 :: Curved Smooth Drawing Based On Motion?

Feb 4, 2009

i made an animation following a motion guide and i drew a line from animated movie clip's previous position to its current position. The problem is that with curves this method is very unprecise... the edges are much too jagged even with the event firing every milisecond.

[URL]

So basically my question is if it's possible to create a nice curved animation using my method or do I have to draw it manually using lineTo and curveTo and snychronise it to the MovieClip's movements or maybe creating some sort of mask to reveal the already drawn symbol?

Code:
var shape:Shape = new Shape();
this.addChild(shape);
shape.graphics.lineStyle(1, 0x000000);

[code]....

View 2 Replies

Asp.net :: Creating A Static Drawing Whose Dimensions Get Changed Based On Parameters Supplied

Jan 20, 2012

I want to create an static drawing (say any animals like giraffe) using some points, lines, drawing etc. Now i want to update the drawing by passing the parameters say height of his legs, its width or its color.The parameters are supplied from the web page. The image will be a 2D image.I am searching on which technology should i implement this for more than 10 hours but cannot find any perfect solution.Right now i am thinking i can use Adobe flash in which i can do some programming to create an drawing and change the drawing by passing the parameters to a Flash file, i think we can pass it when we embed an flv.

View 2 Replies

Programming Language / Tool For Web-based Visio-like Drawing As Applied To Product Configurator

Jul 28, 2010

I have extensive experience with MS Visio Solution development, and have a need to provide similar functionality in a web interface in the context of a heavily visual product-builder or "configurator". Visio functionality that I hope to reproduce:Visual shapes stored in a sidebar, from which the user drags and drops onto a drawing area Shape creation on the user's end is probably not necessary... just arrangement, sizing, changing parameters etc.A back-end for extracting the parts the user has dropped onto the drawing area, including the parameters they've changed, dimensions, relations between components etc.In the most general sense, I just need an interactive interface.Given the above parameters, is Flash a good option? Is there a development environment that might be better?

View 2 Replies

ActionScript 2.0 :: Function To Create A Random Number And The Char Move Accordingly Depending On The Number?

Aug 9, 2005

my functions in this fla i have. I use the function to create a random number and the char move accordingly depending on the number.

View 4 Replies

ActionScript 3.0 :: AddFrameScript To Frames Based On Their Frame Name Instead Of A Number?

Nov 1, 2009

Can you add script to frames using addFrameScript by referencing the frame name? I'd like to know how if so

View 1 Replies

ActionScript 3.0 :: Unique Random Number Based On Range?

Aug 15, 2010

I'm trying to come up with a function that can give me an array of unique random numbers based on a range. If they don't fit within that range then it keeps check until it return the correct array of numbers.

Unfortunately I just keep getting an constant loop that crashes flash.

ActionScript Code:
var positions:Array = [];
function uniqueRandomNumber(max:Number, min:Number, len:int, range:int = 100):void
{

[Code].....

uniqueRandomNumber( 200, 0, 6, 40 );

I want to make sure that all numbers are 40 apart from each other

View 9 Replies

ActionScript 2.0 :: Duplicating MCs Based On Number Of Objects In XML Document

Mar 3, 2005

Any good tutorials on dynamically duplicating movie clips (and working with them, loading into them) based on information (the number of object tags..) in a xml document?

View 2 Replies

ActionScript 3.0 :: Create A MovieClip Based On A Predefined Number?

Jul 9, 2011

I am trying to create movieClips in a loop based on a predefined amount. most importantly I want to have the variables defined as btn1, btn2, btn3 etc.

this is what i have done but i don't know how to put the number as part of the variable(i have all of the other code in place such as the languagesIndex set etc - this is the part of the code i am working with)[code]...

View 3 Replies

ActionScript 2.0 :: Duplicating Mc's Based On Number Of Objects In A Xml Document?

Mar 3, 2005

dynamically duplicating movie clips (and working with them, loading into them) based on information (the number of object tags..) in a xml document?

View 2 Replies

ActionScript 3.0 :: Creating A Color Changing, Number-based Navigation Menu?

Apr 22, 2009

In a nutshell, the swf contains four ads (which link to portions of the site) and each ad uses the Timer element, displaying it for 5 seconds before moving on to the next one. Everything has come together nicely (although I'd like to clean up the code and use classes at a later date - I'm currently taking AS training from Lynda.com).
 
What's giving me trouble right now is the navigation bar. What I want to do is create four numerical buttons that a) change color during a mouse roll over b) change color for a corresponding ad (for example, when the third ad displays, the number "3" changes from white to gray to show that it is active and goes back to white when the fourth ad comes up).
 
Right now, I'm at a loss as to what to do. I've tried making the numbers buttons, but I can't control color changes unless I create two sets of buttons: one with white numbers, one with gray numbers.This also makes for some really bizarre Actionscript coding ideas (ex: after I code the function for the gray nav buttons, I have to code functions that make the white buttons work - but this ends up screwing with the ad cycles). I tried making them as movie clips, but I lose the ability to assign a large hit area like I can with buttons.

View 5 Replies

Actionscript 3 :: Generating A Random Number Within A Certain Range, Based On Cursor Position

Apr 5, 2011

I have an object which I want to rotate between -45 and 45 degrees, but I want that to be based on the mouse position. If the mouse position is at zero, I want the object to be at -45 degrees. If the mouse position is at the stageWidth, I want the object to be at 45 degrees. How would I accomplish this?

View 1 Replies

ActionScript 2.0 :: Drawing A Line In A Function, But Not Solid?

May 16, 2005

I have in a function a line to be drawn. I want the line to be not solid but like this ------. Can I code for that.line4.lineStyle(2,"0000FF",100);

View 4 Replies

ActionScript 3.0 :: Stop A Function In Drawing ( Painting ) App?

Jan 12, 2011

i have a problem with functions, i'm creating a painting app in flash as3. i want to draw two different style a pen and rectangle.

When i draw pen style in first frame there is no problem, but when i click rectangle style in second frame it is drawing with both style. How can i stop or kill other function?

How do I make both of the not drawing. And How can i undo my last action in drawing?

Fla is in the attachement (CS4 version)

in first frame drawing pen;

Code:
var clip : Shape = new Shape();
addChild (clip);
stage.addEventListener(MouseEvent.MOUSE_DOWN, _handleMouseEvent);

[Code]....

View 5 Replies

ActionScript 2.0 :: Using A Switch To Control Drawing Function?

Mar 12, 2004

I need to create a specific drawing sequence that uses multple clicks to arrive at a certain shape.

Basically, I need the user to be able to draw a pie wedge over a bitmap image. The actual drawiing is not the problem right now, what I am struggling with is how to control the action based on how many times the person has clicked.

On the very first click, a temporary line is drawn from the center of the image, and the user can move the mouse around to get the first line where they want.

They click again and the temp line is cleared and the final line is put in place. Then, as they move the mouse off that last end point, I need a new temporary line to automatically generate (this is the second straight side of the wedge). They click a final time and that line locks in place and the wedge completes.

Now, the problem I have is that I am using a switch statement to test the clicks. When the routine starts I've got the var _root.c = 0. Here's the switch:

[AS]switch (_root.c) {
case 0 :
_root.canvasArc.onMouseUp = drawFirstLine;
break;

[Code]....

As you can see I am incrementing _root.c at the end of this. This part works fine (I verified that it is making _root.c = 1), but it seems that by breaking out of the switch statement, it doesn't go back and check anything again, so my case 1 never gets read and the rest of the process can't happen. I tried an if statement and even looped through that with setInterval but that doesn't seem to work either. Is there just a smarter way to do this?

View 3 Replies

ActionScript 2.0 :: Drawing A Line In A Function But Not Solid

May 16, 2005

I have in a function a line to be drawn. I want the line to be not solid but [code]

View 4 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 :: 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

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 3.0 :: Make A Mouse-drawing Function Which Is Frame Independent?

Sep 8, 2010

i am trying to make a mouse-drawing function which is frame independent (for collision detection).somehow my trigonometry brain part seems to be out of order. fill in the blanks?here is my code so far (simplified):

Code:
mport flash.events.MouseEvent;
import flash.geom.Point;

[code]......

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







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