-
Senior Member
Is there any way to add that preloader to a button action thats loading the swf file inot the movie clip?
Foochuck
http://www.myspace.com/foochuck
-
Hi again,
nklein I am looking into this for you.
I thought that most Mac's came with Stuffit Expander
which is supposed to decompress win zip files.
Here is the URL to another decompressor I found
(have not tried it) It is supposed to decompress
Win zip on a mac.
http://www.maczipit.com/download.html
Hope this helps ... let me know????
foochuck the Example file for part Three should be added to
this thread later today. If you want to see it in action
though I will be uploading "some" running examples to
my Web space.
The example of the preloader (loaded from a button) with
preloader bar is viewable at:
http://www.trump.net.au/~Milosav/example3
The Example files part_Three will be loaded up here later
today.
As far as buttons still being active even though they are
covered by loaded movies.
Both the Button Object and the Movie Clip Object have the
property "enabled". So if you have a button with the instance
name myButton then the following script with make it inactive
to events.
myButton.enabled=false; //will not recieve events.
myButton.enabled=true; //will recieve events.
or you can have a Movie Clip insatnce called mc_holder it's the
same script(all the buttons in that Movie Clip instance will be disabled)
mc_holder.enabled=false;
What script are you using to load in your audio???
If you want to unload a Movie Clip with a button then.
yourLoadButton=function(){loadMovie("Movie1.swf"," mc_holder1");}
yourUnloadButton=function(){unloadMovie("mc_holder 1");}
I would keep in mind however that if you try to unload a
.swf file that is still loading it can "sometimes" crash the
Flash player. I prefer to not take the chance so I have a
single Frame Blank.swf (less than 1kb) and load this .swf
instead. ie:
loadMovie("Blank.swf","mc_holder1");
As you can see there is no need to unload a Movie Clip to
place different content in it .... loadMovie() just replaces
what was in the Movie Clip with the new .swf file or .jpg.
Will lodge part Three later today. Pre-loaders and Pre-loader
bars.
Milosav
-
Hi again,
Well part Three is done. It is too large to lodge here so
you can download it with the following URL:
http://www.trump.net.au/~Milosav/exa...part_three.zip
Have a good look over the files. Any questions post back.
If you want more ... ie. part_Four post back and I will
put it together.
Milosav
-
I would love to see a part four!
-
milosav
milosav, your code makes a lot of sense, but I'm trying to integrate it on a preloader script that I've been working on for days, and it just isn't working. I'm dynamically creating containers and I can't figure out how to get it all to work together. would you mind glancing over it?
-
Senior Member
Milosav is the man
Milosav you are the man!!! Your code has helped me so much. It's also given me a lot of great ideas of things I can do in flash that I never thought of before...I would definitly like to see a part IV. Hmm...perhaps loadmovie Episode IV - A New Hope.
Thanks again!
Foochuck
http://www.myspace.com/foochuck
-
Hi tgfx,
If you attach a .fla file of what you are doing I will
check it out. If the whole file is too large for this forum.
Try and post the important section.
nklein .... have you found a solution to the mac / windows
file problem ????
If you have let me know so I can stop looking.
Does anyone have an answer to nklein's problem????
foochuck Yes you can do a LOT with actionscript.
justplainsoccer Part 4 on the way soon.
If anyone has a problem or ? about the files or script
just post here.
Milosav
Milosav
-
milosav, here's the file . couldn't remember how to set subdirectories through winzip, so you will have to make an images directory and put art 1-5 in there to test.
everything works ok until it's uploaded, then it will hang on loading 1, so that's why I think your code will work better.
-
Senior Member
Button Preloader...
Milosav,
I just checked out Part 3...good stuff.
Question - Now I think you will answer this when you release part 4, but I'm wondering...
I have about 7 buttons in my movie. Each one loads a different .swf into the same empty movie clip...they are actually sound files in each .swf...so I don't need more then 1 on at a time...so each one just replaces the other when clicked..alright my question is...I sort of adapted the button preloader before I saw part 3 and it was working. But instead of re-writing the preloader script along with each button action to load the swf into the empty movie clip...how can I make this more streamlined...but I believe you'll answer this with your next release..preloader in each external swf.
By the way...where did you learn Actionscript? Classes...? Is there a book you read or that you recommend...please advise
Foochuck
http://www.myspace.com/foochuck
-
Hi foochuck,
In your case I would place the preloader code in a
centralized function. Then just call this function which
loads what ever "Movie.swf" you want.
Example:
Your MainMovie that loads the .swf files. Frame 1:
stop();
//flag is a file loading.
fileLoading=false;
function loadAudioFile(theURL){
loadMovie(theURL,"mc_holder1");
if(!fileLoading){
{fileLoading=true;
loaderInterval=setInterval(loadChecker,100);
}
}
function loadChecker(){
if(mc_holder1.getBytesLoaded()>=mc_holder1.getByte sTotal)&&
mc_holder1.getBytesLoaded()>0)
{ fileLoading=false;
clearInterval(loaderInterval);
}
}
button1.onRelease=function(){loadAudioFile("movie1 .swf");}
button2.onRelease=function(){loadAudioFile("movie2 .swf");}
button3.onRelease=function(){loadAudioFile("movie3 .swf");}
//////////////////////
I think this could work for you ...
Here we are reusing script so that we do not have multiple
pre-loader code everywhere. This seems to be a possible
solution given that you are loading into the same Movie Clip
instance.
You could even call this function from another Movie Clip
or Level with:
_level0.loadAudioFile("Movie2.swf");
Of course I would TEST this first there may be need to tweak
the script.
Milosav
p.s I think that pre-loader script in the Movie being loaded
works better when you just need something loaded without
taking too many data managing responsibilities. Keeping the
script centralized help in keeping things simple.
-
Hi tgfx,
Sorry it has taken me so long to get back to you.
I looked over your files and checked out the graphics.
I need you to paint me the picture of your design.
Like:
What happens when you press the menu buttons??
Where do the images go??
So I can see what you want.
Post back so we can get started.
Milosav
-
Hi foochuck,
To tell you the truth my understanding of actionscript is
only new. So my understanding is still limited.
But I have spent a lot of years programming real-time
3D graphics in C/C++.
The similarity of computer languages means that knowledge of
one language means you can easily shift to another language.
You as a flash developer, when you change the properties
of a Movie Clip instance ... you are programming in an
Object oriented language. If you spent some time with
actionscript then picked up a book on C/C++ application
development you would be suprised how similar it all is.
I ask a lot of questions and enjoy increasing my knowledge
of a subject ... read lots of tutorials.
Milosav
-
hey milosav,
I removed a lot of content so that the download wouldn't be bad for you.
ok, when a menu button is clicked, another set of icons pops in, in the same area as the last icons. whenever that happens, all of the container mcs are reloaded and the buttons become active for the new thumbnails. it's inefficient but it works, and at least they stay in cache. the first time they load, they should show the loading bar for each image (or one bar for all images), and mostly, not hang on loading number 1.
I think that about covers it.
-
Senior Member
Milosav,
With the latest preloader you have posted for me...Do I still need a 'stop' action in the first frame of all movies that will be loaded into the main movie mc ?
Foochuck
http://www.myspace.com/foochuck
-
Senior Member
Milosav,
This is what my code looks like...
stop();
//flag is a file loading.
fileLoading=false;
function loadAudioFile(theURL){
loadMovie(theURL,"mcholder1");}
if(!fileLoading){
{fileLoading=true;
loaderInterval=setInterval(loadChecker,100);
}
}
function loadChecker(){
if(mcholder1.getBytesLoaded()>=mcholder1.getBytesT otal()&&
mcholder1.getBytesLoaded()>0)
{ fileLoading=false;
clearInterval(loaderInterval);
}
}
but_but1.onRelease=function(){loadAudioFile("male1 .swf");}
but_but2.onRelease=function(){loadAudioFile("male2 .swf");}
but_but3.onRelease=function(){loadAudioFile("male3 .swf");}
but_but4.onRelease=function(){loadAudioFile("male4 .swf");}
but_but5.onRelease=function(){loadAudioFile("male5 .swf");}
but_but6.onRelease=function(){loadAudioFile("male6 .swf");}
but_but7.onRelease=function(){loadAudioFile("male7 .swf");}
Please advise if all looks well..I modified the names of the swf files, the movie clip instance name...also got a couple errors when I used your original script posted I had to add a ')' and also '}' around line 6...
Foochuck
http://www.myspace.com/foochuck
-
Senior Member
One more request Milosav..sorry...could you explain the preloader to me..I'd like to know how it works...also what symbols like && mean...let me know if you can...thanks.
Foochuck
http://www.myspace.com/foochuck
-
foochuck,
you can find out everything you ever wanted to know about symbols (&& += == and so on...) on the macromedia website.
here's a preloader...
http://www.macromedia.com/support/fl...or_frame01.htm
and here are symbols...
This is the place to find out everything about actionscript...
Hope that helps.
Aaron
-
Senior Member
Milosav,
Also for this preloader I'd like to show a still graphic or something just to show that the file is loading...my sub-movies are around 200 KB and up and for people on dial up, after they click the button they might not know they file is loading....
Foochuck
http://www.myspace.com/foochuck
-
Hey, i have one queston. how would you use a preloader with multiple swf's? Thanks.
Aaron
-
Hi again,
First Aaron:
How you would handle a preloader for mutiple .swf's
depends a lot on how much control you want over the loading,
and if you want some kind of progress bar/report while they
are loading.
The most basic preloader would be to make the first Frame of
the Movies you are LOADING blank with just the stop(); action ..
the rest of the Movie would start after Frame 1.
Then in your main Movie:
loadMovie("Movie1.swf","mc_holder1");
loadMovie("Movie2.swf","mc_holder2");
loadMovie("Movie3.swf","mc_holder3");
Then when you want one to play just use:
mc_holder1.play();
This way however does NO load checking. But it is a basic
multi .swf preloader.
I will put together a simple multi .swf pre-loader and you
can have a look at it.
If you are into reading tutorials you should check out
Colin Moock's stuff ... he really knows a lot and can
present it in an easy to understand way.
http://moock.org/webdesign/flash
foochuck:
Glad you checked the script. I have not even tested this
so as I said it may need to be tweaked.
You can easily add a progress bar to the script or some
other graphics for your user. At 200kb I think it would be
a wise choice.
Flash is built to stream Movie content. So if you don't place
a stop(); the Movie will start playing. Sometimes this is OK.
But preloaders seem to be used a lot to ensure a good
user experience given the limitations of bandwidth. ie.
your Movie plays without the stutters and stops that will
happen if the Movie can not stream fast enough.
You could use the preloader from the example part 3 and
add it into your current script.
So it would look something like this.
stop();
loadMovieNum("Bar.swf",4);
//flag is a file loading.
fileLoading=false;
function loadAudioFile(theURL){
loadMovie(theURL,"mcholder1");}
if(!fileLoading){
{ //show your loader bar
_level4.theBar._visible=true;
//position your loader bar
_level4.theBar._x=250;
_level4.theBar._y=200;
//set your bar to start position
_level4.theBar._xscale=0;
fileLoading=true;
loaderInterval=setInterval(loadChecker,100);
}
}
function loadChecker(){
if(mcholder1.getBytesLoaded()>=mcholder1.getBytesT otal()&&
mcholder1.getBytesLoaded()>0)
{ fileLoading=false;
//hide your loader bar
_level4._visible=false;
clearInterval(loaderInterval);
}
//scale your loader bar
_level4.theBar._xscale=(mc_holder1.getBytesLoaded)/mc_holder1.getBytesTotal())*100;
}
but_but1.onRelease=function(){loadAudioFile("male1 .swf");}
but_but2.onRelease=function(){loadAudioFile("male2 .swf");}
but_but3.onRelease=function(){loadAudioFile("male3 .swf");}
but_but4.onRelease=function(){loadAudioFile("male4 .swf");}
but_but5.onRelease=function(){loadAudioFile("male5 .swf");}
but_but6.onRelease=function(){loadAudioFile("male6 .swf");}
but_but7.onRelease=function(){loadAudioFile("male7 .swf");}
I will make a working example of this and upload it with example
files to my web space. I can also make sure that it is working.
So I will post you about that soon.
There is a lot of information about actionscript operators
right in the Dictionary that Flash MX has.
Symbols like && == > < are called operators and are used in
all sorts of ways.
Lets look at this script.
bytesLoaded=100;
bytesTotal=300;
if(bytesLoaded>=bytesTotal && bytesLoaded>0)
{ gotoAndPlay(2);}
if( ) is a conditional statement.
If the "condition" within the ( ) is true then the statement
within the { body } of the if statement will execute in this
case gotoAndPlay(2);.
> is the "greater than" operator
>= is the "greater than or equal to" operator
&& is the "and" operator
If we break down the script into something easier to understand
then it starts to make more sense.
If bytesLoaded is greater than or equal to bytesTotal, and
bytesLoaded is greater than 0 ... gotoAndPlay(2)
In our example above:
bytesLoaded is NOT equal to or greater than bytesLoaded ... so gotoAndPlay(2); will not happen.
It is not too difficult if you know what these symbols mean.
It is a very good idea when you write your own scripts to
use names that make sense to you.
For example:
pqz=100;
h79=20;
if(pqz>h79)
{Movie578w.gotoAndPlay(4);}
Or
the_chance_of_a_sunny_day=100;
the_chance_of_rain=20;
if(the_chance_of_a_sunny_day > the_chance_of_rain)
{ day_at_the_beach_Movie.gotoAndPlay(4);}
Much easier to understand ... a bit of "overkill" but clear.
It is a very good idea to know how things work, especialy your
own projects.
Milosav
Milosav
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|