Ask a Question related to Macromedia Director Basics, Design and Development.
-
Jeff #1
checking for the existence of a global variable, continuous play vs. single play (code included)
I have a director application that I'm working on. There's a version that's
called "full play" that basically is a copy of the interactive portion, just
linear. The client wants to also have the option of "continous play".
My idea was to set a global variable when "continous play" was clicked so
that when the person clicked the button, it'd just go to the full play
frame, and go to the end, then just check at the end for the existence of
the variable, and if it was set to on.
I've got the button working fine, so that if you select "continuous" it sets
a global variable called gContinuous and sets it equal to "on". When I'm in
Full Play mode now and go to my message window, "ShowGlobals" returns my
global all nice and pretty.
Now, on the last frame of the full play, there's a bit of lingo that does
the following:
on enterFrame me
if sound(1).isBusy() then
go loop
else
go next
end if
end enterFrame
What I'd LIKE to do is change that to something like this: (my addition in
caps)
on enterFrame me
if sound(1).isBusy() then
go loop
else
IF THE CONTINUOUS GLOBAL IS "ON" THEN
go frame "full_play"
ELSE
go next
END IF
end if
end enterFrame
The error I get is that I'm trying to use the variable before it's defined,
but I'm scoping it with "global.gContinuous"....(see actual code below)
on enterFrame me
if sound(1).isBusy() then
go loop
else
if global.gContinuous = "on" then
go frame "full_play"
else
go next
end if
end if
end enterFrame
Any ideas on what I might be doing wrong?
Jeff Guest
-
fms ns.play(file, -2) Vs ns.play(stream, -2)
Hi, I have a very strange problem. I have created an application on fms. on the streams/_definst_/instance directory there is a sample flv... -
Can't play local swf files, but web files play fine
I installed Flash 9.0.16 on my pc, and I am trying to play swf files from my local drive. The files don't open in Internet Explorer, it's just a... -
Help with my form. Checking existence of variables
I have a form which submits to another page. The submission page checks for the existence of some variables. If they don't exist it assigns a... -
play only if variable==true problem...
Dear fellow Flashers, I'm trying to command flash, with a button on another level, to only play a keyframe, labeled "start_here" if it is at a... -
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... -
Jeff #2
checking for the existence of a global variable, continuous play vs. single play (code included)
I have a director application that I'm working on. There's a version that's
called "full play" that basically is a copy of the interactive portion, just
linear. The client wants to also have the option of "continous play".
My idea was to set a global variable when "continous play" was clicked so
that when the person clicked the button, it'd just go to the full play
frame, and go to the end, then just check at the end for the existence of
the variable, and if it was set to on.
I've got the button working fine, so that if you select "continuous" it sets
a global variable called gContinuous and sets it equal to "on". When I'm in
Full Play mode now and go to my message window, "ShowGlobals" returns my
global all nice and pretty.
Now, on the last frame of the full play, there's a bit of lingo that does
the following:
on enterFrame me
if sound(1).isBusy() then
go loop
else
go next
end if
end enterFrame
What I'd LIKE to do is change that to something like this: (my addition in
caps)
on enterFrame me
if sound(1).isBusy() then
go loop
else
IF THE CONTINUOUS GLOBAL IS "ON" THEN
go frame "full_play"
ELSE
go next
END IF
end if
end enterFrame
The error I get is that I'm trying to use the variable before it's defined,
but I'm scoping it with "global.gContinuous"....(see actual code below)
on enterFrame me
if sound(1).isBusy() then
go loop
else
if global.gContinuous = "on" then
go frame "full_play"
else
go next
end if
end if
end enterFrame
Any ideas on what I might be doing wrong?
Jeff Guest
-
Andrew Morton #3
Re: checking for the existence of a global variable, continuous play vs. single play (code included)
You must declare the global at the head of the script.
global gContinuousif gContinuous = "on" then> on enterFrame me
> if sound(1).isBusy() then
> go loop
> else
Andrew Morton> go frame "full_play"
> else
> go next
> end if
> end if
> end enterFrame
Andrew Morton Guest
-
Andrew Morton #4
Re: checking for the existence of a global variable, continuous play vs. single play (code included)
You must declare the global at the head of the script.
global gContinuousif gContinuous = "on" then> on enterFrame me
> if sound(1).isBusy() then
> go loop
> else
Andrew Morton> go frame "full_play"
> else
> go next
> end if
> end if
> end enterFrame
Andrew Morton Guest
-
h #5
Re: checking for the existence of a global variable, continuous play vs. single play (code included)
> The error I get is that I'm trying to use the variable before it's
defined,You need to declare it in any and every script you want to use them by> but I'm scoping it with "global.gContinuous"....(see actual code below)
putting a
global gContinuous
before you want to use them. Then you can just refer to it as plain old
gContinuous. Foxed me at the beginning; I thought you only needed to do a
'global gMyGlobalVariable' declaration once in a project, but no, you have
to do it in every separate script...
hth
h
h Guest
-
h #6
Re: checking for the existence of a global variable, continuous play vs. single play (code included)
> The error I get is that I'm trying to use the variable before it's
defined,You need to declare it in any and every script you want to use them by> but I'm scoping it with "global.gContinuous"....(see actual code below)
putting a
global gContinuous
before you want to use them. Then you can just refer to it as plain old
gContinuous. Foxed me at the beginning; I thought you only needed to do a
'global gMyGlobalVariable' declaration once in a project, but no, you have
to do it in every separate script...
hth
h
h Guest
-
Jeff #7
Re: checking for the existence of a global variable, continuous play vs. single play (code included)
"h" <h@howiem.dontspam.meee.com> wrote
So...even if I declare it in the first frame of the movie, and set it = to> defined,> > The error I get is that I'm trying to use the variable before it's>> > but I'm scoping it with "global.gContinuous"....(see actual code below)
> You need to declare it in any and every script you want to use them by
> putting a
>
> global gContinuous
>
> before you want to use them. Then you can just refer to it as plain old
> gContinuous. Foxed me at the beginning; I thought you only needed to do a
> 'global gMyGlobalVariable' declaration once in a project, but no, you have
> to do it in every separate script...
>
> hth
>
> h
"off". If I want to simply check for this variable later on someplace, I
first need to declare it in the script that I'm going to check it in?
So on my script:
on enterFrame me
if sound(1).isBusy() then
go loop
else
if global.gContinuous = "on" then
go frame "full_play"
else
go next
end if
end if
end enterFrame
all I need is to change it to this?:
global gContinuous
on enterFrame me
if sound(1).isBusy() then
go loop
else
if global.gContinuous = "on" then
go frame "full_play"
else
go next
end if
end if
end enterFrame
Jeff Guest
-
Jeff #8
Re: checking for the existence of a global variable, continuous play vs. single play (code included)
"h" <h@howiem.dontspam.meee.com> wrote
So...even if I declare it in the first frame of the movie, and set it = to> defined,> > The error I get is that I'm trying to use the variable before it's>> > but I'm scoping it with "global.gContinuous"....(see actual code below)
> You need to declare it in any and every script you want to use them by
> putting a
>
> global gContinuous
>
> before you want to use them. Then you can just refer to it as plain old
> gContinuous. Foxed me at the beginning; I thought you only needed to do a
> 'global gMyGlobalVariable' declaration once in a project, but no, you have
> to do it in every separate script...
>
> hth
>
> h
"off". If I want to simply check for this variable later on someplace, I
first need to declare it in the script that I'm going to check it in?
So on my script:
on enterFrame me
if sound(1).isBusy() then
go loop
else
if global.gContinuous = "on" then
go frame "full_play"
else
go next
end if
end if
end enterFrame
all I need is to change it to this?:
global gContinuous
on enterFrame me
if sound(1).isBusy() then
go loop
else
if global.gContinuous = "on" then
go frame "full_play"
else
go next
end if
end if
end enterFrame
Jeff Guest
-
Jeff #9
Re: checking for the existence of a global variable, continuous play vs. single play (code included)
"Jeff" <jsmall@lhwh.com> wrote
Apparently so! Thanks for the help, worked like a charm.> So...even if I declare it in the first frame of the movie, and set it = to
> "off". If I want to simply check for this variable later on someplace, I
> first need to declare it in the script that I'm going to check it in?
>
> So on my script:
>
> on enterFrame me
> if sound(1).isBusy() then
> go loop
> else
> if global.gContinuous = "on" then
> go frame "full_play"
> else
> go next
> end if
> end if
> end enterFrame
>
> all I need is to change it to this?:
>
> global gContinuous
> on enterFrame me
> if sound(1).isBusy() then
> go loop
> else
> if global.gContinuous = "on" then
> go frame "full_play"
> else
> go next
> end if
> end if
> end enterFrame
Jeff Guest
-
Jeff #10
Re: checking for the existence of a global variable, continuous play vs. single play (code included)
"Jeff" <jsmall@lhwh.com> wrote
Apparently so! Thanks for the help, worked like a charm.> So...even if I declare it in the first frame of the movie, and set it = to
> "off". If I want to simply check for this variable later on someplace, I
> first need to declare it in the script that I'm going to check it in?
>
> So on my script:
>
> on enterFrame me
> if sound(1).isBusy() then
> go loop
> else
> if global.gContinuous = "on" then
> go frame "full_play"
> else
> go next
> end if
> end if
> end enterFrame
>
> all I need is to change it to this?:
>
> global gContinuous
> on enterFrame me
> if sound(1).isBusy() then
> go loop
> else
> if global.gContinuous = "on" then
> go frame "full_play"
> else
> go next
> end if
> end if
> end enterFrame
Jeff Guest



Reply With Quote

