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.
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.
I am working on Air application,i had a problem on Tree control.Iam adding nodes for the tree dynamically, while adding nodes to the tree i am setting Tree.selectedItem as present added node. after that i need to fire Tree.itemClick event handler method also.how can i call event handler method as a common method. in Flex3
I have a intro to a picture of a tree which has buttons on it. The intro is an embedded flv video (not using the FLV component). The video starts on frame one and runs to frame 2. The tree is on frame 3.When I click a button on the tree, it runs the respective frames then returns to the tree. When the tree appears, the sound of the video is playing in the background.How can I make this stop?
I'm trying to make a Flex Tree Component display the children of a sprite in a hierarchical way. Moreover, dragging the items on the FlexTree would resort and reparent the items. I have special Elements set as Folders. This would allow other elements to be added there as a children by dragging an element on the tree and dropping it there. I have a failed attempt which works, but breaks when I try to add folders. Basically, it fails at reparenting the items by dragging and resorting folders and that Does anyone know of a component or something which can do this, has anyone have created any of this or could anyone give me a clue?
Basically I've got a reasonably complex drawing object in a fla and I want to reproduce it in a class definition using the drawing api. However obviously this is a tedious task, so is there some trick or automated method of doing this?
Last time I needed to do this it was a drawing of an arrow and I ended up writing down x,y,width,height values for everything but this one has curves in it which I don't have experience with drawing anyway.
I cannot get this to work. Without the "var drawing", "var drawing being true or false" and the "if statement", it works fine. But I need to add the "var drawing" so that you can only draw if you turn it on by pressing the "draw_btn" button. Note, I do not get an error, the script "apparently" contains no errors. Here is the code:
ActionScript Code: var drawing = false _root.createEmptyMovieClip("myLine", 0);
I've created a drawing tool which allows the user to draw on the canvas, the problem is that if I try to draw over a movieclip nothing happens. Is there a way I can allow for the user to draw over movieclips? For example if I had a background of paper?
Here's the code I'm using for it:
// This code is for drawing the lines on the page //1. var drawingLine:MovieClip = new MovieClip(); addChildAt(drawingLine,0);
I need to draw on stage about 40,000 4x4 squares each a different color. The color is determined by an xml file. I have this working in as2 and have converted it to as3 the problem is the amount of time it takes to draw is causing cs4 to time out. I have extended the script time out to 60 seconds. In cs3 as2 it would draw the squares in about 15 seconds. I was hoping as3 cs4 would improve performance but seems to be the opposite. I have tried several methods such as adding children and various drawing variations. the bellow seems to work the best, but is still causing flash to crash.
I noticed that mx:Tree inherits from List anad that treeListData supports a "columnIndex" property, but in my tests columnIndex is always 0. Does that mean I can actually add a column to a Tree? How?
What I'd like to do is have the end-nodes of the tree (the leafs) have "value" property that can be edited, and have that value appear in a fixed column. -- so column 1 is naviagation. column 2 is editing, basically.
I can always do it with an itemRenderer but I figured I'd ask you folks if there was a pre-existing solution already. Is there?
Also, is there a way to turn on horizontal scrolling? My data runs kinda deep in spots.
I'm trying to use the tree component in conjunction with a php page I have that produces xml. But I am literally struggling so much its ridiculous*. My php page is printing out this:
Given there is no tree component in Flash CS3, I used the following tutorial [URL] and managed to populate the tree from an xml file. However I am now finding it difficult to perform certain actions such as:
- adding/deleting items from the tree - save tree back to xml format - copy child nodes from one tree to another
My website to start off is a giant tree that i created in Illustrator and i want to put the navigation dispersed throughout the tree an idea i had was a tag like the kind they used to tie to your luggage with twine made out of paper I don't really want the words to just be sitting in the tree either it looks too boring. I tried doing larger leafs but i don't like that idea either it just looks out of place. what kind of Menu bar should i do for the website?
I am trying to get an old AS2 tutorial to work in AS3 and am having some troubles. I'm getting errors with the branchCounter and then with this.lineStyle. Can anyone help me figure this out?
I have created a tree diagram using the 'Tree Component' in flash, and have linked it to my XML file: <?xml version="1.0" encoding="iso-8859-1"?> <node label = "Sports Club"> <node label = "Ball Games"> <node label = "Tennis" /> <node label = "Soccer"/> <node label = "Bassball"/> [Code] .....
If you haven't noticed yet, the tree diagram is nothing complicated, it branches out as 'ball games' and 'athletic games' with sub categories such as tennis, soccer etc. (or 100 Meter & Hurdles for Athletic sports.) Now I've managed to go this far, BUT, what i'm trying to do is that when the user chooses the subcategory e.g. 'Tennis' from the tree diagram, I need to get text into a blank text-box.
I have created a tree with a custom treeitemrenderer where I have added a textinput box next to each label. My data provider is an ArrayCollection. When I enter value in the input box, I can see the value fine as I expand or collapse the tree using the disclousure arrow. There is a strange issue when I try to expand and collapse tree from the mxml page with a button click to expand and collapse tree using the following code.
The problem is as I expand or collapse tree, the values I entered in the input boxes appear to be moving.
For example, I have entered 15 in input box 1. When I expand and collapse tree, 15 moves to another input box, and moves to another, and then it moves back to where it was entered as I keep expanding and collapsing the tree. I am still learning Flex. I am not sure what is happening, it is something to do with arraycollection.
I just read a comment at FlexExamples: One thing to note about the tree is that it is really just a list in which items are displayed. What that means is, you can't really drop somthing "into" folder unless the folder is open. Even in that case the user experience isn't quite right. So try moving everything out of one of the folders and then collapse that empty folder. If you drop something "on" the folder, it actually winds up between the target folder and the one below or above. This is indicated by the black line showing up as you move the mouse over the folders. If you "open" the folder (the only way to tell it is open is by the arrow) and then try it, you end up with an additional drop zone that is basically the bottom half of the opened, empty folder. This is also indicated by the black lines position.
It would be better if the middle section of any item could always be the drop zone for "add to this folder" and the top and bottom edges could be for dropping above or below respectively.I've just come to the same problem. Has somebody already managed this problem? In my case, I have dragMoveEnabled in the tree and offer the ability of dragging the tree items. But it is impossible to drag an item into another item that is empty. You can only drop the dragged item above or underneath an empty item.
How can I use multiple item renderers in mx:Tree depending on item's depth/level in tree?For example. For the first level items I want to use label with button and for second level items combobox
i have a tree of nodes that i dont want some type of nodes to appear in the tree, i can check the data on tree item renderer for each specific node type, so i have one type that i dont want it to be shown as tree node, like it doesn't exist.
where the component before / represents parent and the children of the corresponding parent are separated by , Can anyone provide me the logic to create a array collection for this hierarchy to set as dataprovider to my tree.
I am using mx:Tree (in Flex 4), and assigned a customised MXTreeItemRenderer for every items. As the TreeItemRenderer contains a list with tileLayout, which means the height of every row is variable. So I have to set the tree's "variableRowHeight to true. When I was testing the tree, everything went well. But when I was using the vertical scroller, I met some problems:
The scroll bar did not move to the position I want. When I was scrolling the content, the scroll bar sometimes scrolled to a unwanted position (e.g. the head of the tree). When there are more rows, the problem is more obvious.When I was scrolling the tree, the images were flicking all the time.