Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
6Activity
0 of .
Results for:
No results containing your search query
P. 1
Flash - What Are Variables

Flash - What Are Variables

Ratings:

4.33

(6)
|Views: 7,226|Likes:
Variables explained for the beginner of ActionScripting
Variables explained for the beginner of ActionScripting

More info:

Published by: Michael Sturgeon, Ph.D. on Jul 07, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

06/15/2013

pdf

text

original

 
Flash Designing – Advanced Web C. Michael Sturgeon 
1
 
Flash Actionscript - Variables
What
 
is
 
a
 
Variable?
 
A
 
variable
 
is
 
the
 
simplest
 
means
 
of 
 
keeping
 
track
 
of 
 
information
 
in
 
your
 
Flash
 
code.
 
A
 
variable's
 
value
 
can
 
be
 
set
 
once
 
and
 
never
 
changed,
 
or
 
changed
 
often.
 
Values
 
can
 
be
 
set
 
during
 
author
time
 
(when
 
you're
 
creating
 
your
 
Flash
 
file),
 
or
 
determined
 
during
 
run
time,
 
like
 
the
 
score
 
in
 
a
 
game.
 
Variables
 
can
 
be
 
thought
 
of 
 
as
 
named
 
boxes
 
in
 
which
 
we
 
store
 
information.
 
In
 
order
 
to
 
access
 
the
 
information
 
again
 
we
 
need
 
to
 
know
 
the
 
name
 
of 
 
the
 
variable
 
which
 
holds
 
it.
 
We
 
provide
 
the
 
name
 
by
 
which
 
the
 
variable
 
can
 
be
 
referenced
 
when
 
we
 
create
 
(or
 
declare
)
 
our
 
variable.
 
Declaration
 
tells
 
Flash
 
that
 
we'd
 
like
 
to
 
create
 
a
 
new
 
variable
 
with
 
a
 
set
 
name
 
to
 
store
 
information.
 
Of 
 
course,
 
a
 
variable
 
with
 
no
 
value
 
is
 
of 
 
little
 
use,
 
so
 
generally
 
we
 
wish
 
to
 
define
 
our
 
variable
 
also.
 
Defining
 
a
 
variable
 
is
 
the
 
act
 
of 
 
allocating
 
a
 
value
 
to
 
the
 
variable.
 
In
 
Flash,
 
declaration
 
and
 
definition
 
are
 
generally
 
combined
 
into
 
one
 
statement
 
of 
 
the
 
form:
 
variable_name = some value;
For
 
example,
 
to
 
record
 
that
 
my
 
name
 
is
 
Michael,
 
we
 
could
 
declare
 
and
 
define
 
a
 
new
 
variable
 
called
 
'myname'
 
as
 
follows:
 
myname="Michael";
This
 
code
 
consists
 
of 
 
the
 
variable
 
definition
 
(which
 
states
 
we
 
are
 
creating
 
a
 
new
 
variable
 
called
 
'myname')
 
and
 
the
 
value
 
of 
 
this
 
variable
 
which
 
is
 
the
 
string
 
"Michael",
 
(more
 
on
 
strings
 
later).
 
The
 
semi
colon
 
at
 
the
 
end
 
of 
 
the
 
line
 
signifies
 
the
 
end
 
of 
 
our
 
ActionScript
 
command
 
(or
 
statement 
).
 
Flash
 
is
 
quite
 
forgiving
 
if 
 
you
 
leave
 
off 
 
semi
colons
 
at
 
the
 
end
 
of 
 
statements,
 
but
 
strictly
speaking
 
they
 
are
 
required.
 
A
 
Note
 
on
 
Variable
 
Naming:
 
In
 
the
 
above
 
example,
 
the
 
variable
 
name
 
myname
 
is
 
purely
 
arbitrary;
 
we
 
could
 
have
 
called
 
it
 
'name'
 
or
 
pretty
 
much
 
anything
 
else.
 
Note
 
however
 
that
 
variable
 
names
 
may
 
not
 
contain
 
spaces
 
or
 
be
 
the
 
same
 
as
 
a
 
reserved
 
Flash
 
keyword
 
(see
 
Reserved 
 
Keywords
 
documentation
 
for
 
list
 
of 
 
words).
 
Some
 
people
 
also
 
consider
 
it
 
'bad
 
form'
 
to
 
begin
 
a
 
variable
 
with
 
a
 
number
 
or
 
use
 
hyphens
 
in
 
variable
 
names
 
(instead
 
perhaps
 
use
 
an
 
underscore).
 
Variable
 
Types:
 
Variables
 
are
 
used
 
to
 
store
 
a
 
variety
 
of 
 
different
 
types
 
of 
 
information,
 
from
 
street
 
addresses
 
to
 
a
 
person's
 
age,
 
so
 
some
 
form
 
of 
 
distinction
 
between
 
variable
 
types
 
is
 
required.
 
Since
 
the
 
names
 
we
 
give
 
our
 
variables
 
can
 
be
 
almost
 
completely
 
arbitrary,
 
Flash
 
needs
 
some
 
other
 
indication
 
as
 
to
 
the
 
type
 
of 
 
information
 
we
 
are
 
storing,
 
so
 
that
 
it
 
is
 
able
 
to
 
manipulate
 
the
 
information
 
later
 
on
 
should
 
we
 
wish
 
it.
 
For
 
instance,
 
there
 
is
 
no
 
