Groups | Blog | Home
all groups > flash actionscript > july 2007 >

flash actionscript : Error Page in Flash for Full Flash Sites


kglad
7/8/2007 12:00:00 AM
samuels2921
7/8/2007 4:14:37 AM
Hello I have built my full site in Flash but one thing that I notice is that if
I make a mistake and forget to upload one of the swf files the site just hang
until I upload the file. So I decided to draw up a File not Found Page in flash
too. How would I write the Actionscript for this.



My Loader is "this.container"



Made this Code Up...



[code]if (_global.error) {

trace("Loading failed!");

this.container.loadMovie ("404.swf");

} else {

trace("Loading Passed");

}

this.container.onComplete = function(success) {

if (success) {

trace("Page Loaded");

} else {

_global.error = true;

}

};

[/code]

This One To



[code]

this.container.onLoad = function(success) {

if (success) {

trace("Page Loaded");

} else {

_global.error = true;

}

};



[/code]



Can some one help me with this?

samuels2921
7/8/2007 3:04:06 PM
onloaderror () but how do I add a listener to the loader. The loader is a Movieclip on the stage with an instance of "container"
kglad
7/8/2007 4:13:52 PM
you don't.

samuels2921
7/8/2007 4:42:48 PM
I tried that. it works but the loader is not place on the stage in the correct
place. Even if I place it in the correct place I have another problem . all my
movie clips have a loader script

_level0.container.loadMovie(_level0.currMovie+".swf");

allowing the loaded movie to be able to play a transitional effect before it
goto the next loaded movie
kglad
7/8/2007 5:49:44 PM
there's no difference in positioning a swf loaded using loadMovie() and using
the moviecliploader class: you still reference the target movieclip to control
the loaded swf.

and there's difference in using your transitional effect: again, instead of
using loadMovie() use loadClip, the moviecliploader class etc.
samuels2921
7/8/2007 7:27:53 PM
Ok, So how do I set a X and Y settings to move the movieclip in the proper place.

i tried

mc_loader.move (0, 314, noevent);

GWD
7/8/2007 7:41:17 PM
Why are you using the .move method.

Just to clarify....

Is mc_loader a movieclip or a Loader component?


GWD
7/8/2007 7:53:02 PM
[q]
also if I use the code provided by Adobe it works but how do I set a X and Y
settings to move the movieclip in the proper place.
[/q]
HERE:

function onLoadInit(mc:MovieClip) {
trace("onLoadInit: " + mc);
mc._x=100;
mc._y=100;
}

samuels2921
7/8/2007 8:08:05 PM
mcloader is the varialbe name adobe assigned to the blank movieclip.
GWD
7/8/2007 8:30:08 PM
My earlier post was based on what you had before you edited... I was confused
by your use of the move method which is more common with components and is not
something that is relevant for a MovieClip or a MovieClipLoader. I was guessing
(perhaps incorrectly) that you found it in the reference for the Loader
component which is something different.

Anyways... did you try the adobe code (which you say was working for you) with
adjusting the _x and _y properties in the onLoadInit function as per my last
post?
kglad
7/8/2007 8:57:48 PM
:



this.onLoadInit=function(mc:MovieClip) {
trace("onLoadInit: " + mc);
}

this.onLoadError=function(mc:MovieClip, errorCode:String, [httpStatus:Number]){
//
}

var container:MovieClip = createEmptyMovieClip("container",
getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("sites.swf", container);

container._x=0;
container._y=314;
GWD
7/8/2007 9:29:11 PM
@kglad : I see now. I had thought it was something to do with repositioning
based on different content. But its just the position of the original holder
clip.

@samuels2921 : please ignore my posts, sorry.
samuels2921
7/8/2007 9:41:58 PM
samuels2921
7/8/2007 9:42:48 PM
COde I used that solved my problems...

var container:MovieClip = createEmptyMovieClip("container",
getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
function onLoadError(mc:MovieClip, errorCode:String, httpStatus:Number) {
trace(">> loadListener.onLoadError()");
trace(">> ==========================");
trace(">> errorCode: "+errorCode);
trace(">> httpStatus: "+httpStatus);
_root.currMovie = "404";
_root.mcLoader.loadClip(_root.currMovie+".swf", _root.container);
}
function onLoadInit(mc:MovieClip) {
trace("onLoadInit: "+mc);
mc._x = -16;
mc._y = 432;
}

kglad
7/8/2007 9:58:17 PM
you're welcome.

AddThis Social Bookmark Button