ActionScript 3.0 :: Write A Program That Draws A Pythagoras?

Feb 26, 2009

I want to write a program that draws a Pythagoras tree. The only programming language I know is C but I tried it in that language and it was horrible. Someone recommended Flash (AS3) to me so I am trying it in that now, but I only started learning it yesterday. Anyway, I got to the point where I can draw the leftturning branch of the Pythagoras tree, but I don't know how to draw the other branches. The number of "houseshapes" a square with a rectangular triangle on top increases with every step according to the formula 1 x 2^(n-1) (First step is n=1). I created a function that draw this houseshape, called drawHouse() and it takes as its arguments the co-ordinate of the lower left corner of the square part of the house, the length of the side of the square part of the house and the current rotation angle. Rotation angles are always multiples of 45 for now, but I might try to expand it to other values later, but for now I hardcoded a lot of stuff that assumes the 'roof' of the house is a rectangular triangle.

[Code]...

View 2 Replies


Similar Posts:


Flash :: Write A Program To Speed Up Youtube Playback

Nov 19, 2010

I want to watch videos from YouTube at a faster playback rate. A while back I asked if there is a utility that can speed up video playback. The only thing that was mentioned was some closed source project for Windows. I'm not a fan of either Windows or closed source.

Another answer mentioned that you can download videos from YouTube and play them back. Unfortunately, this no longer seems to work. I tried several Firefox addons and they all fail to download. So, now I think I need to build something myself. I see two options:

Create an addon to Firefox that allows me to change the playback speed of the video as it is playing. Find an open source code alternative to Adobe's flash player and update the source code to have a variable rate of playback of sound and video.

View 1 Replies

Drawing The Pythagoras Tree?

Feb 26, 2009

I want to program a program that draws a Pythagoras tree. The only programming language I know is C but I tried it in that language and it was horrible. Someone recommended Flash (AS3) to me so I am trying it in that now, but I only started yesterday so that's why I am posting this in the newbies forum. If this belongs in the math forum, then please move it there.

Anyway, I got to the point where I can draw the leftturning branch of the Pythagoras tree, but I don't know how to draw the other branches. The number of "houseshapes" a square with a rectangular triangle on top increases with every step according to the formula 1 x 2^(n-1) (First step is n=1). I created a function that draw this houseshape, called drawHouse() and it takes as its arguments the co-ordinate of the lower left corner of the square part of the house, the length of the side of the square part of the house and the current rotation angle. Rotation angles are always multiples of 45 for now, but I might try to expand it to other values later, but for now I hardcoded a lot of stuff that assumes the 'roof' of the house is a rectangular triangle.

how do I store the 2 new x and y co-ordinates that I can calculate after drawing the houseshape, for drawing the next houseshape, and how do I store the angles? Do I need 3 separate arrays for x, y and angle? And how do I then call the houseshape function for every x and y co-ordinate and angle in these arrays? Code is attached.

View 1 Replies

ActionScript 3.0 :: Add An Exit Button Onto Program So When Its Clicked It Exits The Program Completely

Nov 4, 2008

Im trying to add an exit button onto my program so when its clicked it exits the program completely.. I've tried some of the suggestions on the forums but they arnt working. what I have been using and its not working..

// CLICK to Exit
exit_Btn.addEventListener("mouseUp", goExit);
function goExit(evt:MouseEvent) {
fscommand("quit");
};

View 9 Replies