point
 
in
 
trying
 
to
 
multiply
 
two
 
people's
 
names
 
together;
 
such
 
an
 
operation
 
is
 
only
 
reasonable
 
for
 
Numeric
 
values.
 
A
 
variable's
 
datatype
 
relates
 
to
 
the
 
information
 
the
 
variable
 
stores
 
and
 
assists
 
Flash
 
in
 
determining
 
which
 
actions
 
are
 
appropriate
 
to
 
invoke
 
on
 
this
 
information.
 
In
 
this
 
tutorial
 
we
 
will
 
discuss
 
the
 
following
 
basic
 
datatypes:
 
Strings
,
 
Numbers,
 
and
 
Booleans
.
 
 
Flash Designing – Advanced Web C. Michael Sturgeon 
2
 
Numbers
 
Numbers
 
are
 
an
 
easy
 
concept
 
to
 
grasp;
 
you've
 
been
 
using
 
them
 
since
 
you
 
were
 
a
 
child.
 
Numeric
 
variables
 
in
 
Flash
 
are
 
variables
 
whose
 
values
 
can
 
be
 
manipulated
 
using
 
mathematical
 
expressions
 
like
 
multiplication.
 
For
 
instance,
 
if 
 
we
 
wished
 
to
 
record
 
the
 
year
 
in
 
which
 
ActionScript.org
 
was
 
launched,
 
we
 
would
 
generally
 
do
 
it
 
as
 
a
 
number,
 
in
 
the
 
following
 
form:
 
founding_year =2000;
If 
 
we
 
want
 
to
 
determine
 
how
 
long
 
this
 
site
 
has
 
been
 
operational
 
and
 
we
 
have
 
another
 
variable
 
which
 
stores
 
the
 
current
 
year
 
as
 
a
 
numeric
 
value,
 
we
 
can
 
subtract
 
the
 
founding
 
year
 
from
 
the
 
current
 
year
 
to
 
get
 
a
 
third
 
numeric
 
variable,
 
as
 
follows:
 
founding_year =2000;current_year =2003;operational_for = current_year - founding_year;
In
 
the
 
above
 
example,
 
the
 
operational_for 
 
variable
 
will
 
be
 
created
 
an
 
allocated
 
the
 
numeric
 
value
 
3.
 
Let's
 
move
 
on
 
to
 
some
 
other
 
variable
 
types
 
and
 
the
 
distinction
 
should
 
become
 
clearer.
 
Strings
 
Strings
 
are
 
one
 
or
 
more
 
characters
 
(letters,
 
digits,
 
spaces,
 
etc.)
 
tied
 
together.
 
In
 
general
 
this
 
includes
 
things
 
like
 
names,
 
addresses,
 
and
 
other
 
information
 
which
 
can't
 
be
 
manipulated
 
in
 
the
 
same
 
way
 
as
 
numbers.
 
String
 
values
 
are
 
signified
 
in
 
Flash
 
by
 
enclosing
 
the
 
text
 
we
 
wish
 
to
 
store
 
in
 
our
 
variable
 
in
 
double
 
or
 
single
 
quotes.
 
For
 
example,
 
the
 
following
 
statements
 
both
 
create
 
a
 
variable
 
called
 
country
 
which
 
stores
 
the
 
word
 
Australia.
 
country ='Australia';country ="Australia";
If 
 
you
 
were
 
to
 
enter
 
either
 
of 
 
the
 
above
 
lines
 
without
 
the
 
use
 
of 
 
quotes,
 
you
 
would
 
be
 
telling
 
Flash
 
to
 
assign
 
the
 
variable
 
called
 
country 
 
the
 
same
 
value
 
as
 
the
 
variable
 
 Australia
.
 
Whenever
 
you
 
wish
 
to
 
represent
 
a
 
phrase,
 
sentence
 
or
 
sequence
 
of 
 
characters,
 
you
 
will
 
generally
 
use
 
a
 
String.
 
Strings
 
are
 
also
 
the
 
type
 
of 
 
data
 
displayed
 
in
 
TextFields
 
in
 
Flash,
 
although
 
the
 
TextField
 
Object
 
is
 
beyond
 
the
 
scope
 
of 
 
this
 
tutorial.
 
If 
 
the
 
distinction
 
between
 
Numeric
 
variables
 
and
 
String
 
variables
 
is
 
still
 
not
 
clear,
 
consider
 
the
 
following
 
example:
 
my_sum =1+2+3;
Written
 
in
 
this
 
form,
 
the
 
above
 
ActionScript
 
will
 
create
 
a
 
new
 
variable
 
called
 
my_sum
,
 
evlauate
 
the
 
expression
 
on
 
the
 
right
 
hand
 
side
 
of 
 
the
 
statement,
 
and
 
assign
 
the
 
new
 
variable
 
a
 
value
 
of 
 
6.
 
However,
 
if 
 
we
 
wished
 
to
 
actually
 
represent
 
the
 
equation
 
rather
 
than
 
its
 
result,
 
we
 
would
 
do
 
so
 
using
 
a
 
String
 
value,
 
as
 
the
 
String
 
will
 
not
 
be
 
interpreted,
 
rather,
 
Flash
 
will
 
store
 
it
 
exactly
 
as
 
we
 
provide
 
it:
 
my_sum ="1 + 2 + 3";

Activity (6)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Ezandro Sualin liked this
nithy12121 liked this
padjar liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->