This content has been marked as final. Show 12 replies
you can use the flash string methods and the drawing api to convert those data to lines. it's not clear from your example where that drawing should start and it's not clear if that should be a three sided figure or a closed rectangle so i can't show the exact code for your example.
if you give more details you can get more detailed help.
Thanks for the quick reply. Sadly, this is the data that we have. I have emailed the providers your questions to see if they can be answered. I would assume that the code i gave you would be a closed rectangle. But to be honest i dont think it matters if flash thinks it closed or not, just as long as it appears to be a rectangle. There will be no 3 sided objects. The end of the data always completes the object as i understand it.
Could you show me an example of how this would be done with the data i posted?
Could you show me an example of how you would want to do this?
Any sites you can point me to?
Actually, the code you showed is for a square and it's obvious (Up 13px, Right 7px, Down 13px, Left 7px - makes a perfect rectangle). These commands are similar to an old drawing program called Logo. You'd need to write a script to build an array out of the different segments (broken up by the Alphas) and then using the MovieClip class drawing api to draw the lines.
sym, that's not a square and it's not a rectangle.
but if you have no 3 sided figures it's clear that what the next line should be to close the 3 sides to form a rectangle. so, that resolves one of the two ambiguities.
now the 2nd ambiguity: where's that rectangle's upper left corner?
kglad, this code is extremely similar to logo language. I used it in geometrical math throughout grade school some 20 years ago now but it was very similar. In Logo, you'd tell the program to turn the cursor and move so many pixels...
following his definition of the data, it would make a rectangle.
Once the data was pulled in, you'd just have to look at the U,D,L,R to decide if the next movement was a negative or positive movement from the cursors current position....
As for the 2nd ambiguity, you'd only need to add a moveTo(0,0) and go from there... Each point in the data is not necessarily going to be the upper left corner. You should go about it theoretically and only think of 0,0 as an origin.
no, following his definition (which is in his first message) that's a 3-sided figure. with the information from his 2nd message (ie, the understanding that he has no 3-sided figures) his data unambuously defines a rectangle's dimensions.
and, more generally, if it's understood that there are no open figures it is not necessary to specify the last data segment in any rectilinear figure: it can be understood that the last line line will connect the end of the last specified line and the start of the first line. so, this information can always be omitted. but again, that's only with the understanding that all figures are closed.
however, his data do not define the location of his rectangles. if there's only one figure to draw then the start point is not too important: one just needs to insure the figure is on-stage. if there's more than one building to be drawn at any one time, the relative locations of the buildings are very important.
and using his example it would not make sense (in flash) to start at 0,0 because that figure would then not be on-stage.
How do you get a three sided figure anyway? It's a rectangle, as far as I
can tell. The 'pen' is somewhere - doesn't matter. Go up 7, left 3, down 7,
and right 3 and you get a closed rect. If you don't, I can't see it.
Adobe Community Expert
oops, my error. that is a rectangle. i read the first message incorrectly.
:D Lay off the ale kglad. lol.
i'm still trying to figure that out. i was absolutely positive i was correct about that being a 3-sided figure. (and i have been drinking some wine lately. but i don't think that can explain my error.)
right now i can't figure out how the heck i could have possibly thought that was a 3-sided figure. perhaps it was extreme short-term memory lapse: possibly by the time i got to L7 i forgot i'd started with U13 and felt there should be an U13 at the end.
oh well, because of my bungling this thread has become more an issue about my personal failings than the op's original issue.
I have vague recollections of LOGO and if I remember there were DRAW and MOVE commands. I'm guessing that in the code the turbonut has there must be similiar references, maybe D-U13L7D13R7 M-U50R50 D-U13L7D13R7 otherwise it will end up creating an Etch-a-sketch picture of the buildings? I also suspect that it does draw diagonals, but like this U1R1U1R1U1R1 etc
So as long you can extract the unique commands from the string it should be pretty straight forward. The only issues I can see is that you will have no idea how big the sketches are until they are drawn..so how big should the stage be?! And also, the distortion due to the the pixel aspect ratios on the screen may make the buildings look a bit squashed....?
exactly phil. theoretically, it would be possible. my guess however, is that these building are huge as are the number of DURL commands it takes to build one of these bad boys. doing something like this would require a set stage and then figuring out a scaling factor for each drawing and moving on the stage based on the command and that scaling factor. This could make it hard however when you start getting into diagonal lines and smaller buildings... nothing is impossible only improbable.
Another way to handle the stage would be to create a container clip for the drawn objects and simply draw them as they appear. Use pan techniques after that to move the building around on the stage.