ActionScript 2.0 :: Start An Unrelated Program (such As Window's Media Player) From Inside Of A Flash Program?

Sep 29, 2010

Is there a way to start an unrelated program (such as Window's media player) from inside of a flash program?

View 2 Replies

ActionScript 2.0 :: Program A Timer For A Typing Tutorial Program?

Mar 24, 2003

I need to program a timer for a typing tutorial program. It needs to go to 5 minutes. When the timer gets to 5 minutes the movie has to go to frame 13 which displays the results of the typing test.

View 1 Replies

IDE :: SWF That Draws Outside Its Bounds?

Mar 3, 2009

I opened up the NY Times homepage, and they have this giant Apple addvertisement that has animations over the entire top half of the page, outside the area occupied by the swf.

View 1 Replies

ActionScript 1/2 :: Random Card Draws

Dec 26, 2010

There's something I'm trying to make but I just can't seem to figure it out. I want to make something that allows a person to build a deck of cards from multiple sets of cards. I also want a button that can be clicked to randomly choose a card from the created deck. For example: lets say there are four sets of thirteen cards (hearts, diamonds, spades, and clubs). The user can select which of the four sets will be included in the deck. Once the sets are chosen the user can click a button and one card will be chosen from the selected sets. What is the best way to handle something like this? Is there a tutorial that explains how to do something like this?

View 3 Replies

ActionScript 2.0 :: Make A Square That Draws Itself

Nov 16, 2005

i want to know how to make a square that draws it self in actionscript;I was thinkning line tos but can someone help me clear it up

View 14 Replies

IDE :: Line Automatically Draws As Symbol?

Feb 28, 2009

I'm having an issue with Flash CS4. I'm not sure what I toggled, but when I draw a line or shape it automatically converts it into a symbol. How do I disable this? It's very annoying to have to break apart each line as I draw it.

View 1 Replies

ActionScript 2.0 :: Using Whatever LineTo(); Draws As A Mask?

Apr 30, 2005

The effect I would like to create is as follows: I have an image movieclip named "myImage_mc", and I want to create a spray paint effect, where the user "paints" whatever myImage_mc is using the lineTo and lineStyle commands. I have the lineTo stuff all done, the problem i have is trying to make whatever the user draws a mask that shows the image.Here's my code so far:

Code:
this.onLoad = function() {
_root.createEmptyMovieClip("empty_mc", this);

[code].....

View 1 Replies

Flex :: Sprites Are All Draws From X - Y Coordinates That Receive From XML

Jun 2, 2010

The orange square is the currently selected selected sprite. The sprites are all draws from coordinates that i receive from XML. var sprObject:Sprite = new Sprite();

[Code]...

What I want to do is the following. If I'm currently on the orange square and I use my keyboard direction buttons (up/down/left/right). I want to deselect the current sprite and select the next sprite in the appropriate direction. The problem I'm having is that I cannot get the x and y coordinates of the drawn sprites. If I look in the array, the x and y coordinates of the sprites are all 0. If I can retrieve that I can write an algorithm to determine the next sprite to select.

View 1 Replies

Actionscript 3 :: UI Component: Two Classes - One Draws The Other Doesn't

Nov 30, 2011

I am working with a flex project with a main mxml file and two actionscript classes that draw graphics. From reading tons of articles and posts I discovered that they must extend UIComponent, which they do. The first actionscript class draws the image fine. The first class then makes the call to create a new object. The second object does not display. In the pure actionscript version I had to pass the stage as a reference for the second class to draw.

I also found a similar question here at stackoverflow:UIComponent extended class isn't showing UIComponent extended class. But I was not sure how to apply it to my example.Which, if any UIComponent methods should be overrided for the second object to display? How specifically should I implement them in this example?

// First class "Ball" draws a circle successfully then creates a second object "MyRect"
package dr {
import flash.display.*;
import flash.display.Sprite;

[code]....

View 2 Replies

ActionScript 2.0 :: Custom Class That Draws A MC On Stage

Feb 21, 2009

I'm intermediate in AS2, and I'm starting work on custom classes. I am making a class called VolcanicIsland and I want it to make a movieclip on the stage when it is called. I do NOT want to make a variable MC that gets put into the arguments when it is called, however. Here is the external AS file (trimmed to the problem area):

ActionScript Code:
class VolcanicIsland extends MovieClip {
//position
private var x:Number;

[Code].....

View 1 Replies

ActionScript 3.0 :: Dot Class, Which Draws A Dot With A Color Of 0x00FF00?

Jun 3, 2010

I have a Dot class, which draws a dot with a color of 0x00FF00. When I click on the dot, I would like it to change to a random color from an array of colors I have pre-specified.How can I replace the current color with the new color? Do I have to re-draw the circle (dot)? or can I just replace the color?

View 1 Replies

ActionScript 2.0 :: CS3 Editing A Code That Draws A Line Following An Object?

Jan 15, 2011

I'm trying to make an Etch-a-Sketch kind of game for fun. I think it's a simple problem, but I tend to type a lot of stuff for some reason. I found this code to build upon:

ACTIONSCRIPT Code:
createEmptyMovieClip("Line",1);Line.lineStyle(1,0x000000,100);onMouseDown = function (){  Line.moveTo(_xmouse, _ymouse); onMouseMove = function ()  {

[code].....

View 1 Replies

Actionscript 3 :: Draws Bigger Sprite Than I Have Set (padding/margin?

Mar 30, 2012

i created my own Button which simply extends from Sprite.Its able to show 3 different text fading in and out using a timer.In my draw function i first draw a rectangle with the Sprites graphics object representing the background of the button.I added a function to set the button width. This property is used to draw the rectangle. I know that the sprites's size is updated after the rectangle drawing. But for some reason the sprite's width is always more than what i have set via my "setButtonWidth" function.Now i have a simple sprite acting as a button having a graphics.drawRectangle part drawing a simple rect. with lets say 500px width. But when i trace the width of that button it is always about 10% more. Where are these 10% coming from?I read about calling validateNow(). But this is only for Labels, or Checkboxes. For some reason i cannot access the library for Label. This must work somehow with TextFields. But how?

// this function is part of MyButtonClass.as file
function drawButton()
{

[code].....

View 1 Replies

ActionScript 3.0 :: Flash Draws Only Half Of The Width Of Picture?

Jan 6, 2010

Code:
//p is movieClip
var p:pic = new pic;
var bmpData:BitmapData = new BitmapData(p.width, p.height);

[Code].....

when I compile, flash draws only half of the width of my picture, can any 1 tell me why? my fla file is bigger than 500KB so I can't attach ;(

View 7 Replies

ActionScript 2.0 :: Create A Movie That Draws A Shape On Screen?

Jun 22, 2003

how I can create a movie that draws a shape on screen.

I understand how to draw a line, etc but can not work out how to see the shape build. I do not want something likes Kirupas' drawing demo as I do not want the viewer to create the shape.

For example I want to see the lines being drawn and control the speed, rather than the shape simply appearing in the movie.

I realise I need to change the lineTo value

An example is the way the TV is drawn in [URL] although I am not sure if this uses actionscript or is something else.

View 2 Replies

Actionscript :: Read XML And Write On List Write?

Oct 25, 2011

I'm trying to read a XML file and output the values, but i'm getting a 1120: Access of undefined property URLRequest. error.

[Code]...

View 2 Replies

ActionScript 2.0 :: BitmapData.draw() From MovieClip Draws Blank Image?

Aug 10, 2010

I have a MovieClip that has 2 images inside it:

1) An image from the FLA's library.

2) An image that is loaded dynamically from a server (read from XML file).

When I try to draw the MC into the BitmapData, I get a blank image.

Code:

ActionScript Code:
var destImg:BitmapData = new BitmapData(_root.picW,_root.picH,false);
destImg.draw( mcPicture );

View 1 Replies

ActionScript 2.0 :: Access Images From Outside Flash Way It Draws Info From A Database?

Apr 22, 2002

Is it at all possible for flash to access images from outside flash the way it draws info from a database?

View 1 Replies

ActionScript 3.0 :: BitmapData's Draw() Method Also Draws Objects With 0 Alpha

Mar 17, 2011

I am drawing a flash sprite on a BitmapData using its draw() method. This sprite has some nested objects with 0 alpha, yet the draw() method draws them on the bitmap data.

I think it has to do with the color transform I am using, but I have no idea how to change it to achieve the effect I want.

The color transform is the following:

Code:
new ColorTransform(1, 1, 1, 1, 255, 255, 255, 255);

I am using these values in order for the Bitmap to have white pixels wherever the object was, and black where there is nothing. The draw() also draws my alpha = 0 objects in white as well.

View 1 Replies

Actionscript :: Connection From Program To The Server Using XAMPP Server And Program In Flex?

Oct 26, 2010

i have the following code ]

[Code]...

but no connection established what is the reason behind not know help required and one more thing XAMPP is installed in D: drive.

View 1 Replies

ActionScript 3.0 :: Draws A Couple Of Lines With Changing Alpha And Width Whenever The Mouse Is Moved?

Apr 23, 2009

I have wrtitten some code that draws a couple of lines with changing alpha and width whenever the mouse is moved. I need to convert this code to AS3 so that I can use it in conjunction with some video tracking.

Code:

var speed:Number = 100;
var myNumber:Number;
var myMax:Number = 50;[code]...

View 1 Replies

IDE :: Converting X - Y Values - Create An Animation That Automatically Draws A Line Onto The Movie Clip Which Ends Up Being Curved

Jan 12, 2009

I'm trying to simulate the coriolis effect and have managed to create a drawing application that lets the user draw on a rotating movie clip. However, I would like to now create an animation that automatically draws a line onto the movie clip which ends up being curved, but I can't figure out how to convert the x, y coordinates of the pixels on the stage to the corresponding x, y values of the movie clip. Here's what I have so far:

[Code]...

View 1 Replies

Flash8 : Run A Flash Program From Another Flash Program?

Jan 29, 2010

I have created a flash program and I would like to run a second flash program from inside the first. To explain, say I am running a program that draws a circle and fills it with a color. Then, I have designed a second program that will divide a circle into sectors by entering percentages, to turn that circle into a pie chart. Is there a way to be running the "draw a circle" program and have a button that opens the "divide the circle into sectors" program in a new window and then passes information from that program to the first program. I am sure I will have to send the information from the second program to an XML file and then have the first program recieve it from the XML file (which I can do), but I don't know if I can run the second program from inside the first program.

View 1 Replies

ActionScript 3.0 :: Use A Web Program?

Dec 7, 2009

I am trying to make a tutorial on how to use a web program. I have some screens from the website and I need to animate some text and arrows to show up on Q once the voice over mentions them. I have set marker tracks on my MP3 files, to which I want certain action to happen when the player reaches each track.

View 5 Replies

C++ :: Program Interacting With Web

Jan 4, 2012

How or what do I need to know programming wise in order to interact with the web using c++. For instance i want to wrote a program that automatically sends invites to players on yahoo chess. How would i go about doing this?

View 2 Replies

ActionScript 3.0 :: Unable To Run The Program?

Aug 14, 2009

I have just moved to cs3 (AS3). I am unable to make some programs run. For example I have downloaded the photo viewer from actionscript.org V2/Page1.html but when I run this program, it shows just blank screen nothing else. Even SWF file is showing the same. And it shows the error, "A definition for the document class could not be found in the classpath, so one will be automatically generated in the swf file upon export." While classpath is the same as of .FLA file.

View 3 Replies







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