8 Replies Latest reply on Feb 17, 2007 12:20 AM by torwalker

    Drawing API within attachMovie instances

    torwalker
      Hi I am trying to get curveTo to work within attachMovie created instances where the _x coordinate of each movie lines up with the _x coord plus width of the previous. Each movie is a square of differing dimensions.. All works fine apart from the curveTo which whatever i try does not come out as expected (all curves should look like the first one but scaled according to the dimensions of its containing square). I must be misunderstanding the relative coord settings or something but i have tried every combination. Can any one help? I'm at the tearing my hair out stage.
      SWF can be viewed at:
      http://www.widecombefair.com/draw/spiral3.html
      and the fla file at
      http://www.widecombefair.com/draw/spiral3.fla
      also see code below
      Many thanks in advance
        • 1. Re: Drawing API within attachMovie instances
          Rothrock Level 5
          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.
          • 2. Re: Drawing API within attachMovie instances
            torwalker Level 1
            Hi Rothrock
            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.
            • 3. Re: Drawing API within attachMovie instances
              stwingy Level 1
              draw first and then resize
              • 4. Re: Drawing API within attachMovie instances
                Rothrock Level 5
                But why attach it in the first place? Why not just draw it with the API?
                • 5. Re: Drawing API within attachMovie instances
                  torwalker Level 1
                  Hi stwingy
                  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.
                  Thanks again
                  • 6. Re: Drawing API within attachMovie instances
                    torwalker Level 1
                    Hi Rothrock
                    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.
                    • 7. Re: Drawing API within attachMovie instances
                      stwingy Level 1
                      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
                      • 8. Re: Drawing API within attachMovie instances
                        torwalker Level 1
                        Hi stwingy
                        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