SINGLE POST

Flash Runtime Shared Library(ies)

Most of you know the unbelievable behaviours of Flash Runtime Shared Libraries and i never found a tutorial which describes the use of these simply and correctly.

More an accident than planed, i discovered the issue why these f*** RSL“s do not work as they should.

A runtime shared lib is only useful if you are able to control the loading process and the initial state. At least, one of them have to be proofed. Because of a false loading behaviour and an invalid working onLoad event this is not very easy.

But there is might be one solution that works. You have to load your shared lib into the path wich are you thinking about to work with. As an example.

[as]var container:MovieClip;
var tint:Number;

container = _root.createEmptyMovieClip(“base”, 1);
container.loadMovie(“rsl.swf”);

_root.onEnterFrame = function() {
if(container.getBytesLoaded() === container.getBytesTotal() && container.getBytesTotal() > 18) {
trace(“runtime lib is loaded”);
this.onEnterFrame = null;
// depends by the size of the includes of the lib i think (bigger, more initialisation time
var intValue:Number = 0;
tint = setInterval(this, “init”, 0);
}
}
function init():Void {
clearInterval(tint);
container.attachMovie(“clip_1″, “clip_1″, 1, {_x:30, _y:30});
container.attachMovie(“clip_2″, “clip_2″, 2, {_x:30, _y:130});
}[/as]This solution works because you attach the movies from your shared lib inside the same path you load the shared lib into the same clip wich are you attaching. If you want to attach a clip onto _root or something like this it will never work.

Here is an example as a .zip download

Runtime Shared Library Prototype

Ps.:

I have tested it with caching on/off in different browsers and i never had a bug, i am interested in your experiences.


Comments are closed.