Dear members of the flash community.
I´ve just spent 3 days scanning the whole Internet after this script (see below). I´ve read maybe 100 topics on varios actionsscript forums but they all end the same.
-
Unanswered or incomplete.
-
Now, I´m just a poor web designer without no fanzy as-skills and without money.
-
All I could offer you in return if you could help me out, except the sweeeeet feeling of solving a huge problem to millions of poor web designers, is helping you with a logo or something.
This is what I´m looking for:
[LIST]
[]The visitor clicks on a link that starts to load a external swf.
[]The swf loads behind the current content, showing the preloading process with a loading bar och numbers or what ever.
[*]When the swf has preloaded it fades over (with alpha) the current content which creates a very smooth web experience.[/LIST]I don´t need any xml driven, slideshow gallery, automatic scripts. Pleease help me, pleeeese.
Best regards
Tony Bolero
Thank you, thank you, thank you! :crazy:
- If you ever need design help with a logo or whatever, send me an email to skoglundjonas@gmail.com and I´ll help you.
Just a little detail… Is it possible to not fade out the current mc while fading in the new one? I´ll commented out the:
//fade out the last clip that was in focuss
clearInterval(focussedClip.fadeIn_int);//clear fade in interval incase it was started but had not finished
// focussedClip.fadeOut_int = setInterval(fadeingOut,10,focussedClip);
//////////////////////////////////////////////
but if you clicked on a previous loaded clip it didn´t fade in, it just showed up instantly. If it to much trouble, forget about it.
Best regards
Tony
This is because if you do not fade out, the clip is still fully opaque. So if you click on it’s button the container is moved to the top and the fade in interval is started, however, it is all ready faded in from last time you viewed it.
[FONT=Verdana]If you want to not fade out current clip but still fade in next clip, you can set the clips alpha to 0 before each time you start a fade in interval.[/FONT]
If you do this you can get rid of any code pertaining to fading out and there is also no reason to initialize each clips alpha to 0.
[FONT=Verdana]
[/FONT] [FONT=Verdana]Here’s what I mean:[/FONT]
loadBar._alpha = 0;//make loadBar invisable
//create containers to load the clips into
var container1:MovieClip = createEmptyMovieClip("container1", _root.getNextHighestDepth());
var container2:MovieClip = createEmptyMovieClip("container2", _root.getNextHighestDepth());
var container3:MovieClip = createEmptyMovieClip("container3", _root.getNextHighestDepth());
var container4:MovieClip = createEmptyMovieClip("container4", _root.getNextHighestDepth());
var container5:MovieClip = createEmptyMovieClip("container5", _root.getNextHighestDepth());
//positon containers on the stage
container1._x = 120;
container1._y = 40;
container2._x = 120;
container2._y = 40;
container3._x = 120;
container3._y = 40;
container4._x = 120;
container4._y = 40;
container5._x = 120;
container5._y = 40;
MovieClip.prototype.myLoader = new MovieClipLoader();
MovieClip.prototype.hasLoaded = false; //stores if a clip has been loaded
showClip("blah1.swf", container1);//start on blah1 by default
blah1_BT.onPress = function(){
showClip("blah1.swf", container1);
}
blah2_BT.onPress = function(){
showClip("blah2.swf", container2);
}
blah3_BT.onPress = function(){
showClip("blah3.swf", container3);;
}
blah4_BT.onPress = function(){
showClip("blah4.swf", container4);
}
blah5_BT.onPress = function(){
showClip("blah5.swf", container5);
}
function showClip(url:String, mc:MovieClip){
if(focussedClip != mc){
focussedClip = mc; //set new clip to be focussed
mc.swapDepths(_root.getNextHighestDepth());//put clip on top of all others
mc.myLoader.addListener(this); //register listener to catch events
if(!mc.hasLoaded){//load clip if it is not loaded
mc.myLoader.loadClip(url, mc); //load clip into its container
loadBar._alpha = 100; //show the progress bar
}else{
loadBar._alpha = 0; //hide the progress bar
mc._alpha = 0;
mc.fadeIn_int = setInterval(fadeingIn,10,mc);// start fade in
}
}
}
function onLoadProgress(mc,bL,bT){
//make the scale of the fill bar proportional to the amount the movie clip has downloaded
if(mc == focussedClip){
loadBar.fillBar._xscale = 100 * (bL/bT);
}
}
function onLoadComplete(mc){
if(mc == focussedClip){
loadBar._alpha = 0; //make loadBar invisable
mc._alpha = 0;
mc.fadeIn_int = setInterval(fadeingIn,10,mc); //turn on an interval to change alpha over time
}
mc.hasLoaded = true;
}
MovieClip.prototype.fadeingIn = function(mc){
if(mc._alpha < 100){
mc._alpha++; //increase oppacity
}else{
clearInterval(mc.fadeIn_int); //max oppacity so turn off the fade interval
}
}
[FONT=Verdana]Hey, if you get something working post a url to the site your making so I can check it out. [/FONT]