[flashpro] AS2 Preloader - - Help Needed...
Timo Stamm
t.stamm at macnews.de
Fri Sep 30 21:36:03 EDT 2005
And now, after these 300 lines of code, the ActionScript 1 solution
(insert drumm roll here):
_root.preloaderTextField // textfield for progress display
_root.preloaderInAnim.play() // anim to play before loading
_root.onEnterFrame = function () {
if (_root.preloaderInAnim._currentframe ==
_root.preloaderInAnim._totalframes) {
_root.loadtarget.loadMovieClip("x.swf")
_root.loadtarget._alpha = 0
_root.onEnterFrame = function () {
var t = _root.loadtarget.getBytesTotal()
var l = _root.loadtarget.getBytesLoaded()
var percentageLoaded = l/t*100;
_root.preloaderTextField.text = percentageLoaded;
if (t > 50 && t==l) {
_root.preloaderTextField._visible = false;
_root.preloaderOutAnim.play() // anim to play after loading
_root.onEnterFrame = function () {
if (_root.preloaderInAnim._currentframe ==
_root.preloaderInAnim._totalframes) {
_root.onEnterFrame = function () {
// fading loaded movie in
_root.loadtarget._alpha += 8;
if (_root.loadtarget._alpha > 90) {
_root.loadtarget._alpha = 100;
_root.onEnterFrame = undefined;
}
}
}
}
}
}
}
}
(This code is not testet AT ALL, but you should get the idea.)
It is absolutely not re-usable, but who cares? It is only 1/10 of the
AS2 solution!
Makes you wonder about the hype about AS2. I know it's type-safe and
all, but to my opinion flash is better suited for extreme programming
and a dynamic language.
Timo
More information about the FlashPro
mailing list