Ok, I have been trying to get this to work for days now but I can’t. I am trying to load my movie clips and navigation for my website dynamically. But I also want to use a preloader at the beginning of the movie to show how much has been loaded. Can this be done? If so, could someone explain what I could be doing wrong. I have the preloader script on the first frame of the main movie, which then an animation plays. After the animation plays, this goes to the dynamic script which loads up the first anchor with all the movie clips attatched, along with the dynamic text etc. But this doesn’t seem to be working correctly. PLEASE HELP
1st Frame- (the load bar)
bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
_root.loadBar._width = getPercent*100;
_root.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
_root.gotoAndPlay(5);
//frame 5 is where the animation starts
}
Frame 20- (the beginning of the Dynamic Script)
stop();
//
//
// Set up the MovieClipLoader object and its listener
my_mcl = new MovieClipLoader();
my_listener = new Object();
my_listener.onLoadComplete = function(movieClip) {
trace("Loading is done for "+movieClip);
};
my_listener.onLoadError = function(movieClip) {
trace("Error: "+movieClip+" did not load anything.");
trace("Your load failed for "+movieClip);
};
my_mcl.addListener(my_listener);
//
//
// Setup the TextField.StyleSheet object
my_ss = new TextField.StyleSheet();
// Tell the CSS what to do when loaded
my_ss.onLoad = function(success) {
if (success) {
trace("myStyle.css loaded");
} else {
trace("myStyle.css did not load");
}
};
my_ss.load("styles/myStyle.css");
//
//
// Setup the LoadVars object
my_lv = new LoadVars();
my_lv.load("text/my_vars.txt");
my_lv.onLoad = function(success) {
if (success) {
gotoAndStop("Home");
} else {
trace("Load Failed");
}
};
my_lv.getHome = function() {
return this.homeVar;
};
my_lv.getAbout = function() {
return this.aboutVar;
};
my_lv.getPortfolio = function() {
return this.portfolioVar;
};
my_lv.getContact = function() {
return this.contactVar;
Frame 30- (the frame “Home” which content should load dynamically)
// Apply the CSS to "about_txt"
welcome_txt.styleSheet = my_ss;
// Assign the variable "aboutVar" from the LoadVars object to the text field.
welcome_txt.wordWrap = true;
welcome_txt.htmlText = "<myStyle>" + my_lv.welcomeVar + "";
//load navigation
my_mcl.loadClip("navigation.swf", "navigation_mc");
// Use the MovieClipLoader from frame 1 to load some movieclips.
my_mcl.loadClip("home.swf", "main_content_mc");