Everytime I test this out, I am getting know where. Is there something else that I am suppose to be doing to get this to draw on the stage? You have been a great help so far. I feel incompetent but I am actually real good in flash but my script skills kind of suck.
With that file test4.txt, what if I just name all the coordinates in consecative order like x,y x2,y2 x3,y3 x4,y4 x5,y5 etc. Would that work if I did it that way? I am also including another version of the text file, if you could give me your input that would be appreciated. All I did was move the commas so that each x,y coordinate is within a comma.
Yeah, you'll have quite a bit of rewriting to do...And sorry for the long wait...while I get back from vacation (I'll need to refresah my memory on XML), I know exactly how to use the loadVariables method in this case. Basically, just make every value a variable, BUT, if you have an array, that whole array can be under one variable EX:
&arrayone = value1,value2,value3
Then, in flash:
loadVariables("square.txt")
arraything = arrayone.split(',')
Basically, what that just did, is load the arrayone variable, then, using the split function (which is very useful when using loadVariables), we split the arrayone var wherever there's a comma(,), and then Flash puts the seperated pieces into an array automatically called arraything(which is why you write: arraything = ).
Now, I didn't really understand the text file, but you have background colour there too? What you'll need in flash is then a background MC. In Flash, type in Color in actionscript, highlight it, and press F1, since I forget the color object details, but it's easy to learn. All I know is that your gonna need all 6 values in the colour thing instead of 3.
Now, to use the coordinate Array, you'll obviously either need 2 arrays, Xarray or Yarray, or, you can have one Array, with xvalue, yvalue, xvalue, yvalue and so on.
Now, to interpret those variables, and draw a line...Here are some codes:
text file defines number of shapes - &shapes=3&
each pair of co-ordinates on a separate line, be sure there are no
spaces at the end of each line. (note 1st line format, don't deviate)
each shape separated by 2 lines -
load into a LoadVars object, split to a multi-dim. arrays - _root["arr"+n]
create an object (xPos & yPos) from the arrays and push to shape arrays
use 3 buttons - btn0, btn1, btn2 to draw the shapes -
This is what it is suppose to create when it is finished. No buttons, just shapes. I have written 2 different txt files but I dont know which will be easier. You have seen them both already but I am not sure, I am having a long day. The file with the shapes, I hard coded it and entered all the coordinates manually, but I dont want to have to enter them manually. Does that make any sense at all?
Thanks for the help. What you have been helping me with is actually nothing. This is a small file. The next file is 350 pages of coordinates that creates a map. So I just have to try to figure out a more efficient way to rewrite the text file. I just started this job and they want to start doing things in flash so we are trying to figure out how to take the files that they already currently have and convert them to something that is, like I said more efficient and that can be read in flash.
I finally was able to look at that shapes file. Why is it all over the place? When you tested it did it look normal? What I saw was strange. I could barely make out the shapes. The fill was covering all the shapes. Is it suppose to look that way?
Ok I have rewritten the txt file which I have included. I used commas to separate x,y and I used a bitwise"|" to separate each x,y pair. The ansperand "&" I used to separate the shapes. Now that I have that can I write an array and have Flash draw that?
Last edited by dm2757; 08-28-2007 at 02:16 PM.
Reason: added files
I think I am making headway. I created a txt file that can be read into flash but the script must be off somewhere. Can you look at my script and my txt file and see where the problem is? I am getting a mesh of shapes. The shapes are suppose to be separated and right next to eachother. Thank You
My brain is starting to hurt and I have no idea where my problem is. The shapes are still in a mesh form. When I pull up the output on the previewed product, there is a stray coordinate that should be on the bottom shape. The stray coordinate is 0,0 and it is making its own object. I dont know what to do. Can you help again please?
I am feeling like I just hit a brick wall. I am part of the way their in what I am trying to do. I have a txt file that I am reading into flash 8 and I have the script written that reads in the file and draws it but it is off somewhere. it is suppose to draw 3 consective shapes in a row a circle, square and a triangle and all shapes are green. Can someone help me figure out what is going wrong? I am desperate for help at this point.