must all global list be hard-coded in?

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

  1. #1

    Default must all global list be hard-coded in?



    As customary, I use parameter dialogue boxes for most of the settings that I would change frequently; however, it seems that you can not use a property from a property desecription list to represent a global list.

    Is this correct? My example is to use "glistname" as the substitute for glist name so that I can change the reference as to what list I want the behavior to effect (glist, glist2, glist3 etc.)

    As you can see below "glistname" is declareded property and the default to use is "glist".

    I keep getting an error when I run; however if I hardcode the word glist where glistname is in the mousedown-- it works?

    Ps. I have also declared "glistname" as both a property and as a global, neither way worked. In the example below it is declared as a property which should be working just fine. right now I have to make a new behavior for everytime I want to point to a different list. Not very streamlined

    Any help would be greatly appreciated. I have bolded to lines of mention



    --On Click Member Change Behavior--
    --------------------------------------------------------
    PROPERTY DECLARATIONS
    property spriteNum
    property myClickSwapMember
    property myOriginalMember
    global glist, glist2, glist3 --list for recording up to 3 seperate changing members (checkboxes)
    property myglist
    property glistname - property that let you type in the desired glist right from the ParamDiagBox

    ----------------------------------------------------
    EVENTS

    on mousedown
    set myglist=glistname
    global myglist
    if sprite(spriteNum).member=member(myOriginalMember)t hen myglist[#myOriginalMember]=1
    if sprite(spriteNum).member=member(myOriginalMember)t hen myglist[#myClickSwapMember]=0
    if sprite(spriteNum).member=member(myClickSwapMember) then myglist[#myOriginalMember]=0
    if sprite(spriteNum).member=member(myClickSwapMember) then myglist[#myClickSwapMember]=1
    end if
    end if
    end if
    end if
    end

    ------------------------------------------------
    on mouseup --sends it back on 2nd click
    global myglist
    if myglist[#myOriginalMember]=1 then sprite(spriteNum).member = myClickSwapMember
    if myglist[#myClickSwapMember]=1 then sprite(spriteNum).member = myOriginalMember
    end if
    end if

    end

    -----------------------------------------
    PARAMETERS

    on getPropertyDescriptionList

    PDL=[:]

    PDL [#myClickSwapMember]= [#comment: "Display which member on click?",#format: #graphic, #default: member "Pick your member"]

    PDL [#myOriginalMember]= [#comment: "Display which member on click-back ?(should be your Original)",#format: #graphic, #default: member "Pick your member"]

    PDL [#glistname]= [#comment: "Choose the name of the glist from the Global List for Member Change behavior that coincides with this sprite",#format: #string, #default: "glist"]

    return PDL
    end





    kyleg webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. hard-coded path?
      I'm a complete newb to swf. I haven't got a clue yet what's going on. I've built a simple little swf that implements a visualization algorithm...
    2. send coded variables with a link?
      If I want to send a variable with a link can I send it like md5. Like this, you write $Id=5 in the code and then use md5 and send it as...
    3. How to avoid accessing row values with hard coded index
      Hi there , My code look like this, string var1,var2,var3,var4; foreach (DataGridItem item in MyDataGrid.Items) {
    4. how hard to replace titanium internal hard drive? How to cloneold hard drive onto it?
      Hi all - I have a 2001 titanium laptop with a 20 Gig hard drive. The thing is getting too full and I'm toying with the idea of getting a bigger...
    5. DISABLE The hard coded IE5+ security risk file types
      I understand according to this article: http://support.microsoft.com/?id=232077 That there are hardcoded file types in IE that demands the...
  3. #2

    Default Re: must all global list be hard-coded in?

    "kyleg" <webforumsuser@macromedia.com> wrote in message
    news:bg5v95$i1o$1@forums.macromedia.com...
    >
    > As customary, I use parameter dialogue boxes for most of the settings that
    > I would change frequently; however, it seems that you can not use a
    > property from a property desecription list to represent a global list.
    OK, you've got to understand what is going on here. You can only set
    *properties* in getPropertyDescriptionList. In fact, you don't actually set
    the property at that time; what you are doing is specifying the default
    values for the property when the behaviour is instantiated by the score. In
    other words, what happens is this:

    1) Score suddenly needs your behaviour

    2) Score creates behaviour with (script "whatever").new()

    3) Score then sets all properties to the default values specified in the
    propertyDescriptionList

    4) Score triggers beginSprite event

    If you want to affect a global variable, then you must do it in the new or
    beginSprite handler for that behaviour. Of course, that will only change the
    global at the time that the handler is called. You cannot add/remove values
    in globals from behaviours in the same way as if you were to put the values
    in prepareMovie, it just doesn't work that way.

    You /could/ change the value of a global variable in the
    getPropertyDescriptionList handler itself, but that wouldn't do you any
    good. If you saved the movie and closed Director, the value would be lost.
    To get it to change the global again, you would have to look at the
    behaviours inspector. Try this, for example:

    global gList

    on getPropertyDescriptionList
    if( not listP( gList ) ) then gList = []
    gList[ gList.count + 1 ] = "I woz ere"

    return [:]
    end

    on mouseUp
    put gList
    end

    You can re-run the movie as much as you like and gList will stay the same.
    However, if you open the behaviour inspector and flick between the panel
    showing the script properties and any other panel, you will see lots of
    extra "I woz ere" entries appearing in the list. If you close and re-open
    the movie without looking at that panel, then gList will be empty.

    - Robert


    Robert Tweed Guest

  4. #3

    Default Re: must all global list be hard-coded in?


    "Luke" <lukewig@SPAMMAGNET_hotmail.com> wrote in message
    news:bg63g8$rj0$1@forums.macromedia.com...
    > If you specify the name of the global variable as a property, you can
    > retrieve that variable from the globals. In other words, your
    > getPropertyDescriptionList should look like this
    That should be "If you specify the name of the global variable as a
    symbol... etc"



    Luke Guest

  5. #4

    Default Luke,

    Luke,

    First of all, thanks for your reply
    I changed the global variable from a property to a symbol and from

    set myglist=glistname to set myglist=(the globals)[glistname]

    I still get the error "object expected"

    Can you look at my dir file and see what might be the problem?

    If you can look at this a would be greatly appreciated.

    your [email]lukewig@SPAMMAGNET_hotmail.com[/email] shows a no domain error

    can you send a good address to [email]kyle.gonyer@dana.com[/email] and let me know where I could send. (if you feel you could take a quick look of course)

    thank you


    kyleg webforumsuser@macromedia.com 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