I was wondering if LDMs are officially supported by Director? I ask because I'm thinking of reporting this as a bug.
Every game, application or usage of LDM based projects have always started out ideal. Beautiful in fact. But they ALWAYS end in complete disaster for me. I often end up having to combine all the code into one huge file/mess. I thought Director supported LDMs because of the combo box 'Link to external file', the 'Enable Scripts' checkbox, and the fact that Director files can appear in the cast.
But for me, it only 'appears' to work until memory gives way. Then KA POW!
I'd gladly pay triple the price of Director or more, say $10,000 bucks if this would just work.
Create a child movie with an oval sprite on it and on the last frame in the script channel of the movie add the a-typical behavior:
Now add a behavior to the oval sprite:
this.parentSpriteNum = 0;
Save it as a childMovie.dir. If your run it, you'll see a static oval where you placed it on the stage and the playback head looping on the last frame. Easy enough, right?
Now create a new Director movie and call it parentMovie.dir. In the cast, import childMovie.dir from above and be sure to select the option "Link to External File" from the combo drop down box. Don't forget to select the childMovie.dir in the cast and check off the checkbox in the property inspector 'Enable Scripts'. Its there next to 'Loop' and 'Audio'.
Now add the childMovie.dir as a sprite on the stage along with the same a-typical last frame script channel movie behavior:
Now lets say we wanted to do something useful. Like tell the childMovie what sprite channel it appears as in the parentMovie. This is the essential foundation for LDMs to even begin intercommunition. But really, all we are doing here for this example is settings a property. Add a behavior to the childMovie sprite with the following:
sprite(1).movie.sprite.parentSpriteNum = 1;
Click run and watch as memory flys into never never land. All we are doing here is just attempting to communicate to the sprite within the childMovie and setting a simple property. Just a number. Thats it.
If you go to your object inspector, you can see "sprite(1).movie" and watch "_movie", its handle changing its address value rapidly, being offset as memory leaks out the door. Director is copying the value, rather then pointing to a shared memory location or overwriting the existing one for that value. Each time orphaning the previous value along with memory. Invoking _system.gc() appears to reclaim a little, but given time, Director will crash (a long time for just a number). Now imagine if you wanted to do something useful, like pass a string, or invoke a method in a childMovie's sprite(1). Forget about passing an object like a reference to the current movie's stage. Think of using sendSprite or sendAllSprites? Same problem. Talking to the LDM just leaks a tiny (or a lot) of memory each time. Now given a decent sized project (say a wizard with 3 pages) and all hope is lost.
I've enclosed the files for your reference and a screenshot. Can anyone else confirm, does Director support LDMs?
1lineOfCode.zip 22.0 K