PDA

View Full Version : Component method cannot be accessed when that load as external movie by loadMovie()



NovemberRain
October 6th, 2003, 04:10 AM
Hi,

I've made a component to control the movieclip in the main timeline. The instance name of that movie clip passed as a parameter to the component. That is working fine in that file. But when that file loads into another SWF file, that containes a movieclip to hold the file that is being externally loaded, the methods are not working in that component.

This is the code of the component.
//------------------------------------------------------------------------------
#initclip
function visiblerClass() {
this.what = this.insofitem;
}
visiblerClass.prototype = new MovieClip();
// _root[this._parent.what]._visible = false;
visiblerClass.prototype.onLoad = function() {
this.b1.onRelease = function() {
_root[this._parent.what].gotoAndPlay ("f1");
};
this.b2.onRelease = function() {
_root[this._parent.what].gotoAndPlay ("f2");
};
this.b3.onRelease = function() {
_root[this._parent.what].gotoAndPlay ("f3");
};
};
Object.registerClass("Project_Component", visiblerClass);
#endinitclip

//-----------------------

The gotoAndPlay (); method is not working when this movie is externally loaded using loadMovie ();

Pls find the attachment

Anybody to answer my question..
With regards

abhilash

Lews
October 6th, 2003, 10:56 AM
That's because after loading movie A into movie B, _root in movie A points to the main timeline of movie B.
Changing _root to _parent will fix it.

Alternatively, if you're using MX2004 you can use this._lockroot = true; on the first frame of movie A, and then you can leave everything how it is.