Flasher Archive

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


Subject: Re: FLASH: Flash4 and forms
From: Nigel Randsley-Pena
Date: Wed, 4 Aug 1999 15:40:31 +0100

Mike,

Sorry to contradict you but it's always true.
Variables in Flash have context tied to the timeline. So any variables
on a shared timeline will be sent.
For the non programmers :
Variables have a property that is akin to visibility. This means the you
can reference them from some places and not from others. the basic rule
is that variables in the same timeline will always be visible. If the
variable you want to reference is in another timeline then you can not
reference it directly.
This is important when you are sending variables as you might get
unwanted results you can't explain.
Let's check this example, and it will help understand Mike's reply and
why I started by contradicting him.
Suppose you have a submit button on a layer of your main timeline and on
this same layer you have a set variable.On another layer you have a set
variable action also. Let's say they are respectively "samelayer=I'm
here" and "otherlayer=I'm here also".
When you press the submit button as it's on the main timeline you will
be sending 3, yes three !, variables to your cgi. Two of them will be
the ones we set and the third is a bonus variable called $version with a
value that reflects the flash player version the user has installed.
It's a pity MM doesn't tell us about these nice things, don't you think
?
Now let's have a different scenario.
You have a submit button in a movie clip that is placed on the main
timeline. This movie clip has a variable defined let's say
"inmovieclip=hi".
On the same layer as the one the movie clip was placed set a variable
for example "samelayer=hi folks" and on a different layer of the main
timeline set another variable "diflayer=yes I'm here".
Now when you press the submit button that is contained in a movie clip
how many variables will be sent ? Only one ! Why ? Because only one
variable was in context (visible) The variable defined inside the movie
clip's timeline. Notice that the predefined variable $version isn't
being sent now as it's only defined on the main timeline.
I know this post is getting a bit long but I'll just end by giving you a
nice quick way to do all this testing. I use a simple perl script that
tells me everything. To do the same tests use the following action on
the submit button :
On (Release)
Get URL ("http://nigel/cgi-bin/test.cgi", window="_blank",
vars=GET)
End On

You should adapt the url to your own settings of course.
And the perl script :
-----Cut here------
#!/usr/bin/perl

use CGI ':standard';

$query=new CGI;
print header();
print start_html('Dumping Vars'),
h2 ('Current Values'),
p;
print $query->dump;
print end_html;

----Cut here----

Place this script in your cgi-bin dir or any other with exec settings.
Don't forget to modify the first line to #!perl if you are using Apache
under windows or IIS.
It will give you a nicely formatted output with all the variables sent
to the script and is a great tool for quickly testing your movies to
check what is being sent to a script.

Nigel

------------------------------------------------------------------------
To UNSUBSCRIBE send: unsubscribe flasher in the body of an
email to list-manageratshocker [dot] com. Problems to: owneratshocker [dot] com
N.B. Email address must be the same as the one you used to subscribe.
For info on digest mode send: info flasher to list-manageratshocker [dot] com


Replies
  Re: FLASH: Flash4 and forms, Brian Clifton

Replies
  Re: FLASH: Flash4 and forms, Mike Yrabedra

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