Creative FL Menus Pack Forum


box Creative FL Menus Pack
Creative FL Menus Pack is a package that contains the following products bundled at a special price: Creative FL Dropdown Menu, Creative FL Vertical Menu, Creative FL Tabbed Menu.

Find out more about Creative FL Menus Pack

Thread: loadMovie issue

title left
User Details
message
title right
k

post date:
2008-08-27 16:43:16
Does anyone know if it is possible to load swfs in 2 different empty movie clips from one single button action?
Lavinia Iancu [Extend Studio]

post date:
2008-08-29 10:27:28
Hello,

Here is the code which you need to save into an AS file named MCLoader:

class MCLoader extends MovieClip {

private var button : MovieClip;

private var thingsToLoad : Array;

private var main : MovieClip;

public function MCLoader(main_ : MovieClip, button_ : MovieClip, thingsToLoad_ : Array) {

this.button = button_;
this.thingsToLoad = thingsToLoad_;
this.main = main_;

var total = this.thingsToLoad.length;
this.button.ref = this;
this.button.onPress = function() : Void {
this.ref.loadItem(0, total);
}

}

public function loadItem(index : Number, total : Number) {

var item = this.thingsToLoad[index].split("...");

var name_ : String = item[0];
var target_ : MovieClip = this.main.createEmptyMovieClip("container", this.getNextHighestDepth());
var url_ : String = item[1];

var objLoader : Object = new Object();
objLoader.ref = this;
objLoader.onLoadInit = function(mc_ : MovieClip) : Void {
trace("MOVIE " + index + " HAVE BEEN LOADED!");
if(index < total - 1) {
index++;
this.ref.loadItem(index, total);
} else {
trace("LOADING PROCCESS COMPLETED!");
}
}

objLoader.onLoadError = function(mc_ : MovieClip, error_ : String, http_ : Number) : Void {
trace("CANNOT LOAD " + url_ + "!");
if(index < total - 1) {
index++;
this.ref.loadItem(index, total);
} else {
trace("LOADING PROCCESS COMPLETED!");
}
}

var mcLoader : MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(objLoader);
mcLoader.loadClip(url_, target_);

var loadListener:Object = new Object();

}
}


In a fla file, you need to insert this code into the timeline, and create a movieclip:

import MCLoader;

var ddd : Array = new Array();
ddd[0] = "first...1.swf";
ddd[1] = "second...2.swf";

var container : MovieClip = this.createEmptyMovieClip("mcloader", this.getNextHighestDepth());

var aaa : MovieClip = new MCLoader(container, this.button_mc, ddd);


Please feel free to contact us if you have any questions and we will assist you.

Kind regards,
Lavinia Iancu