PDA

View Full Version : Preloaders


mm101061
07-09-2003, 03:43 AM
Hi,
I am using Flash4 in a PowerMac.
I have a movie ("slideshow.swf") that presents a series of photographs.
In the first and only frame of this movie there are some buttons (thumbnails) that, when pressed, call to a movieclip ("photos")that has a photograph in each frame (about 30). There is an instance of that movieclip in the main stage. Every time the user clicks on a thumbnail, the corresponding photo appears.
Now, I need to put a preloader to entertain the user while all the photographs are loading.
The problem is that if I use "If frame is loaded" action, syntax requires I put a scene and a frame number (or label). But my movie has only one frame. So the question is, how can I use a preloader that looks "inside" the movie, to see if the last frame of the movieclip "photos" is loaded, before allowing the movie "slideshow.swf" to start?
Thanks for your time.
Marcelo

Warrior
07-09-2003, 03:20 PM
Do you know how to use the getBytesTotal(); and getBytesLoaded(); There is a tutorial on this on the website that shows you what you asked for :) ;)

mm101061
07-09-2003, 03:25 PM
Hi Warrior,
Thanks for your help. Are those actions available for Flash4?
I will look for that tutorial.
Thanks,
Marcelo

Warrior
07-09-2003, 03:34 PM
No but I can get you a specail code for Flash4 that will allow you to show how much is loaded ;)

Warrior
07-09-2003, 03:49 PM
I got the code for you Set Variable: "amountLoaded" = GetProperty ( "",_framesloaded )
Set Variable: "totFrames" = 1049
Set Variable: "daFrame" = amountLoaded / totFrames
Begin Tell Target ("/loadin")
Go to and Stop (Int (..:daFrame * 100))
End Tell Target
If (GetProperty ( "/loadin",_currentframe ) = 100)
Trace("amountLoaded=" & amountLoaded)
Go to and Play (3)
End If

mm101061
07-09-2003, 06:12 PM
Hi again,
Thanks for your time!
A few questions regarding your code:

Set Variable: "amountLoaded" = GetProperty ( "",_framesloaded )

I assume that inside "" I must put the name and path of the movieclip that I am checking.
...

Begin Tell Target ("/loadin")
Is this the movieclip of the preloader?

...

Go to and Play (3)
This is supposing that my main movie starts at frame 3, isn't it? But remember that my movie has only one frame. Should I move the entire movie to frame 3, allowing 2 empty frames for the preloader? I've seen some tutorials that put the preloader in Scene2 and the main movie in Scene1, canI do it?

If I want to check more than one movieclip to be already loaded, should I put more preloaders in subsequent frames?
Thanks again for your time,
Marcelo

Warrior
07-09-2003, 06:59 PM
I assume that inside "" I must put the name and path of the movieclip that I am checking. I don't think you have to. Everything you said is right except If I want to check more than one movieclip to be already loaded, should I put more preloaders in subsequent frames? You don't have to because the preloader will load the whole movie. Play around with the code and modify it to see how it works best for you. Begin Tell Target ("/loadin") Is this the movieclip of the preloader? Yes

:D ;)

mm101061
07-09-2003, 07:35 PM
Hi again,
What I mean is that my movie is only 1 frame long. In this first and only frame, other movieclips are loaded. These mc are 30 or more frame long. Should I use "1" or "30" for TotalFrames variable? If I put "" but no target nor path, how will the preloader know which mc to check?
If I put the preloader in the first frame, then, the whole movie will be 2 frames long. This will be loaded almost immediately! But I need the preloader to check the "inside" movieclips, do you understand what I try to say? (Excuse me for my english, it is not my first language).
I will try the code as you post it, meanwhile.
Thanks,
Marcelo

Warrior
07-09-2003, 11:54 PM
Do _totalframes and have the preloader on a seperate scene. The preloader should work with the "" because that's how it is setup ;)

mm101061
07-10-2003, 12:28 AM
Hi,
I don't want to abuse of your time!
Thanks for your input.
I've tried your code, but it didn't work. I am sure I made some mistake somewhere.
In summary (correct me if I am wrong):
In frame 1, scene 1 I put my movie "slideshow.swf", which includes thumbnails and the instance of a mc "photos" where the photographs are.
In scene2, I put a preloader. Using _totalframes, I don't bother with individual movieclips lenghts, that's what I understand, right?

My doubts:
1-Can this scene (scene2, where I put the preloader) have more than 1 frame? I mean, does the scene2 behave as an independent movie, with its own timeline? so it can have more frames than the scene1 and still perform first?
2-Scene2 perform first than scene1, even when both start at frame 1? or I need to put scene 1 to start later?

Thanks again,
Marcelo

Warrior
07-10-2003, 04:24 AM
Do you have Flash 5 because it will be very easy for me to show you Flash 5 style. This code for Flash 4 is annoying and I can't seem to implement it into Flash 5.