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

samuels27921Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.