flash actionscript:
Tim,
[quoted text, click to view] > Does not work:
> [CODE]
> for (i=1;i<=3;i++) {
> switch (i) {
> case 1:
> createEmptyMovieClip("logo_mc", this.getNextHighestDepth());
createEmptyMovieCip() is a method, not a function. Conceptually,
they're the same thing, but methods belong to a class, while functions are
"free floating" and "just are." In your original code, you're using the
global "this" property to reference an object -- presumably, the main
timeline, which is a movie clip. Because it's a movie clip, it is an
instance of the MovieClip class, which means it has all the functionality
defined by the MovieClip class, including the
MovieClip.createEmptyMovieClip() method.
Without the "this" or some other movie clip reference, it may be that
your method simply isn't firing. I notice you *are* using "this" in the
MovieClip.getNextHighestDepth() method later in that same line.
I made a test real quick -- nothing more than the following in a blank
FLA:
createEmptyMovieClip("a", 0);
.... and that did, indeed, create a new MovieClip instance, named "a" (as
verified in the Debugger panel). Do to this result, I'm not convinced your
lack of "this" is the cause, but it certainly is a difference between your
two attemps.
Another thing ...
[quoted text, click to view] > logo_mc.loadMovie("1.jpg");
> logo_mc._x = 20;
> logo_mc._y = 20;
You may have problems with that next part because of the fact that
you're loading external content. While 1.jpg may load instantly on your own
machine, it may not when requested from a server. The problem with these
lines is that *while* 1.jpg is being loaded, the remaining ActionScript is
executed, without waiting until the JPG loaded completely. Depending on
what you're trying to do, this could lead you toward unexpected or erroneous
results.
The solution is to wait until your external content has loaded
completely.
http://www.quip.net/blog/2006/flash/how-to-tell-when-external-swf-loaded David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/ "Luck is the residue of good design."