Overview
The flash is developed with Actionscript2.0; but the .fla file is generated by a decompiling software, this can be reviewed in the following discussion.
Script On Root Timeline & Preloading
Now take a look at the script on frame 1:
Stage.scaleMode = "noScale";
Stage.align = "MC";
stop ();
_global.style.setStyle("themeColor", "0x8a8a8a");
_root.selectedG = 0;
_root.current_p = 1;
_root.g_page = 0;
_root.page = 0;
_root.flag = 0;
_root.music = 0;
_root.speed = 10;
_root.speed2 = 7;
loadVariablesNum("text.txt", 0);
xml_data = new XML();
xml_data.ignoreWhite = true;
xml_data.load("video.xml");
These lines do three important tasks:
1. stop the root MovieClip at this frame;
2. start to load the text.txt;
3. start to load video.xml
Piece of text.txt:
/ Site Slogans //
Use your logo. Delete line below {logo} if you don't want to use logo image. Name1 and Name2 fields would be displayed.
&logo_image=logo.png&
//Use this fields for Company name...
&name1=<b>HD VIDEO</b>&
&name2=by flashGIANT&
Its format is:
&[variable name]=[variable value]&[variable name]=[variable value]&.......[variable name]=[variable value]$
The name/value pairs are separated by ampersand '&', it also supports comment as well.
onClipEvent (enterFrame)
{
if (_root.file_prelouder == 1)
{
_root.play();
}
}
It is more clear now, file_prelouder is the last variable in text.txt, so this variable being available means that the loading process is finished. And now the root can go to frame 2.
The script on frame 2, which just stop root MC:
stop ();
_root.current_pic = _root.main1;
_root.scroller_x = 400;
_root.scroller_y = 350;
Now the next step is to look at MovieClip "loading" on frame 2, the script attached to it:
onClipEvent (load)
{
total = _root.getBytesTotal();
}
onClipEvent (enterFrame)
{
loaded = _root.getBytesLoaded();
percent = int(loaded / total * 100);
text = " " + percent + "%";
gotoAndStop(percent);
if (loaded == total)
{
_root.play();
}
}
So, it play a loading animation based on timeline, the mask is scaled along x axis, and along time; looking like the loading progress bar grows as time elapses. Once the root is loaded, it tell it to go on to play.
The script on frame 3 is to load a mp3 file and play it, we can omit that for now.
The next MovieClip gos into the stage is "phone1". The script attached on it:
onClipEvent (load)
{
accel1 = 6.500000E-001;
rate1 = 1.400000E-001;
_root.xd1 = 114;
_root.yd1 = 217;
x = 1;
y = 1;
}
onClipEvent (enterFrame)
{
x = x * accel1 + (_root.xd1 - _x) * rate1;
setProperty("", _x, _x + x);
if (Math.abs(_root.xd1 - _x) < 1)
{
setProperty("", _x, _root.xd1);
}
}
onClipEvent (enterFrame)
{
y = y * accel1 + (_root.yd1 - _y) * rate1;
setProperty("", _y, _y + y);
if (Math.abs(_root.yd1 - _y) < 1)
{
setProperty("", _y, _root.yd1);
}
}
On 3rd line, there is a expression "6.500000E-001", this is scientific notation in computer language, it means:
6.5 / 10
The sign indicate the operation should be taken, minus sign means devide, plus sign means multiply, the number is the index value of 10. This kind of code must be generated by decompiler, not typed by human.
To sum up, what this piece do is moving the "phone1" MovieClip into the stage, where is [114, 217]. 'accel1' is accelerator.
REFS: