Changing cast member with a mouse click

Ask a Question related to Macromedia Director Lingo, Design and Development.

  1. #1

    Default Changing cast member with a mouse click

    Im trying to change the castmember of a sprite each time it is clicked on. I've managed to do it so that it changes just the once by using the
    "set the membernum of sprite 2 to 2" but i want it to change to another cast member each time it is clicked.
    Please help me.
    Cheers,
    Rob



    Random Rob webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. 3D cast member access
      hi all, i want to exchange 3d model data with a director app and a 3rd party application at runtime. because the data must go both ways and...
    2. How to let objects in a cast member be a child of agroup(or a model) in another cast member?
      I want to add a model to the scene. I try this code: member('world').newgroup('gr2') member('world').group('gr2').addchild(member('r2').model(1)) ...
    3. changing the cast number of a cast at authoring time?
      is it possible to change the cast number of a cast at authoring time?
    4. maintaining sprite position when changing cast member
      It should apear in the same place. If it's a bitmap or vector check the registration point in the bitmap or vector editors. Des
    5. Move mouse cursor to X,Y location and simulate mouse click
      Hi, Just something that slip my mind.. but how do you move the mouse cursor to a sprite member and simulate a mouse click? Any help is...
  3. #2

    Default Re: Changing cast member with a mouse click

    i didnt try this but it may be worth a shot

    set changeMember = random(10) <-- this should be the number of sprites you
    have
    set the membernum of sprite 2 to changeMember

    hope this works


    davis Guest

  4. #3

    Default Re: Changing cast member with a mouse click

    Thanks for your reply,
    i tried your suggestion and it works
    however i have a couple of questions.

    how can i tell director which cast members to use as it only seems to use the first 4 if i enter
    set changeMember = random(4).
    This is fine for some of the sprites but i would like others to use the next 4 castmembers.
    Also, is it possible to change the members in order as opposed to random?
    Thanks for your help.
    Rob


    Random Rob webforumsuser@macromedia.com Guest

  5. #4

    Default Re: Changing cast member with a mouse click

    On 06 Dec 2003, "Random Rob" [email]webforumsuser@macromedia.com[/email] wrote:
    > Im trying to change the castmember of a sprite each time it is clicked
    > on. I've managed to do it so that it changes just the once by using
    > the "set the membernum of sprite 2 to 2" but i want it to change to
    > another cast member each time it is clicked. Please help me.
    I would probably use a list of cast member references. I would create the
    list using the member names instead of memberNums since the memberNum could
    change at any time if you move the castMembers around.

    Here's a very basic example that is hard-coded to the member names, but
    should help get you started.

    property plMembers
    property pIndex

    on beginSprite me
    plMembers = [member("red"),member("green"),member("blue")]
    pIndex = 1
    end

    on mouseUp me
    pIndex = pIndex + 1
    if pIndex > plMembers.count then
    -- go back to first member
    pIndex = 1
    end if
    sprite(me.spriteNum).member = plMembers[pIndex]
    end




    --
    Mark A. Boyd
    Keep-On-Learnin' :)
    Mark A. Boyd Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139