Ask a Question related to Macromedia Director Lingo, Design and Development.
-
Tina #1
global variables
I would like to know the preferred way in which to define, store, and
retrieve global varialbes in asp.net applications. I have read through past
threads here and have seen mixed advice. Some say to define them in
global.asax but I can't seem to reference them. Others say that they must
be defined in the session_start and that they cannot be simply defined in
global.asax. Yet others say just put them in any class anywhere and
reference them.
It seems the right answer would be defining them as session variables but I
can't seem to reference them with session.myvariable
Thanks,
T
Tina Guest
-
Global variables in AS3
The documentation for AS3 tells me that a variable set as 'public' will be available everywhere. If I set public var myvar:String; at the top of... -
Global Variables problem
Hi there.. i know this is a very newb question, but any way... need to know something. I had declared a global variable this way: on... -
Problem with global variables
Hi All, I'm turning mad with global variables... In created a simple test script with 2 functions which worked fine but the other one i need... -
Global variables - application variables vs include file
What are the best methods for using global constants and variables? I've noticed that many people put all global constants in a file and include... -
How can I see global variables with ProjectBuilder
Loris Cecchinelli wrote: Menu->Debug->Expressions->varl. -
Mark Fitzpatrick #2
Re: global variables
If you want the same variable across the application, you use Application
variables and create them in the application_start event. If you need them
individually for each session then you use session variables. You don't
reference them assession.myvariable, it is actually a collection so you
would reference them (in C#) as session["myvariable"]. Just remember that
these are kept in server memory so if you have lots of sessions this can be
a performance drag.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"Tina" <tinamseaburn@excite.com> wrote in message
news:u87uHnSWDHA.2040@TK2MSFTNGP11.phx.gbl...past> I would like to know the preferred way in which to define, store, and
> retrieve global varialbes in asp.net applications. I have read throughI> threads here and have seen mixed advice. Some say to define them in
> global.asax but I can't seem to reference them. Others say that they must
> be defined in the session_start and that they cannot be simply defined in
> global.asax. Yet others say just put them in any class anywhere and
> reference them.
>
> It seems the right answer would be defining them as session variables but> can't seem to reference them with session.myvariable
> Thanks,
> T
>
>
Mark Fitzpatrick Guest
-
chefthor webforumsuser@macromedia.com #3
Global Variables
I am trying to make it so a user can set a power level, and a ball will move a certain distance based on the power.
I created a text field for the user power imput in sprite 3. The scripts for the button, and the ball are below.
It works aright the first time you click on the button, but after that the ball stays stationary. Any tips would be helpful. I'm new to this.
-----------button script---------
global gPower
on mouseup me
gpower= sprite(3).member.text
end
---------ball script----------
global gPower
property my
property xvel, xaccel
on beginsprite me
my=sprite(me.spritenum)
xvel=0
xaccel=.1
end
on exitframe me
xvel=xvel+xaccel
if xvel>gPower then
my.locH=my.locH
else
my.locH=my.locH+xvel
end if
end
chefthor webforumsuser@macromedia.com Guest
-
LeeD #4
Re: Global Variables
hi,
[url]http://www.robotduck.com/learning/index.htm[/url]
there are some really good examples here that you could download and
reference
hope that helps
lee
"chefthor" <webforumsuser@macromedia.com> wrote in message
news:bgrgh7$m94$1@forums.macromedia.com...move a certain distance based on the power.> I am trying to make it so a user can set a power level, and a ball willfor the button, and the ball are below.>
> I created a text field for the user power imput in sprite 3. The scriptsball stays stationary. Any tips would be helpful. I'm new to this.>
> It works aright the first time you click on the button, but after that the>
>
>
>
> -----------button script---------
>
> global gPower
>
> on mouseup me
>
> gpower= sprite(3).member.text
>
> end
>
> ---------ball script----------
> global gPower
> property my
> property xvel, xaccel
>
> on beginsprite me
> my=sprite(me.spritenum)
> xvel=0
> xaccel=.1
>
> end
>
> on exitframe me
>
> xvel=xvel+xaccel
> if xvel>gPower then
> my.locH=my.locH
> else
> my.locH=my.locH+xvel
> end if
>
>
> end
>
>
LeeD Guest
-
Aaron Murray #5
Global Variables
Hey it's me again,
I am wondering if there is a (secure) way to create a variable that is
global. For example, I have an include file right now that defines a number
of arrays for site configuration - eg:
$FilePath = array ("Logs" => "MyLog/", "Templates" => "MyTemplate/");
Lexically speaking, this is fine from the main script. The scope of the
variable resides within the main script. However when I go into a function
it is no longer in scope, obviously. I can always pass the information
through an arguement ie
WriteLog($FilePath['Logs'], 'error.log', $ErrorNum, $ErrorDetails);
This works fine, however, it is a little cumbersome. I know avoiding
use of global variables is good programming, but in this case it would make
life much easier if I could define a few global variables. Can someone
please tell me the best way to do this?
Thanks
/Aaron
Aaron Murray Guest
-
Andy Hassall #6
Re: Global Variables
On Fri, 30 Jan 2004 20:00:03 GMT, "Aaron Murray" <__nospam__@hotmail@.com>
wrote:
(a) The 'global $FilePath' statement to bring the global into scope.> I am wondering if there is a (secure) way to create a variable that is
>global. For example, I have an include file right now that defines a number
>of arrays for site configuration - eg:
>
> $FilePath = array ("Logs" => "MyLog/", "Templates" => "MyTemplate/");
>
> Lexically speaking, this is fine from the main script. The scope of the
>variable resides within the main script. However when I go into a function
>it is no longer in scope, obviously. I can always pass the information
>through an arguement ie
>
> WriteLog($FilePath['Logs'], 'error.log', $ErrorNum, $ErrorDetails);
>
> This works fine, however, it is a little cumbersome. I know avoiding
>use of global variables is good programming, but in this case it would make
>life much easier if I could define a few global variables. Can someone
>please tell me the best way to do this?
(b) The $_GLOBALS array, visible from all scopes.
--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Andy Hassall Guest
-
smazr123 #7
Global Variables
Im having trouble understanding where I put code exactly. Can I have global
variables with serverside script?
When I create a variable outside of any functions it doesnt seem to be able to
be read from within application functions (like application.connect). Can
anybody point me in the right direction of understand how this whole dynamic
works?
smazr123 Guest
-
JayCharles #8
Re: Global Variables
I seem to remember reading something about the FMS Framework using _global for
specific purposes (don't remember exactyl what it was), and therefore using
_global elsewhere wasn't recommended.
I like to assign variables to the application object (FMS creates the
application object for you when the app starts) when I need a global var.
application.myVar = "someValue"
Now you can reference that application var from anywhere in your SSAS by using
application.myVar
JayCharles Guest
-
ekameleon #9
Re: Global Variables
Hello :)
you can use the _global in SSAS ... it's easy
in the main.asc :
_global = this ;
and now you can use this scope reference to call the global target when
you want.
All class in SSAS must be implemented in the global scope. The _global
scope it's the root environnement of the main.asc file.
For me it's a bad idea to override the application object with all the
global methods...
EKA+ :)
JayCharles a écrit :> I seem to remember reading something about the FMS Framework using _global for
> specific purposes (don't remember exactyl what it was), and therefore using
> _global elsewhere wasn't recommended.
>
> I like to assign variables to the application object (FMS creates the
> application object for you when the app starts) when I need a global var.
>
> application.myVar = "someValue"
>
> Now you can reference that application var from anywhere in your SSAS by using
> application.myVar
>ekameleon Guest



Reply With Quote

