Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

movieClip disappears in MSIE

Status
Not open for further replies.

joepeacock

Programmer
Nov 5, 2001
74
US
Hey everyone.

I have a movie with a movieclip that likes to just disappear.

Here is a page with the movie :
This is a movie with a single movieclip. the movieclip accesses a database through Flash Remoting components, creates daughter movieclips and loads jpeg files into those mcs. Soon after the data is loaded, the whole movieclip (not the whole movie) vanishes.

This is not giving me any problems in Opera 7 or Netscape 7 (windows), but in MSIE 6, the clip will disappear immediately almost every time. One time in ten or so, the jpeg images will load and scroll for a while before it dissapears (never more than a couple of seconds).

For testing, I placed some text fields that you can see in the movie. the "test" text is on the _root level. The "true"/"false" field is in the problem mc and indicates whether the database information has loaded.

Has anyone seen this before? Other flash movies without any remoting are working just fine, but it appears that this problem only manifests after the remoting components have completed their task.

Let me know if you've ever seen this before. Thanks!

Joe
 
Looks like a timing thing. On the first load the page doesn't work, but if you refresh it does work. (IE 6, Win XP Pro)

So my bet is that you are loading the second movie before the variables have finished loading. Are you using a loadVars object? Can you post your code or your fla?

Wow JT that almost looked like you knew what you were doing!
 
I'm not getting it to work even if I refresh. The second movie isn't something being loaded, it's just a movieclip instance. Within that movieclip, it loads the icons. Here's the code:

Movieclip frame 1
Code:
// Include the Flash Remoting ActionScript classes.
#include "NetServices.as"
#include "NetDebug.as"
#include "DataGlue.as"

// Make a connection to the server.
if (inited == null) { // do this code only once
    inited = true;
	_root.vertOffset = 20;
	
	NetServices.setDefaultGatewayUrl("[URL unfurl="true"]http://XXXXXXXX/flashservices/gateway");[/URL]
	// connect to the gateway
    gateway_conn = NetServices.createGatewayConnection();
	// Request the service, "movie", and create a service object,
	// "svcMovie"
	svcMovie = gateway_conn.getService("flashComponents.getLineCard", this);
	// Call the method, "getIcons".
	svcMovie.getIcons();
	iconFiles = new Array();
	iconsLoaded = false;
}

	function getIcons_Status(error){
	// Set the status text.
	trace("Error: " + error.description);
	}
	
function getIcons_Result(result) {
	check = 1;
	for(i=0;i < result.getLength(); i++) {
		var thisRecord = result.getItemAt(i);
		iconFiles[i] = thisRecord.lc_img;
		_root.topIconID = i;
	}
	iconsLoaded = true;
}


function loadIcon(id,space) {
	theSpot = "iconHolder" + space +"_mc";
	loadMovie("[URL unfurl="true"]http://XXXXXXXXXXX/logos/jpgversions/"[/URL] + iconFiles[id] + ".jpg",theSpot);
}

//Set Default Info
_root.scrollDir = -1;
_root.scrollSpeed = 1;
lastIcon = -1;
runOnce = 0;
_root.lastLoaded = -1;
_root.scrollOffset = 0;
_root.iconsReady = false;

Movieclip Frame 2
Code:
if((iconsLoaded) && (runOnce == 0)) {
  runOnce = 1;
  setX = 0;
  setY = 2;
  for(j=0;j<20;j++) {
	createEmptyMovieClip("iconHolder"+j+"_mc",j+1);
	loadIcon(j,j);
	
	with(eval("iconHolder" + j +"_mc")) {
		_x = setX;
		_y = setY;
	}
	if(setX == 408) {
		setX = 0;
		setY = setY + 57;
	} else {
		setX = setX + 136;
	}
	_root.lastLoaded = j;
  }
  
  _root.iconsReady = true;
  _root.topLine = 0;
}


if((iconsLoaded) && (runOnce == 1)) {
	for(i=0;i<20;i++) {
		with(eval("iconHolder" + i +"_mc")) {
			_y = _y - (1 * _root.scrollSpeed);
		}
	}
	_root.scrollOffset = _root.scrollOffset + (1 * _root.scrollSpeed);
	
	if(_root.scrollOffset == 57) {
		l = _root.topLine;
		for(i=l;i<l+4;i++) {
			with(eval("iconHolder" + i +"_mc")) {
				_y = _y + 285;
			}
			nextI = _root.lastLoaded + 1;
			if(nextI > _root.topIconID) nextI = 0;
			loadIcon(nextI,i);
			_root.lastLoaded = nextI;
		}
		_root.topLine = l + 4;
		if(_root.topLine == 20) _root.topLine = 0;
		_root.scrollOffset = 0;
	}
}

The third frame just has a gotoAndPlay() back to the second frame.

It's this entire movieclip that's vanishing from the screen.
 
Okay, it makes no sense, but I tracked down the problem. Maybe someone can shed some light on why this would makea difference.

BAD CODE:
for(i=0;i<20;i++) {
with(eval("iconHolder" + i +"_mc")) {
_y = _y - 1;
}
}

GOOD CODE THAT GIVES ME NO PROBLEMS:
for(i=0;i<20;i++) {
eval("iconHolder" + i +"_mc")._y = eval("iconHolder" + i +"_mc")._y - 1;
}

???
Joe
 
I have had similar problems using the With statement like that. Don't know why though.. it should work. Maybe someone else has some insight.

You could simplify it a bit more like this:

Code:
theHolder = eval("iconHolder"+ i +"_mc");

theHolder._y = theHolder._y-1;

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top