troubleshooting Question

Flash AS2 LoadVariables doesn't seem to work when swf first loads

Avatar of ComputerGeek96
ComputerGeek96 asked on
Adobe Flash
18 Comments1 Solution903 ViewsLast Modified:
I have inherited a flash website where on a page that displays database data uses the LoadVariables method to pull the data and the OnData method to populate fields.  I am using FlashVars in cases where I want to link directly to a specific record.  the AS2 sees the variable and calls the function but for some reason, something between the LoadVariables and OnData methods gets hosed and it doesn't load the from and data.  Now if I navigate the flash a little, then hit the logo which has a gotoAndStop(1) command on it, then it goes to that specific record as it was supposed to but not on the initial load of the flash.  I've attached the code to the function I'm calling since I know at least calling the function works.

function spec_portfolio(mid) {
	gotoAndStop("frame_portfolio");
	this.portfolio_mc["videobutton"]._visible = false;
	this.portfolio_mc["videobutton1"]._visible = false;
	for (var i:Number = 1; i<mediaImages; i++) {
		this.portfolio_mc["ID"+i] = "";
		this.portfolio_mc["MediaPath"+i] = "";
		this.portfolio_mc["mediasquare"+i].loadMovie("blank.jpg", this.portfolio_mc["mediasquare"+i].getNextHighestDepth());
		this.portfolio_mc["mediaframe"+i]._visible = true;
	}
	this.portfolio_mc.loadVariables("stats2.cfm?ID="+mid+"&startrow="+startrow_number2+"", 0, "GET");
	this.portfolio_mc.onData = function() {
	getURL("javascript:alert(\"" + mid + "\");");
		portfolio_mc["edit_btn"].visible = 0;
		var vidstr:String = this.stats_videoflag;
		var vidstr2 = vidstr.substring(0, 1);
		trace(this.stats_videoflag);
		if (vidstr2 != "0") {
			portfolio_mc["videobutton"]._visible = true;
			portfolio_mc["videobutton1"]._visible = true;
		}
		var myod:String = this.Path;
		var myid:String = myod;
		if (myid != undefined) {
			var end:Number = (myid.indexOf("jpg")+3);
			var myid2:String = myid.substr(0, end);
			this.mugshot.loadMovie(myid2, this.mugshot.getNextHighestDepth());
			for (var i:Number = 1; i<mediaImages; i++) {
				var meod:String = eval("portfolio_mc.MediaPath"+i);
				var meid:String = meod;
				if (meid != undefined) {
					var end:Number = (meid.indexOf("jpg")+3);
					var meid2:String = meid.substr(0, end);
					portfolio_mc["mediasquare"+i].loadMovie(meid2);
					//portfolio_mc["mediaframe"+i]._visible = true;
				}
			}
			//this.mugshot._alpha(50);
		}
		var elcounter:Number = ((portfolio_mc.startrow_num*1)+(portfolio_mc.maxrow_num-1));
		if (elcounter>(portfolio_mc.record_num*1)) {
			elcounter = portfolio_mc.record_num;
		}
		portfolio_mc.links_text = portfolio_mc.record_num+" media items found....displaying ";
		portfolio_mc.links_text += portfolio_mc.startrow_num+" thru "+elcounter+"     ";
		var bcounter:Number = ((elcounter)-(portfolio_mc.startrow_num*1)+2);
		trace(bcounter);
		for (var j:Number = bcounter; j<mediaImages; j++) {
			portfolio_mc["mediaframe"+j]._visible = false;
		}
	};
//getURL("javascript:alert(\"" + mid + "\");");
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros