3dron
November 10, 2002, 8:23am
1
This works:
_global.loadJPG = function (name, mc, x, y) {
createEmptyMovieClip(mc, m++);
_root.[mc].moveTo( x, y);
loadMovie (name, mc);
}
This doesn’t work:
_global.loadJPG = function (name, mc, x, y) {
this.createEmptyMovieClip(mc, m++);
this[mc].moveTo( x, y);
loadMovie (name, mc);
}
Why doesn’t “this” work? I need it because this function is not always called from the _root.
Ron
system
November 10, 2002, 10:06am
2
Try this:
_global.loadJPG = function (name, mc, x, y) {
this.createEmptyMovieClip(mc, m++);
this[mc].moveTo( x, y);
this[mc].loadMovie (name);
}
Any help?
pom :cowboy:
system
November 10, 2002, 5:41pm
3
I tried this also, and no luck.
It seems that no empty clip is being created in the first place.
Without the “this” it works.
Help
ROn
system
November 10, 2002, 6:08pm
4
Well, I’m not sure, but I think that _global is an object. So maybe you’re creating a clip in that object, which may not be possible. I’m just guessing here.
Did you try the function without _global in front?
pom
system
November 11, 2002, 12:20am
5
ily’s on the money.
_global is not a movie clip and thus doesn’t have the methods that are available to movieclips. try writing it as a movieclip method.
MovieClip.prototype.loadJPG = function (name, mc, x, y) {
var clip = this.createEmptyMovieClip(mc, m++);
clip.moveTo( x, y);
clip.loadMovie (name);
}
system
November 11, 2002, 5:54am
6
Great guys this makes sense, and works. Except for the moveTo. It doesn’t seem to take the positioning.
clip.moveTo( x, y);
Doesn’t work
clip._x = x; clip._y = y;
This does?
I guess I can live with. But why?
Ron
system
November 11, 2002, 8:57am
7
moveTo is part of the drawing api, not a method to change the x,y of a movieclip.
but given the wording, you could be excused for the mistake. ; )