A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: only one of 5 will not always load correctly

  1. #1
    will i ever get it?
    Join Date
    Feb 2004
    Posts
    707

    only one of 5 will not always load correctly

    not sure which of the several codes to post (without overwhelming you, the reader). QUick overview. i have 5 .swf files. One is the Main.swf. which loads a main movie with a menu to call the other external swf files. These others (Contact, About, Gallery, Etc) load into the Main.swf using a MovieClipLoader class. Ok, all is great.

    The Gallery swf also has a menu which also dynamically loads. Select an option from this menu, and thumbnails pop up. Select a thumbnail, and a large image loads....all this happens in Gallery.swf., and it works fine alone.

    The problem : All SWFs load and interact fine. Gallery loads fine...user looks at some photos, watches a video , user then navigates back to the main menu (at Main.swf). The user loads any others of the 4 swf files , user eventually navigates back to Gallery, and it won't load! But only Gallery has this problem- and it only has the problem IF the user loads a large image from a thumbnail. If not, the user can reload Gallery anytime. So, should i start debugging from Main.swf, or Gallery? and what should i be lookign for?

    code from Gallery.swf-
    Code:
    #include "lmc_tween.as"
    var ease = "easeoutquad";
    var dim:Number = 40;
    txCaption = captionBox.txCaption;
    preLoader._alpha = 0;
    //for thumbnails
    var mclListener:Object = new Object();
    var mclLoader:MovieClipLoader = new MovieClipLoader();
    //for big images
    var bigImageLoader:MovieClipLoader = new MovieClipLoader();
    var bigImageListener:Object = new Object();
    //////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////Load XML
    //////////////////////////////////////////////////////////////////////////
    function loadXML(arg) {
    	trace(arg);
    	var myXML:XML = new XML();
    	myXML.ignoreWhite = true;
    	myXML.onLoad = function(success:Boolean) {
    		if (success) {
    			loadThumbImages(this);
    		}
    	};
    	myXML.load("menus/XMLs/"+arg+".xml");
    }
    //myXML.load("images/imagesxml");
    //////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////Load THUMBNAILS
    //////////////////////////////////////////////////////////////////////////
    var selectedImage = 0;
    function loadThumbImages(myXML) {
    	removeMovieClip(imageTank);
    	mcHolder.alphaTo(100, 1, ease);
    	_global.mcHolder = this.createEmptyMovieClip("mcHolder", 2000);
    	var nX:Number;
    	var nY:Number;
    	mcHolder._x = 40;
    	mcHolder._y = 45;
    	root = myXML.firstChild.childNodes;
    	for (var i = 0; i<=root.length; i++) {
    		_global.mcImage = mcHolder.createEmptyMovieClip(i, i);
    		mclLoader.loadClip("images/"+root[i].attributes.thumb, mcImage);
    	}
    	mclListener.onLoadProgress = function(mcClip, bytesLoaded, bytesTotal) {
    		var percentLoadedNow:Number = Math.round((bytesLoaded/bytesTotal)*100);
    		if (bytesLoaded<bytesTotal) {
    			preLoader._alpha = 0;
    			preLoader.mcBar._xscale = Math.round((bytesLoaded/bytesTotal)*100);
    		}
    		if (bytesLoaded>=bytesTotal) {
    			preLoader._alpha = 0;
    			mcClip._alpha = 0;
    			mcClip.alphaTo(dim, .6, ease);
    		}
    	};
    	mclListener.onLoadInit = function(mcClip:MovieClip) {
    		mcClip._xscale = 25;
    		mcClip._yscale = 25;
    		mcClip.onRollOver = function() {
    			upAlpha(this);
    		};
    		mcClip.onRollOut = function() {
    			downAlpha(this);
    		};
    		mcClip.onRelease = function() {
    			loadBigImage(myXML, this._name);
    			return selectedImage=this._name;
    		};
    		var lastColumn = (mcClip._width+10)*2;
    		if (nX == undefined) {
    			nX = 750;
    			nY = 50;
    		}
    		if (nY>=450) {
    			nX -= mcClip._width+5;
    			nY = 50;
    		}
    		mcClip._x = nX;
    		mcClip._y = nY;
    		nY += mcClip._height+5;
    	};
    	mclLoader.addListener(mclListener);
    }
    //////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////Load LARGE IMAGES
    //////////////////////////////////////////////////////////////////////////
    mcPictFrame._alpha = 0;
    var bigImageNewPlace:Array = [];
    function loadBigImage(myXML, index) {
    	bigImageOldPlace = bigImageNewPlace.pop();
    	//removeMovieClip(imageTank);
    	_global.imageTank = this.createEmptyMovieClip("imageTank"+index, index);
    	bigImageNewPlace.push(imageTank);
    	trace(bigImageNewPlace);
    	preLoadDepth = preLoader.getDepth();
    	oldPlaceDepth = bigImageOldPlace.getDepth();
    	if (preLoadDepth<oldPlaceDepth) {
    		preLoader.swapDepths(bigImageOldPlace);
    	}
    	captionBox.alphaTo(0, 1, ease);
    	var bigImageX:Number;
    	var bigImageY:Number;
    	bigImageLoader.loadClip("images/"+myXML.firstChild.childNodes[index].attributes.picture, imageTank);
    	txCaption.text = myXML.firstChild.childNodes[index].attributes.words;
    	bigImageListener.onLoadProgress = function(mcClip, bytesLoaded, bytesTotal) {
    		if (bytesLoaded<bytesTotal) {
    			preLoader._alpha = 80;
    			preLoader.mcBar._xscale = Math.round((bytesLoaded/bytesTotal)*100);
    			preLoader.txPercent.text = Math.round((bytesLoaded/bytesTotal)*100)+"% loaded...";
    		}
    		if (bytesLoaded>=bytesTotal) {
    			captionBox.alphaTo(100, 1, ease);
    			//bigImageOldPlace.alphaTo(0,1,ease)
    			preLoader._alpha = 0;
    			//preLoader.alphaTo(0, .5, ease);
    			mcClip._alpha = 0;
    			mcClip.alphaTo(100, 1, "easeoutquad");
    		}
    	};
    	bigImageListener.onLoadInit = function(mcCurrentBigImage:MovieClip):Void  {
    		mcCurrentBigImage._xscale = 80;
    		mcCurrentBigImage._yscale = 80;
    		if (mcCurrentBigImage._width>mcCurrentBigImage._height) {
    			mcCurrentBigImage._x = (bg._width-mcCurrentBigImage._width)-(mcCurrentBigImage._width/4);
    			mcCurrentBigImage._y = 75;
    		}
    		if (mcCurrentBigImage._width<mcCurrentBigImage._height) {
    			mcCurrentBigImage._x = (bg._width-mcCurrentBigImage._width)-(mcCurrentBigImage._width/2+75);
    			mcCurrentBigImage._y = 35;
    		}
    		if (mcPictFrame.isTweening(false)) {
    			captionBox.tween("_y", mcCurrentBigImage._y-20, 1, ease);
    		}
    		mcPictFrame._alpha = 100;
    		mcPictFrame.tween(["_x", "_y", "_width", "_height"], [mcCurrentBigImage._x-10, mcCurrentBigImage._y-10, mcCurrentBigImage._width+25, mcCurrentBigImage._height+25], 1, ease);
    	};
    	bigImageListener.onLoadComplete = function(mcClip) {
    		bigImageLoader.unloadClip(bigImageOldPlace);
    	};
    	bigImageLoader.addListener(bigImageListener);
    }

  2. #2
    Senior Member
    Join Date
    Feb 2006
    Posts
    107
    I didnt go through your code, maybe you need to do a _lockroot on the one that isnt working?

    movieclipName._lockroot;

  3. #3
    will i ever get it?
    Join Date
    Feb 2004
    Posts
    707
    thanks mpalma...this took me a while, but the problem was in the gallery.swf...seems that i was prematurely calling to "removeMovieClip(imageTank)" This is the clip that holds the bigImages. Anyway, i don't know why, but taking that out all together has done the job....

    by the way, _lockroot is a nice feature. I never noticed it. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center