Structure of movie
- contains just a "status" textfield
- mailform movieclip
ou may load the mailform into a main movie of your own
one of the potential uses: if the mail is sent off, make the mail clip disappear but the success message stay on stage- text inputs: simple input textfelds with varnames name, email
and message.
note that inputs should never have the html option checked - checkbox
- radiobutton carrier
- two or more radiobutton
- A send button
- (F5 only) an empty movieclip data used for sending
- text inputs: simple input textfelds with varnames name, email
and message.
Details
Checkbox
a checkbox, or actually any kind of toggle button, can be built as a movieclip with two frames, showing the off and on states. Both frames will hace a
stop();
action. For a checkbox, both frames need to act as buttons. The button script is
on(release) {
play();
_parent[this.name] = 'on';
}
on(release) {
play();
_parent[this.name] = '';
}
for the second frame. A property name set on the movieclip specifies the variable to set.
Here, the checkbox has an instance name cb1, and the varname is set to exist from frame action in the mailform clip
cb1.name = 'exist';
Radiobutton group
this is an empty movieclip with just a bit of actionscript as a frame action:
function clicked(ob) {
for(var j in this)
if(typeof(this[j]) == 'movieclip')
if(this[j] == ob)
{ ob.gotoAndStop(2);
_parent[this.name] = ob.value;
}
else
this[j].gotoAndStop(1);
}
// initilize
for(var j in data.btns)
{ this[j].value = data.btns[j];
}
if(typeof(data.init) != 'undefined')
click(this[data.init])
In plain words: check all movieclips in the carrier - these are the radiobuttons.
The one just clicked will change to frame 2 (on state) while all others will
go to frame 1. Additionally, a varable defined by the carrier's name
property will be set to the clicked button's value property
The mailform clip sets data for the radiocarrier (instance name rg1)
as an object
rg1.data = {name:'recip',btns:{btn1:'support',btn2:'account'},init:'btn1'};
The initialize code inside the radiocarrier sets the values for the individual
radiobuttons, which need to have instance names (here they are just btn1
and btn2) and sets the name item to the varname (in radiocarrier's parent,
that is the mailform; the name used here is recip)
Additionally, the data may specify the name of one button as "init" - when the
movie loads, a call to the click function will check this button and also set
the variable.
Radiobutton
- 2 or more radiobutton instances:
The radiobutton also is a clip with 2 frames, but this time only the first frame has a button; the second frame just shows a graphic.
The button action ison(release) { _parent.clicked(this); }The function inside the carrier is called, and its argument is a reference to the clip actually clicked.
Every button in the group needs to have a distinct value - these values have been assigned from the radiocarrier's init code.
Send button
There are two similar versions of the button script
Flash 5 Style |
MX style |
| the F5 variant requires that an empty clip (named data) is added (to the mailform clip) | |
on(release) {
|
on(release) {
|
Sending clipWhere players 6 and up have a nice way to perform some actions after a server call completes, there are a few - not so good - ways to achieve the same thing for flash 5. One way is to put this code
on the data clip. It is called in the context of the data clip, so the mailform is its _parent, and the status line is in the mailform's _parent. |
Comment: it should be quite clear that the loadvars object is pretty much the same as the older empty movieclip used as a data abject |

5 most recent
Flash streaming servers
Tree menu
Flash Spell Checker
Flash Remoting Library
MX 2004 Chart/Poll
Applications