[thelist] Flash TIP: _level properties
Christopher Joseph
christopher at ideadesigners.com
Tue Jul 29 05:46:06 CDT 2003
Just been through a rather painful debug process and I thought I would
share the results :)
<tip type="code" author="chris joseph">
Macromedia Flash: When using movieclip preload code in a multiple level
environment over a slow connection watch out for undefined properties.
In a recent project, even 100 frames (at 25 sec) after
loadMovieNum(MyMovie, 1) the following logical test was apparently ingored:
<code>
//in frame 1
//initilise and request load movies once!
this.init();
function init(){
if (this.inited != undefined ){
return;
}
this.inited = true;
loadMovieNum("MyMovie.swf", 1);
}
//in frame 100
if (_level0._framesloaded<_level0._totalframes) {
gotoAndPlay(1);
} else if (_level1._framesloaded<_level1._totalframes ) {
gotoAndPlay(1);
} else {
tellTarget(_level1){
gotoAndPlay("Scene 1", "run");
}
stop();
}
</code>
The reason it failed to play the movie in level1 is because the first
time around the test below return TRUE:
<code>
(_level0._framesloaded<_level0._totalframes)
</code>
...eventually it was determined that the movie was not loaded quickly
enough to instantiate and populate the _level1 properties. The test was
amended to that below which fixed the issue:
<code>
(_level1._framesloaded<_level1._totalframes || _level1._framesloaded ==
undefined || _level1._totalframes == undefined)
</code>
</tip>
--
Christopher Joseph
-------------------
[Internet]
http://www.ideadesigners.com [iseries & web technologies]
mailto: christopher at ideadesigners.com
[Telephone]
mobile: +44 7966 003860
Office: +44 1494 731814 ext. 832
Direct: +44 1494 731832
[Instant Message]
ICQ: 78019724
YIM = Josephc_98
MSN = christopher at ideadesigners.com
More information about the thelist
mailing list