PDA

View Full Version : MovieClipLoader Problems


graphic_inc
08-18-2007, 02:40 PM
Hi - I'm trying to create a site whereby I have a 'base' swf that contains navigation buttons & a blank 'holder' movie clip in which external swf files will load when each button is clicked. The external swf files will be the main sections of the site & these also have sub navigation buttons, that I would like to also be able to load other external swf files into the 'holder' on the root timeline of the base swf.

The code I have used in my base swf is as follows, which is based on a Flash tutorial file by Lee Brimelow at http://www.gotoandlearn.com/download.php


stop();


var mcl:MovieClipLoader = new MovieClipLoader();

var mclL:Object = new Object();

mclL.onLoadProgress = function(target,loaded,total){
loader.percent.text = Math.round((loaded/total) * 100) + "% LOADED";
}

mclL.onLoadInit = function(){
loader._visible = false;
loader.percent.text = "";
}

mcl.addListener(mclL);



mcl.loadClip("intro.swf", holder);

intro_btn.onRelease = function(){
loader._visible = true;
mcl.loadClip("intro.swf",holder);
}

portfolio_btn.onRelease = function(){
loader._visible = true;
mcl.loadClip("portfolio.swf",holder);
}

contact_btn.onRelease = function(){
loader._visible = true;
mcl.loadClip("contact.swf",holder);
}


This all works fine & each of the buttons function correctly. However the buttons I have in my external swfs that load in, fail to work. An example of the code for these is:

stop();


print_btn.onRelease = function(){
_root.loader._visible = true;
_root.mcl.loadClip("rama_knight.swf",holder);
}

web_btn.onRelease = function(){
_root.loader._visible = true;
_root.mcl.loadClip("rama_knight.swf",holder);
}

identities_btn.onRelease = function(){
_root.loader._visible = true;
_root.mcl.loadClip("rama_knight.swf",holder);
}

I don't understand why & am pulling my hair out over this. Can anybody please help - any advice would be appreciated as my actionscript knowledge is very limited (as you can probably tell).

Thanks:)

atomic
08-18-2007, 05:49 PM
Try adding _root or _parent to the path of the holder mc...

_root.mcl.loadClip("rama_knight.swf",_root.holder);

matbury
08-19-2007, 03:06 AM
This might work:

stop();


print_btn.onRelease = function(){
this._parent.loader._visible = true;
this._parent.mcl.loadClip("rama_knight.swf",holder);
}

web_btn.onRelease = function(){
this._parent.loader._visible = true;
this._parent.mcl.loadClip("rama_knight.swf",holder);
}

identities_btn.onRelease = function(){
this._parent.loader._visible = true;
this._parent.mcl.loadClip("rama_knight.swf",holder);
}

or try: this._parent._parent.loader._visible = true; etc... I forget which.

graphic_inc
08-19-2007, 12:13 PM
Try adding _root or _parent to the path of the holder mc...

_root.mcl.loadClip("rama_knight.swf",_root.holder);
Hi Atomic & thanks for your help - your solution works perfectly! I really appreciate it :)

graphic_inc
08-19-2007, 12:16 PM
This might work:

stop();


print_btn.onRelease = function(){
this._parent.loader._visible = true;
this._parent.mcl.loadClip("rama_knight.swf",holder);
}

web_btn.onRelease = function(){
this._parent.loader._visible = true;
this._parent.mcl.loadClip("rama_knight.swf",holder);
}

identities_btn.onRelease = function(){
this._parent.loader._visible = true;
this._parent.mcl.loadClip("rama_knight.swf",holder);
}

or try: this._parent._parent.loader._visible = true; etc... I forget which.
Hi Matbury - I tried Atomic's suggestion which has sorted out the problem, but thanks for your feedback as well. :)

atomic
08-19-2007, 12:55 PM
Grrrreat! ;)