• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 484
  • Last Modified:

How do I fix my onload and loadmovie code?

I have a URL Query String Generated Flash Site and I need this code so that when it can not find the swf typed it will return with an Error. Here's my code that I thinks should work.
loader1.onLoad = function() {
if (success) {
pagetxt.text = ("Page Found");
} else {
pagetxt.text = ("File Not Found");
}
};

Open in new window

0
samuels27921
Asked:
samuels27921
  • 4
  • 4
2 Solutions
 
Antonio EstradaTech Leader / Senior Web DeveloperCommented:
How about this:

loader1.onLoad = function(success) {
  if (success) {
    pagetxt.text = "Page Found";
  } else {
    pagetxt.text = "File Not Found";
  }
}

I assume you're using something like

queryStringArgument = argument;
loader1.loadMovie(queryStringArgument);

before the loader1.onLoad handler

-V
0
 
samuels27921Author Commented:
I dont know what you mean. I used javascript to pass the query string to flash with variables. How do you use that query string and how can i encorporate that with my loader. What does querySringArgument; do?
0
 
samuels27921Author Commented:
Also I tried that it alway's return false.

-quote-

How about this:

loader1.onLoad = function(success) {
  if (success) {
    pagetxt.text = "Page Found";
  } else {
    pagetxt.text = "File Not Found";
  }
}

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Antonio EstradaTech Leader / Senior Web DeveloperCommented:
Actually, thinking about it; it's not possible that way (it is for XML loading but that's another story), let me do a workaround...

-V
0
 
Antonio EstradaTech Leader / Senior Web DeveloperCommented:
Alright, here it is:

<code snippet>

This way it does work. If you have any doubts, don't hesitate to ask.

Good Luck.

-V
movieToLoad = "someMovie.swf"; //Here you would use the variable you're sending from JavaScript
Temp = loader1.createEmptyMovieClip("Holder",this.getNextHighestDepth());
Temp.loadMovie(movieToLoad);
 
this.onEnterFrame = function() {
	total = Temp.getBytesTotal();
	total!=-1?pagtext.text = "File Found":pagtext.text = "File Not Found";	
}

Open in new window

0
 
samuels27921Author Commented:
Very Close Vulturous! I designed the perfect code with what I was doing before you posted this!

Thanks

//Provides Error Page
var loadListener:Object = new Object();
loadListener.onLoadError = function(target_mc:MovieClip, errorCode:String, httpStatus:Number) {
//Display's Error Log in to the Flash Text Boxes
	trace(">> loadListener.onLoadError()");
	stattxt.text = ("==========================");
	pagetxt.text = ("ERROR "+errorCode);
	httptxt.text = ("httpStatus: "+httpStatus);
	redirect.play(); //plays a count down redirect movie clip
};
//Listens for Errors
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());

Open in new window

0
 
samuels27921Author Commented:
Thank You
0
 
Antonio EstradaTech Leader / Senior Web DeveloperCommented:
mhh, that's a quite nice approach :)

I don't think I've ever actively used the MovieClipLoader class, might give it a shot sometime... In the end; glad you got it working!

-V
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now