This content has been marked as final. Show 12 replies
I have edited the code as shown and now the grid is being generated (drawn) with a grid scale of 1 grid equals 5 feet. (Thanks!:)
What I still need to accomplish is to have the grid regenerate (redraw) correctly when a user enters new values for the width and height and then again clicks the Draw Floorplan button. Currently the grid does not redraw correctly.
You can see the new code working at this sample link: http://184.108.40.206/grid/grid_sample_1.html
I see in your code this line:
Is this meant to clear the grid movie clip prior to redraw? Do I need to specify a movie clip name?
Thanks for your help. :)
is to remove the previous grid and allow a redraw. just call gridF() when you want to draw or redraw a grid.
Thanks for taking time to answer my post, kglad.
Yes. I believe I understand. I could create another button and call it "Reset Grid" and call this function, however what I am hoping for is to have the grid redraw simply by the user entering new values for the width and height and then clicking "draw floorplan" again.
Currently the first line of code is: my_button.addEventListener("onPress",gridf); Should not the grid redraw each time and then parse the new values in the width and height fields? I am sure I am just dense but my grid is not clearing each time the "draw " button is clicked.
You can see this happen on the sample link below. After entering say 20 width and 20 height values and clicking "draw" button, the grid is created perfectly. Then if, say new values of 10 width and 10 height are entered and "draw" button is clicked, the grid does not redraw correctly using these new values.
Sample link: http://220.127.116.11/grid/grid_sample_1.html
Could the problem be that the gridf function should happen as the first function in the script before the new values are parsed again? Should a: grid_container.removeMovieClip(); execute before anything else is executed each time the "draw" button is clicked?
are you using a button component? if so, you shoud be use "click", not onPress.
and you need to pass the h and w parameters.
Getting better..... I can now redraw the horizontal width value correctly but the vertical length value does not redraw. And can you give me an idea of how to pass the H and w parameters?
are you pressing my_button each time you want to redraw the grid? do widthTF and heightTF contain the updated width and height of the grid required for the redraw?
As long as the values for widthTF and heightTF are increased each time I enter them, the grid redraws correctly. BUT, if I enter smaller values for either a second time and click my_button, the grid falls apart.
Try entering 50 width and 50 height the first time, click, and then enter 20 width and 20 height the second time, click; the grid falls apart.
Try this sample file and you will see what I mean: http://18.104.22.168/grid/sample_5F.html
that's not my coding causing that problem. you're using some code other than the code you just posted.
no, there's something else going on. the code i gave works fine. the code in your last message works fine.
you can't use getNextHighestDepth() with v2 components. they have a nasty way of insinuating themeselves at the highest depth allowed for dynamic removable.
to remedy, don't use components, use the depth manager component or set the depth of grid_container to something between 0 and 2^^19.