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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loading other .swf conterminously to preload...BUT 1

Status
Not open for further replies.

disfasia

Programmer
Apr 20, 2001
378
CA
The BUT is that I do not want the .swf to load on a different level. I have fixed my slide show issue by just contenting myself with its weight and creating a preload. But I want the slide show to open into a fixed window via javascript which I know how to do.

What I don't know is how to do is make the preload load the other .swf so that once the 2nd .swf (the actual slide show) is loaded, the preload finished, and then the command "ifFrameloaded get url..." pops up the already loaded (virtually loaded?) .swf.

Is this possible?
 
So you mean you load the other swf into a movieclip and you want the weight of this clip be respected in your preloader?

If so do not use the "ifFrameLoaded" command.
I know when beginning to program a preloader this looks much more comfortable, but this way you just can not take care of 2 movies within one preloader (at least as far as I know).

Use getBytesLoaded and getBytesTotal to do your preloader.

Say you have a movieclip that is your preloader.
I use this movieclip now to load your external swf and to update the variables that should be displayed in some way (either as some value of percentage in a textfield or as the width of a bar or something else) and that are necessary to calculate the percentage of the loaded bytes.
I assume the path to your movieclip that displays the presentation is _root.clipholder

so i'd put this on the preloader:
Code:
onClipEvent(load){
loadMovie("yourpresentation.swf","_root.clipholder");
}
onClipEvent(enterFrame){
totalloaded=_root.getBytesLoaded+_root.clipholder.getBytesLoaded;
toload=_root.getBytesTotal+_root.clipholder.getBytesTotal;
percentage=math.round(totalloaded/toload);
if(percentage==100){
_root.nextFrame();
}

I mean of course this is not the full code to build a preloader but I hope you can see what I mean.
If not just post one more time.
(In case of total desperation make an upload of the fla and post the link, ok? :) )

regards

tektips.gif
 
Thanks. Actually, I a preloader thing and I have it scripted as:

onClipEvent (load) {
this._xscale = 0;
total = _root.getBytesTotal();
}
onClipEvent (load) {
loadMovie ("image.swf", "_root.clipholder");
}
onClipEvent (enterFrame) {
geladen = _root.getBytesLoaded();
percent = Math.round((geladen/total)*100);
this._xscale = percent;
_root.showpercent = percent+" %";
if (percent == 100) {
_root.nextFrame();
}
}
 
The rest of my mssg was chooped off. To finish: What I want to do is have the .swf fit to a certain size ie:

onclipevent
("javascript:NewWindow=window.open('virtualtour.html', 'newWin','scrollbars=no,status=no,width=800,height=550');NewWindow.focus();void(0);");
}
 
Part III.. So, what do I have to do to have the .swf load as a pop up or in the same frame BUT within the above jacascript size?
thanks again,

disfasia
 
I figured it out. Here is what I put instead: (thanks)
onClipEvent (load) {
this._xscale = 0;
total = _root.getBytesTotal();
}
onClipEvent (load) {
getURL ("javascript:NewWindow=window.open('image.html', 'newWin','scrollbars=no,status=no,width=800,height=550');NewWindow.focus();void(0);");
}
onClipEvent (enterFrame) {
geladen = _root.getBytesLoaded();
percent = Math.round((geladen/total)*100);
this._xscale = percent;
_root.showpercent = percent+" %";
if (percent == 100) {
_root.nextFrame();
}
}
 
Oh oh, problem. The preload does not let the .swf load before opening the 2nd .swf. What to do? I will put zips of the .fla s for both at:


and



All help is greatly appreciated. Peace.

disfasia

ps. this is for a lecture on mapplethorpe et al (you are warned about the content ) :)
 
Ah, now i know what you are talking about. You want the film that will appear in the popup to be preloaded before the popup pops up...
Sorry, I didn't quite get that before.
Ok, I'll have a look at it!

regards

tektips.gif
 
