Ask a Question related to Macromedia Dreamweaver, Design and Development.

  1. #1

    Default Not sure

    Basically I want something which will make it easier for me to turn repetative sections of my websites into External Javascript.

    e.g. in a seven page website I have a graphical, rollover navigation bar which appears in the same place on every page, if I could get all of that code into an External Javascript document (just like I can with .css), then my pages could load a lot faster.


    RussianBlue webforumsuser@macromedia.com Guest

  2. #2

    Default Re:Not sure

    OH! I getcha...

    <script language="javascript" src="myJavascript.js"></script>

    TA-DA!

    When you make the .js file you don't need to put teh script tag in, just code as you would normally...

    You can see an example of this at: -

    [url]http://www.dinkymonkeydonkey.com/Javascript/spaceTrader.asp[/url]

    MX is like a box of chocolates - Someone's usually eaten the good bits already!
    Flashjunky webforumsuser@macromedia.com Guest

  3. #3

    Default Not Sure

    I'm away from my Flash, so I can't test for sure, but here is my two cents.

    Don't use var before declaring a global. "var" is kind of the opposite of _global. Use var inside functions and the like to make the variable specific to the function. Once the function is over the var will be destroyed. For example if you were looping on i or x, there might be other i or x which could get messed up.

    Second I remember seeing something about about what happens when you don't use the _global to reference a global variable. I think it was something like this

    _global.value=5;
    value+=4;
    trace(value); \\returns 9
    trace(_global.value); \\returns 5

    Again this is from memory, so I may be completely wrong. I guess my point is you have to be very attentive to syntax with _global or you could be suprised.


    Rothrock webforumsuser@macromedia.com Guest

  4. #4

    Default Re:Not Sure

    Thanks for the responses.

    However, I don't use var when doing a global and I've tried tracing both "_global.gStatus" and just "gStatus".

    Someone on another forum said they think each swf has its own global object, which would explain the problem.

    I'm hoping someone who knows the definitive answer will speak up.

    In searching the archives, I've noticed that this question has been asked quite a few times and its never been answered.

    Maybe someone at Macromedia will finally answer it.


    David Mainstreet webforumsuser@macromedia.com Guest

  5. #5

    Default Re: Re:Not Sure

    I checked on my nowaday model, where I have several _global, and witch is
    working (on that purpose at least :-)

    1) to prevent discuss, it's rigth to NOT put <var> :-) => <_glabal.score =
    0;>
    2) all my _global daclare are in main level (level0)
    3) I use them in in 6 or 7 other swf witch are on other levels with no
    problem
    4) but the first time I declare them, I don't use <_global> to use my vars
    => <score++;>

    not sure it helps you very much :-(

    --

    Pierre Alain

    [email]pie@lifnet.com[/email]


    PierreAlain 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