2 Replies Latest reply on Feb 15, 2011 3:27 PM by Jhon Carlo

    How to change between two cast member

    Jhon Carlo

      I need to exchange two cast member, for exemple, the cast member 1 with cast member 2.
      How can I do?

        • 1. Re: How to change between two cast member
          drom_techmarine

          first you need a sprite on the stage then its easy reference the sprite then use lingo to swap the two.

          something like this

          you can put this in almost any type of script

           

          sprite(1).member = member('"xMemberName")

           

          you could also use lingo to identify the sprite you want to swap so that in the case you need to move that sprite to a different channel it will not need to be fooled with

           

          goes something like this

          first you need two scripts now one of the action of swapping the sprite where ever you put it maybe a button. and another one that gets attached to the sprite

          the first is the ID

          goes something like this

           

          global swapSpriteID -- puts this var as a global so the whole movie can know it

          on beginSprite me

               swapSpriteID = sprite(me.spriteNum)

          end

           

          then in the other script that you use to modify the sprites member needs this

           

          global swapSpriteID -- recognizing the global var so that this script can access it

          on mouseUp me -- could do this in any way just an example

              sprite(swapSpriteID).member = member("xMemberName")

          end

           

          hope this was of help

          • 2. Re: How to change between two cast member
            Jhon Carlo Level 1

            Thank you for the help.

            It works fine.