il clip "foto" è in un livello dentro il clip "foto_mask" a sua volta dentro "cornice" (tutti e tre istanziati con gli stessi nomi)

se metto questo codice direttamente sul 1° frame del livello che contiene il clip "foto" funziona.
Io però vorrei spostare tutto il codice sul 1° frame della scena1.
Che devo cambiare?

Poi:
removeMovieClip('this.preload1.bar1')
delete onEnterFrame;
non dovrebbe sparire il preload?
invece per eliminarlo devo aggiungere
this.preload1.bar1._visible = false

codice:
function carica(filmato, target) {

	width1 = 440;
	height1 = 330;
	
	this[target].loadMovie(filmato);
	onEnterFrame = function () {
		caricati = this[target].getBytesLoaded();
		totali = this[target].getBytesTotal();
		var loaded1 = Math.round((caricati/totali)*100);
		this.preload1.loading1 = loaded1+' %';
		this.preload1.bar1._xscale = loaded1;
		if (caricati == totali && totali>100) {
			removeMovieClip('this.preload1.bar1')
			delete onEnterFrame;
			trace("loaded");
			attachMovie("maschera", "maschera", 100);
			maschera._x = foto._x;
			maschera._y = foto._y;
			foto.setMask(maschera);
			maschera.masch.play();

				
				
				altezza = (this[target]._height*width1)/this[target]._width;
				larghezza = (this[target]._width*height1)/this[target]._height;

				if (this[target]._width>width1 || this[target]._height>height1) {
					if (this[target]._height<this[target]._width) {
						this[target]._width = width1;
						this[target]._height = altezza;
											} else if (this[target]._height>this[target]._width) {
						this[target]._width = larghezza;
						this[target]._height = height1;
											} else {
						this[target]._width = this[target]._height=height1;
					}
					if (this[target]._height>height1) {
						this[target]._height = height1;
						this[target]._width = larghezza;
					}
				}
				// centra la foto
				this[target]._x = (width1-this[target]._width)/2;
				this[target]._y = (height1-this[target]._height)/2;
				//delete onEnterFrame;
		
		}
	};
}
carica("foto.jpg", "foto");