Ok, here is what I did:
I put a movieclip (_root.clipholderfake) outside the stage and loaded the film "image.swf" into it.
This way it can't be seen by the user but one can force the preloader to take this file into account.
Once the file is loaded it is cached by the browser so if you open a site containing this film it does not have to be reloaded.
When the preloader reaches 100% percent the film in the movie in _root.clipholderfake is unloaded
and the popup containing the html site with the embedded flashmovie is opened.

By the way... can it be that I somehow know this preloader from somewhere :) ?

Here is the link to download your modified file:

Please tell me when you downloaded the file so that I can delete it from the server, unfortunately I don't have that much space there.


regards

tektips.gif
 
The only problem about this file is that you'll have to wait for the slideshow to be loaded until you are able to read the text written in the first file.

How would you like the idea to display the text, make a preloader-bar below it so that people can see at least something is going on and that they could read something while the other film is loading?

Same technique as I described before but this time the preloader of the first film wouldn't take the second one into account. The preloading of the second one will be done when the first one has loaded. And when the second one has loaded the window pops up. Might be a more elegant version, don't you think so? Just tell me, it would just take 5 minutes to change that!

regards

tektips.gif
 
Oh my! Is it your preloader??? I apologize.. I stuck it in there until I work on the actual one later... I work backwards--the harder tasks first and then the fluff! :)

I am now downloading so by the time you read this, it will be done! Thanks so so much!!! Oh NO, I cannot open it!!! :( I have a Mac and am using flash 5.0 ...this might be the problem. I think I follow what you did, but can you tell me the script you used???


Thanks again!!!

disfaisa
 
I have just tried to do it based on what you said and I almost have it...BUT it is that almost that is driving me mad! If I recall you are in Germany or Austria (or maybe I am making this up?) so I will wait until tomorrow to see if you can post the script for the preload and the off side of window fake load.

Thank you!

disfasia
 
:) Hi Disfasia,
you don't have to apologize, I just felt it was somehow familiar to me, but don't bother, I knew I once loaded it up somewhere for public use, so just go ahead using it! :)

here is the code I used:
Code:
onClipEvent (load) {
	_root.stop();
	this._xscale = 0;
	loadMovie("image.swf", _root.clipholderfake);
}
onClipEvent (enterFrame) {
	loadMovie("image.swf", _root.clipholderfake);
	total = _root.getBytesTotal()+_root.clipholderfake.getBytesTotal();
	geladen = _root.getBytesLoaded()+_root.clipholderfake.getBytesLoaded();
	percent = Math.round((geladen/total)*100);
	this._xscale = percent;
	_root.showpercent = percent+" %";
	if (percent == 100) {
		unloadMovie(_root.clipholderfake);
		getURL("javascript:NewWindow=window.open('image.html', 'newWin','scrollbars=no,status=no,width=810,height=600');NewWindow.focus();void(0);");
		_root.nextFrame();
	}
}

Remember: Put the clipholder-Movieclip outside the stage and name it "clipholderfake". That's the name I used in my script. Otherwise you'll just have to change the script (which shouldn't cause too many problems either)


By the way, I am located in Austria. I insist on this little difference! :) Just kidding.



regards

tektips.gif
 
Thanks for the code! But I am getting error messages for lines two and three? I have tried to figure out why and I cannot? Why is this? It will not complete the script or run it properly...

Is there an error in these lines?

Sorry for all the trouble.

disfasia
 
Thanks for this firegambler. But when I test it, the timer doesn't work and the second swf, image.swf, does not load. Did you test it.

You can see what happens at

I am working on it, but I don't know what I should change :)

Let me know if it works on your system.

best,

disfasia
 
I tested what you sent me right out of the zip and it doesn't load. Did you send me the right file? It shows "Nan" where the numbers for loading should show up...and then online it doesn't work. Could this be because I have flashnomargins??? (I doubt it). the link above will show you what happens...maybe you sent me the wrong file? thanks so much for your help!

disfasia
 
Hi again, I have run another type but still, the load bar does not load and the second swf does not wait to load...
I will still keep trying...let me know if you have any ideas?

best
disfasia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top