Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-07-2007, 09:10 PM   #1
ykarmi
Registered User
 
Join Date: Jul 2005
Posts: 9
Red face Several external JPEGS - one preloader?

Hey Guys!
I have a flash file loading several external files.
I'm facing two problems:
1. **and the more important 1* Although I am loading several images, I want the preloader to be for all of them together - using a listener.
2. I want to load the images for use in the next scene, not the preloading scene, therefore I need to store them in a way that I can call them through ActionScript later on, something like Linkage, except I'm adding the Linkage in runtime.

I know how to create a preloader for one image at a time using a Movie Clip listener, but I want the preloader to show progress of the total amount of bytes loaded from all external images, not just one. Plus - if I use a MovieClip loader, the images will be loaded to a movie clip on the stage, but I want to call them using Action Script from a different scene in the movie.

Thank you very much,
Yuval Karmi
ykarmi is offline   Reply With Quote
Old 03-07-2007, 10:39 PM   #2
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 5,859
Default

First of all, whatever you load into a swf file remains in the cache so the next time you're loading them you won't be waiting for more than some milliseconds.

Secondly, what I would do would be to:

(X = the number of jpg's)

1. create X empty movie clips
2. create X listeners & MovieClipLoader's
3. set the alpha of each to zero
4. create a (number) variable like:
var loadedFiles:Number = 0;

5. within "onProgress" event handler of each, write a function like:

ActionScript Code:
listener1.onProgress = function(mc:MovieClip, loaded:Number, total:Number) {     var percent:Number = Math.round(loaded/total*100);     preloader.bar._xscale += percent/X;     statusT.text += loaded; }; listener1.onLoadComplete = function(mc:MovieClip) {     loadedFiles++;     if (loadedFiles == X) {         for (i=0; i<loadedFiles; i++) {             _root["emptyMcName"+i]._alpha = 100;         }     } };
Percentage line might need editing, but this theorically (maybe with a bit of change) should work, I guess...
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
inhan is offline   Reply With Quote
Old 03-07-2007, 11:08 PM   #3
ykarmi
Registered User
 
Join Date: Jul 2005
Posts: 9
Exclamation No luck, but thanks!

First of all Thank you for posting. I really appreciate it.
In this case, the preloader will finish loading one picture, then restart again from 0 - 100, loading the next picture. I don't want that, I want something like this:
Say I have 10 images, then if 1/10 images was loaded, the preloader will show 10 percent done.
Thank you again!
Yuval
ykarmi is offline   Reply With Quote
Old 03-08-2007, 12:30 AM   #4
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 5,859
Default

That's why I wrote "bar._xscale += percent/X" and all that.
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
inhan is offline   Reply With Quote
Old 03-08-2007, 02:33 AM   #5
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 5,859
Default

I'm trying to do what I suggested. I'll write back when I succeed
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
inhan is offline   Reply With Quote
Old 03-08-2007, 04:41 AM   #6
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 5,859
Default

Okay here is the file.
Attached Files
File Type: zip multi_pic_preloader.fla.zip (6.7 KB, 69 views)
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
inhan is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
External Preloader that opens main-movie in html-frame dabuel ActionScript 2.0 0 08-15-2006 04:08 PM
Preloader for external jpg only works 90% of time funfunfun ActionScript 1.0 (and below) 6 09-09-2005 02:04 PM
Again a question on preloader for external swf. Help please. mx-guest2004 ActionScript 1.0 (and below) 4 10-17-2004 09:49 PM
Flash 5 - preloader and animation for external swf's the chad ActionScript 1.0 (and below) 2 03-27-2004 09:39 PM
Preloader problem with external movies ian27 Simple Stuff (Newbies) 16 04-17-2003 01:06 AM


All times are GMT. The time now is 06:45 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.