Ask a Question related to Macromedia Dreamweaver, Design and Development.
-
RussianBlue webforumsuser@macromedia.com #1
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
-
Flashjunky webforumsuser@macromedia.com #2
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
-
Rothrock webforumsuser@macromedia.com #3
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
-
David Mainstreet webforumsuser@macromedia.com #4
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
-
PierreAlain #5
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



Reply With Quote

