11 Replies Latest reply on Jul 15, 2006 1:39 PM by Need_Sleep

    Dynamic Sprite

    Need_Sleep

      is it possble to create a sprite on stage with out dragging it on the stage but get it from the cast
      if any 1 got a tut online would be well helpfull
      need to destroy them after i used them to
        • 1. Re: Dynamic Sprite
          Level 7
          > is it possble to create a sprite on stage with out dragging it on the
          > stage

          Try:

          MX 2004, makeScriptedSprite(), like this:
          channel(x).makeScriptedSprite(member("yourcastmember"), point(x, y))
          channel(x).removeScriptedSprite()

          Earlier versions of Director:
          Search in google-groups for puppetSprite - there are many posts about the
          subject





          • 2. Re: Dynamic Sprite
            Need_Sleep Level 1
            Thank you but another question i got a textArea to go onto stage now i want to put text in to it tryed

            sprite(5).text = "hello"

            dont work and also

            channel(5).sprite.text = "hello"

            that dont work either ho how do u control the new sprite
            • 3. Re: Dynamic Sprite
              Level 7
              Real close! Try

              channel(5).member.text="hello"
              • 4. Re: Dynamic Sprite
                Need_Sleep Level 1

                RAAAAA its not working this is my code:

                its a imput box im trying to do it with a flash one

                • 5. Re: Dynamic Sprite
                  Level 7
                  You need to save a reference to the scripted sprite so you can make
                  changes to it. I recommend using a global variable to do that, though
                  depending on your needs that may not be necessary. Under the assumption
                  that you have a text member named "TextInput", this will work (watch for
                  line wraps... (there should be 2 lines of code between the on exitFrame
                  and end):

                  global gTextSprite
                  on exitFrame me
                  gTextSprite=channel(5).makeScriptedSprite(member("TextInput"),
                  point(200, 200))
                  gTextSprite.member.text="hello"
                  end

                  This way, you can do whatever you want to the sprite by using the
                  gTextSprite reference. You can change the text (like in the example
                  above), or the font

                  gTextSprite.member.font="arial"

                  You can adjust the location

                  gTextSprite.loc=point (100,100)


                  etc...
                  • 6. Re: Dynamic Sprite
                    Need_Sleep Level 1
                    Thank you Loads that works if u ever in wales ill buy u a pint

                    still not doing what i want it to do the script works the thing is i want alot of text boxes each 1 having diffrent text this methord they all have the same text as im changing the member
                    there must be a way with out me having to place the text boxes on the stage
                    what i need to do is create the sprite on the stage then name the sprite and edit it

                    oh well who needs sleep
                    • 7. Re: Dynamic Sprite
                      Level 7
                      If you want lots of different pieces of text around the screen, you need
                      to use multiple members, since, as you've seen, changing the text of the
                      member changes the text of all the sprites that use that member.

                      You can create a new member on the fly. That way you don't need to make
                      them all 1st. Just make sure that you delete them when you are done
                      with the member(membername).erase() function or you'll have lots of
                      extraneous members laying around....

                      global gTextSprite1, gTextSprite2
                      on exitFrame me
                      text1=new(#text)
                      text1.name="text1"

                      gTextSprite1=channel(5).makeScriptedSprite(member("text1"),
                      point(100, 100))
                      gTextSprite1.member.text="this is some text"
                      gTextSprite1.member.font="arial"

                      text2=new(#text)
                      text2.name="text2"

                      gTextSprite2=channel(5).makeScriptedSprite(member("text2"),
                      point(200, 200))
                      gTextSprite2.member.text="this is some other text"
                      gTextSprite2.member.font="arial"
                      end
                      • 8. Re: Dynamic Sprite
                        Need_Sleep Level 1
                        Thank you Loads you are litterlay saving me
                        the last question can i use the flash label of the flash textarea
                        • 9. Re: Dynamic Sprite
                          Level 7
                          What do you mean? How do you want to use it?
                          • 10. Re: Dynamic Sprite
                            Need_Sleep Level 1
                            well i wana use html in the text box u see in the flash components you can in this one i cant
                            • 11. Re: Dynamic Sprite
                              Need_Sleep Level 1

                              ok this is what i got so far

                              gFlashSprite = new(#flash)
                              gFlashSprite.name = "flasher"
                              gFlashSprite=channel(7).makeScriptedSprite(member("flasher"),point(150, 150))

                              but i need to get the flash textarea component
                              so i can use html