7 Replies Latest reply on Feb 10, 2007 12:37 AM by Sketchsta

    what am i missing here?

    Sketchsta Level 1
      Hey guys, im just messing around with creating dynamic TextFields, but i cant get this to work.

      I know it's something simple im missing here, but i cant figure it out.
      This works if i create the Text fields on stage, but if i try to create them at runtime it doesnt work.
        • 1. Re: what am i missing here?
          kglad Adobe Community Professional & MVP
          you don't have the parameters defined correctly for createTextField().

          you should have a string for the textfield instance name (which you have), then a depth (you don't have), then _x and _y parameters (which you do have) and finally a _width and _height (which you don't have).

          anyway, the lack of a depth is fatal.
          • 2. Re: what am i missing here?
            Sketchsta Level 1
            I thought i can use "this" as depth?

            i want all fields to be on the same depth, so that i can see them all.

            also, the width and height, i thought it gets automatically sized around the text that will be in the text field.. thats why i left them out.

            i'll try to fill in all the params, see if that works.
            • 3. Re: what am i missing here?
              kglad Adobe Community Professional & MVP
              "this" isn't a depth. and in no circumstance will flash allow two objects to be on the same depth. if you try, flash will replace any previously created objects at a particular depth with whatever is created afterwards at the same depth.
              • 4. Re: what am i missing here?
                Sketchsta Level 1
                thats why i used "this" because i wanted the fields to be on the same level..

                so theres no way at all to create these fields on the same level?? or atleast for all three to show?

                im reading the Help docs, but they seem to be written for people who know Flash well. It's hard sometimes for me to understand it.
                • 5. what am i missing here?
                  Sketchsta Level 1
                  ohh ok... i got it now..

                  i thought anything i place on a higher depth, will be placed above the lower depths, resulting in not seeing the lower levels..

                  i get it now.
                  Thanx for the info kglad.

                  one more thing tho, if you wanna tell me that is..
                  how many different ways can i call a function to start when the movie starts?
                  like the onEnterFrame (handler?) i think its called..

                  i read last night in a tutorial that onEnterFrame is a bad thing to have, because it's harsh on the CPU..
                  i dont understand how that can be...but it got me thinking.
                  • 6. Re: what am i missing here?
                    kglad Adobe Community Professional & MVP
                    onEnterFrame repeatedly executes. i know it sounds like something that would execute once when the playhead enters the frame that contains the onEnterFrame code, but that's not what happens: the code executes approximately fps times per second where fps is the frames per second of your _level0 swf.

                    the best and easiest way to call a function when a movieclip starts is to put a function call on the first frame of that movieclip. if you only want that function called once (and not repeatedly every time the playhead enters the first frame of that movieclip) use an if-statement.
                    • 7. Re: what am i missing here?
                      Sketchsta Level 1
                      ohh ok, that makes sense now.

                      im trying to call it using setInterval, (which i have done before) but i cant get it to work now..