Ok, I’ve gotten it to work – that should be good news, but it’s not that good because I feel more confused than ever about the details of Flash’s referencing.
This is my function:
Upimage = the outer clip
Jpg = the container clip that loads the Jpg
Loader_mc = as you suggested, the clip that checks the loading info for “jpg”
_root.upimage.loadJPG = function (jpg1 : String){
// create mc
this.createEmptyMovieClip("jpg", 1);
this.jpg.loadMovie(jpg1);
this.createEmptyMovieClip("loader_mc", 2);
this.loader_mc.onEnterFrame = function() {
var t = this._parent.jpg.getBytesTotal();
var l = this._parent.jpg.getBytesLoaded();
if (t && l == t) {
//this.percent.text = "loaded!!!!!!!!!!!!!!!!!!!!!";
if (this._parent.jpg._width > 0){
this._parent.jpg._x = -(this._parent.jpg._width/2);
this._parent.jpg._y = -(this._parent.jpg._height/2);
this._parent.jpg._yscale = 24;
this._parent.jpg._xscale = 24;
}
//this.removeMovieClip(); // notice this is commented out
}
}
}
As you can see, I had to comment out the “this.removeMovieClip” line. Why? Because if I left it in, it would remove “upimage” and everything inside. This has always been a problem for me. When I tried your previous code (with the “loader_mc” and “container_mc” references):
createEmptyMovieClip("container_mc", 1);
createEmptyMovieClip("loader_mc", 2);
container_mc.loadMovie("picture.jpg");
loader_mc.onEnterFrame = function() {
var t = container_mc.getBytesTotal();
var l = container_mc.getBytesLoaded();
if (t && l == t) {
trace(container_mc._height);
trace(container_mc._width);
this.removeMovieClip();
}
};
… the Flash compiler gave me errors, saying that there were no loader_mc or container_mc properties. So, I used the “this._parent” prefix. Inside a function on clip, “this” stands for what? I’m really confused now.
I’m having trouble tracing my paths because this section is only reachable with the database. I did a small experiment before, comparing “this”, “_parent”, and “this._parent” in an event handler and the results were:
“this” is the clip that has the event handler
"_parent" and “this._parent” both refer to the parent of the clip
HOWEVER, when I compile code, Flash won’t accept “_parent”… it will only accept “this._parent”… I’m lost with referencing in Flash… do you have a guideline, rulebook, etc.?
Thanks again for your time, mate.
Mike