In this section
you'll get some small movie clips which can be used in your flash
projects with flash components, flash action scripts .as files and
some other stuff that will help you in your flash projects. You
can also submit your work here. For submit details please checkout
our Submit Page.
Basic
Level - Accessing Movieclip Properties & time
Create a new file and add following code on first
frame to get date & time
var months;
var date;
var show_date;
var month;
var show_month;
var show_year;
months = new Array("January", "February",
"March", "April", "May", "June", "July", "August",
"September", "October", "November", "December");
dt = new Date();
show_date = dt.getDate();
month = dt.getMonth();
show_month = months[month];
show_year = dt.getFullYear();
today_is = "Today is " + show_date + " " +
show_month + ", " + show_year;
Here instead of using if condition (as done in
previous tutorials) i have used arrays to simplify
to get monts and days name in variables. This
script should be written on first frame of the
Movie. (Refer .fla file)
Now for the second part of the tutorial. First
create a movie clip of any shape and give it an
instance name. I have given it the name "mouse".
Now make various buttons to access various properties
of the MovieClip. Here ihave given 7 properties,
so make 7 buttons and give following script to
them respectively.
To set X Position.
on (release) {
setProperty("_level0.mouse", _x, xpos); }
To set Y Position.
on (release) {
setProperty("_level0.mouse", _Y,Ypos);
}
To set X Scaling.
on (release) {
setProperty("_level0.mouse", _xscale,
xscale);
}
To set Y Scaling.
on (release) {
setProperty("_level0.mouse", _Yscale,
xscale);
}
To change Alpha property.
on (release) {
setProperty("_level0.mouse", _Alpha,
alpha);
}
To set Visiblity True or false (0 or 1).
on (release) {
setProperty("_level0.mouse", _Visible,
visiablity);
}
To set Rotation angle.
on (release) {
setProperty("_level0.mouse", _Rotation,
rotation);
}
Now test movie and check all properties of Movie
Clip and Time Display.