Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: two conditions
From: Laura Mollett
Date: Sun, 6 Feb 2000 07:02:05 GMT

Hi :)

> You're using = instead of eq to test a string.

I've seen this kind of thing a couple of times, and thought these
definitions might help a little. If not, just ignore it. (They helped me, to
figure it out :)

A string is a sequence (a string) of characters. It's textual data. I always
think of them as words, but any combination of words and letters can be a
string. So "fred" is a string and so is "FFF000" and so is
"http://www.foo.bar.com" as they are all some (text) data . (That's also why
those have quote marks in html as well :).

Technically numbers are just data too, but they're a special easy to
recognize kind of data and don't need quote marks. Other things that are
easy to understand and defined in the code don't need quotes. You might
consider those keywords. You don't really have to put quotes around <div
align=center> (<div align="center"> in html because center is a keyword
that's already been defined for the browser.

Strings and numbers are Literals. They're "literally" the thing they
represent. 2 is the number 2 and "foo" is the string of characters of an 'f'
and two 'o's. foo (without quotes) is a variable that holds something
literal. A variable is changeable and you're able to define it. These are
those same old things you always call "x" when you're providing examples and
don't want to "name names". Let's say a company, call it x, acted like it
was only interested in making money and not good products... depending on
your viewpoint, you might think x represents (Set Variable "x" =) Microsoft,
or Apple, or Macromedia in your head ;)

After you have defined a variable (told Flash what it means), it's a keyword
and doesn't need quote marks anymore. So 39 never needs quotes, the string
"myage" (text data) does, and after you explain to the code that myage is 39
by setting the variable like this: Set Variable: "/:myage" = 39 then myage
becomes a keyword and no longer needs quotes.

Every movie clip in flash has its own set of variables, so you define a path
at the front of the Set Variable line. The /: tells Flash that this variable
is for the main movie. If you don't add anything at all, it's for the
current movie clip.

Function names in Flash are also keywords and don't have quotes, like eq or
random. In Set Variable "dieroll" = random(6), random is a function name so
doesn't need to be quoted.

Putting something in quotes makes it a string. (2 is the number 2, "2" is a
string with the single character 2). If you put a variable in quote marks,
you'll turn it back into a string (basically undefine it) just for that
useage. That is, 3 will still be the number 3 elsewhere, but for this useage
Set Variable "3" & "6" & "5" = myaddress it's just the character 3.

An expression is a combination of one or more basic things. 2 is a number
(considered basic) and an expression (one basic thing). 2 + 3 is an
expression that adds the numbers two and three. A string is also a basic
thing, so you can have expressions that use strings. "foo" & "bar" is an
expression that combines the strings "foo" and "bar" to make the string
"foobar".

In Flash, there are two ways to test to see if things are the same. The =
works for numbers (2 + 2 = 4) and variables (stuff without quote marks) and
eq works for strings ("foo" eq "bar"). The same is true for concatenating.
If you're adding numbers or variables you use a + sign, and if you're
putting together two strings, you use an ampersand (&). So myage + 1 = 40
(my age is the variable defined earlier) but "x" & "y" eq "xy" (not MS ;)

Laura Mollett

flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and The Flash Film Festival
"The World�s Premier Flash Solutions Conference and Expo"
March 27-29, Nob Hill Masonic Center, San Francisco, California

-Register before Feb 25 and save $200!!-- www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  Re: FLASH: two conditions, dk

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]