Global Variable declaration

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

  1. #1

    Default Global Variable declaration

    For some reason this wont compile, it says that i need to declare the
    variable before using it


    on prepareMovie



    global sm204

    sm204 = 0

    global smx204

    smx204 = 0

    global sm404

    sm404 = 0

    global smx403

    smx403 = 0

    end

    __________________________________________________

    on mouseUp

    if (sm204 = 0) and (smx204 = 0) and (sm404 = 0) and (smx403 = 0) then

    repeat with counter = 5 to 50

    sprite(7).locV = counter + 212

    sprite(8).locV = counter + 234

    sprite(9).locV = counter + 256

    updateStage

    end repeat

    sm204 = 1

    end if

    end


    Yarden Sheffer Guest

  2. Similar Questions and Discussions

    1. global variable
      I have made a site where I need to be able to include a file containing an array of settings in many pages. This array needs to have global scope...
    2. One line variable declaration with multiple conditions
      Howdy list. I'm trying to one lineify this: my $guts = $firstchoice || ''; if(!$guts && $use_second_choice_if_first_is_empty) { $guts =...
    3. Global variable issues
      I have tried controlling sprite behaviors across many small movies. But I have had no luck. So I am now putting all instances of the sprite into the...
    4. Help Please: 'Warning 5001 global variable "iF_timer" already defined in global scope
      Hi there, I have just started to get this error: 'Warning 5001 global variable "iF_timer" already defined in global scope The variable name...
    5. Abstraction of table variable declaration
      Hi all, I'm trying to simplify the maintenance of my stored procedures using SQL Server 2000's table variables. Currently each sp returns...
  3. #2

    Default Re: Global Variable declaration


    "manno" <manno@xs4all.nl> wrote in message
    news:bflas1$36r$1@forums.macromedia.com...
    >
    > You need to declare the variables in every script where you are using
    > in, and preferably at the top of the script _outside_ any handler.
    Why would you do both?


    David Downie Guest

  4. #3

    Default Re: Global Variable declaration

    > > You need to declare the variables in every script where you are using
    > > in, and preferably at the top of the script _outside_ any handler.
    >
    > Why would you do both?
    You wouldn't. Remove the word "and" and reparse.

    Andrew
    Andrew Morton Guest

  5. #4

    Default Re: Global Variable declaration


    Ehm, I meant it more like "also; it should be at the top of all those
    scripts, not within a handler"
    Yes, the "and" was pretty obsolete...

    David Downie wrote:
    > "manno" <manno@xs4all.nl> wrote in message
    > news:bflas1$36r$1@forums.macromedia.com...
    >
    >>You need to declare the variables in every script where you are using
    >>in, and preferably at the top of the script _outside_ any handler.
    >
    >
    > Why would you do both?
    >
    >
    manno Guest

  6. #5

    Default Re: Global Variable declaration


    "manno" <manno@xs4all.nl> wrote in message
    news:bflgtp$ent$1@forums.macromedia.com...
    >
    > Ehm, I meant it more like "also; it should be at the top of all those
    > scripts, not within a handler"
    > Yes, the "and" was pretty obsolete...
    ok. I understand. To date I've declared my globals in each handler, but if
    you can just wack the declaration at the top of the script then that might
    be cleaner.

    David.


    David Downie Guest

  7. #6

    Default Re: Global Variable declaration


    "manno" <manno@xs4all.nl> wrote in message
    news:bflhp0$g9o$1@forums.macromedia.com...
    >
    > I prefer it at the top because it gives a better overview, saves typing
    > if the handlers dealing with alike issues are stored in the same member
    > and gives reason to reconsider design if you see the list of globals
    > grow and grow.
    Also, less chance of a mistake if you only declare it once.
    > On my just inhereted project i took all the global declarations out of
    > the handlers resulting in some scripts having almost 1.5 page of global
    > declaration. That amount of globals is much more error prone IMO.
    yep. Sounds as though they would be better local to the handler.

    david.


    David Downie 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