This content has been marked as final. Show 8 replies
I'm not sure I know exactly how to explain exactly how this is working. But basically if you are attaching a square of the same size, you should first draw in the square and then size them.
Or just dynamically create your clips and draw the whole thing. Why are you attaching "gSquare"?
When you set _height and _width it actually ends up changing the _xscale and _yscale.
GSquare is the basic 'square' movieclip library element that I repeatedly attach, each time setting the instances height, width etc to the required dimensions. It's the change of dimension that seems to cause the problem - if the squares are all the same size, it comes out OK, but the dimension reduction is key to what I want to do.
I was previously doing all of this as bespoke component classes but couldn't get that to work either so I tried this 'simpler' approach to see if it would show me what was going wrong.
Hope this helps.
draw first and then resize
But why attach it in the first place? Why not just draw it with the API?
I'm amazed. It worked. Thanks a lot.
Can you explain why the previous approach did not work?
The reason i ask is that I want to display the squares first on stage and then draw the curves on each square as a separate thing once all the squares are there - i.e.I want to treat them (the square and the curve) as separate things rather than one thing. From your solution it appears they are tightly bound.
I hope i am not pushing you too far - it's great to find the solution anyway.
I will have a go without using attachMovie. Will it make a difference?
I appreciate I could draw the squares and draw the curves straight onto the stage, but I arrived here from component classes where I had a square class and a curve class and used createclassobject to get them on stage (I also had a 3rd class for the square border). If I can get this basic approach to work then I will have something from which to build.
With luck stwingy's answer will fit the bill but I really want to understand how the empty movieclip and its parent are related in terms of the drawing api. I can't fathom the ligic.
Many thanks for your help so far.
It is just as suggested by Rothrock - messing with scale and if all you are doing is drawing boxes could easily be done without attachmovie and the need to scale.
just done this very quickly - might be useful to you if you wish to continue on the same route
I really appreciate your input. I am now away for a week but will look at this in detail when i return. At least I won't spend the week worrying about how to get this drawing to work - although my main problem still remains.
I've also printed out your code to have a look at on my journey.
Thanks a million! and have a good week