milosav, can you have a different fps rate for swfs loaded into the main movie? i tried to pm you but i couldnt figure the pm's out.
thanks
aaron
Printable View
milosav, can you have a different fps rate for swfs loaded into the main movie? i tried to pm you but i couldnt figure the pm's out.
thanks
aaron
hi aaron
you cannot, no. the frame rate, background colour and frame size are all set by the main or level0 movie.
thanks a bunch
Hi justplainsoccer,
As julianthomas says no they are set by the base movie.
But.... maybe what you want to do can be done independant
of any frame rate. If you do not use the timeline then
you are not so stuck with the frame rate.
ie:
Flash MX.
//an event every 10 milliseconds aprox 100 fps
animation1_Interval=setInterval(animate1,10);
//an event every 85 milliseconds aprox 12 fps
animation2_Interval=setInterval(animate2,85);
//animation at 100 fps
function animate1(){clip1._x+=1;updateAfterEvent();}
//animation at 12 fps
function animate2(){clip2._y_=1;}
I have effectively created 12 fps animation and
high grade 100 fps animation not only in the same
movie but all in one frame !!!!!!!!!!!!!!!!!!!!
You can do a lot with actionscript...
So your .swf file frame rate says no but don't let it
stop you trying. Using setInterval is a great way to do higher
grade animation within a low frame rate .swf.
Milosav
Hey Milosav,
I'm back.
I have some questions about the random movie example you made for me.
1. In the script, it looks like you created the blank movie clip right there..its not even in the library..is this what you did? If so, why did you take this approach rather then just make an empty movie clip in the library?
2. The random button that plays in mainMovie.swf - where is this? I can't find it in the maindMovie.fla file.
Can you shed some light on this? Thanks and happy new year!
:smoov:
Hi Foochuck,
Nice to have you back.
Yes well it seems I did not upload the correct mainMovie.fla
for the random movies. So there was no button.......
Here is the correct MainMovie.fla with the button ......
As for using createMovie() instead of hardcoding it from the
library. It is a very good method to use as you can create
complex movies dynamicly. ie:
You are creating a space envionment.
It would be a lot of work if you had to place 200 astroids
manualy from the library position them on the stage ...
give each one an instance name ....
example:
for(i=0;i<50;i++){createEmptyMovieClip("astroid"+i ,i);}
for(i=0;i<50;i++){
this["astroid"+i]._x+=10;
this["astroid"+i]._y+=7;
}
However you must be carefull that the empty MC you have
created are instantiated before you use them. So I would
usualy create them on one frame and manipulate them on
frame 2. Of course there are other methods you could use
but this is convienient.
Happy new year
Milosav
Milosav,
The mainmovie.fla you last posted doesn't work. The button isn't a button and the random movie doesn't work...
Hi Foochuck,
Well ... I hope this is not the general trend of the
new year
I must have not saved the .fla file after I had worked on it.
So here is a new .zip file ... it also includes the external
.swf's.
Sorry about that.
Milosav:(
Hey guys!
I've been reading thru all the examples that you have posted (Milosav you are one busy person!) and I think I have a problem that hasn't been covered. I have searched and seached and cannot find one relative link to the problem I am having...so here it is.
I have a menu flash movie on _level0, and from that main menu it will load another Flash movie onto _level5. When the movie on _level5 loads in you can see the preloader wth no problems whatsoever. Now inside this loaded movie on _level5, I have another menu that allows you to load a different movie onto that same _level5.
The problem lies in that when the newly loaded _level5 replaces the old movie that was in _level5 you get a "flash" of the main menu that is still on _level0 below. I want the preloader that is in this newly loaded movie to show up on the current _level5 until the movie has loaded...and not get a "flash" of _level0 when it loads.
I have tried doing swapdepths etc...and I just can't seem to get this to work. Any suggestions would be GREATLY appreciated!
Cheers!
Hi orangewhip,
I am pretty sure that your problem is that when you
load your new .swf into _level5 ... it replaces
(this is how flash works) everthing that was in _level5
before.
I do not know the exact timing of when the new .swf is
instantiated on _level5, but when it is everything that
was in _level5 will be gone (graphics and actionscript).
Some flash developers say that 10% of the new .swf file
needs to be loaded before you can access it's properties
(ie. _x _y _alpha) so going on this as a guide. When 10%
of your new .swf file is loaded into _level5 everything
that was on _level5 will be gone.
When the content of the new .swf file will appear on _level5
will depend on what is loading (and your setup)
. ie. if the First frame of your new .swf had a large 50Kb graphic you would not see anything until this graphic object appeared
on the timeline of _level5.
Without knowing your setup that's all I can offer.
Where is the preloader script that loads your the first .swf
into _level5???
Where is the preloader script that loads your second .swf
into _level5???
Where is your preloader???
It is more than likely that altering your preloader script
etc. will not help ... the fact is that there is a lag between
the time that _level5 is emptied by the loading of the new
content and the time when the new content will appear. This
I think is causing your "flash" of the mainMenu. I tested your
scenerio on the web before posting this. I tested it loading
108Kb .swf's into _level5 (with the preloader script in the
main Movie on _level0 and my preloader bar loaded into
_level6) the content of _level5 was erased in fractions of a second ... revealing _level0. The new content did not cover
_level0 for quite some time as I had a 108K image in the
first frame of the new .swf.
Have you considered loading into a different _level or into
a Movie Clip instance.
Once loaded all your content will not need to be reloaded
again. and you can just switch between content using very
simple actionscript.
Anyway let me know if you would like to try this approach.
Milosav
Hey Milosav,
I have preloaders on each of the movies that are being loaded in, and they trigger a "loading" animation that is loaded from a swf onto level20.
I know I can load movies into higher levels but with the end user being able to continually select menu items I don't want the menu's being added on top of each other forever.
I think the solution is to duplicate or load a 2nd version of the current open level onto a level below it. So that when the current level is changed....there is another "version" of it under it immediately...
I have tried and tried to get it to duplicate or load a second version of the same movie under the current one, and it doesn't seem to work too well for some reason.
I have attached a little demo that I was trying to get to work. Basically you have a main movie with a function on frame 1. A menu gets loaded into a level on top of everything else (so that the loaded swfs don't cover the menu up) Each button in the menu calls the function to load a different movie into level0 - depth 2. Once this happens the function immediately makes a duplicate (or loads a 2nd swf) that goes directly below the first one, this time loaded onto level0 - depth 1.
My thinking behind this is that once you click on a button to load a new movie onto level0 - depth 2, and old version of that file is still sitting on level1 and therefore you won't see the flash of level0 behind it. But for some reason I don't think it is working.(if you click real fast you can see level0 flash behind the loaded movies)
Any help would be greatly appreciated. Thanks!
Sorry, I only attached the SWFs, I will have to send the FLAs in 2 seperate batches.
Here is file 2
Hi orangewhip,
I have downloaded your files and will give your problem
some thought then post back.
At a quick glance I still ask the question. Why not load
your content into empty Movie Clips or seperate Levels.
You said:
"I know I can load movies into higher levels but with the end user being able to continually select menu items I don't want the menu's being added on top of each other forever."
Forever .... does this mean that you have an "unlimited"
content that the user can load in ???
If you do have an unlimited amount of content, I can see why
you don't want to store the content.
However if your content is not unlimited....
I would consider that you load your content into empty
Movie clips or Levels. Once there it will not have to be
downloaded again.
For example lets say you have your content loaded into
the Movie Clip instances named (this has taken place when
the user has presses a button):
holder_1
holder_2
holder_3
You can then just switch between these Movie Clips (or Levels)
which contain your content with something like (really rough).
currentContent=0;
function switchContent(theRequestedContent){
//is the content the user wants to see different
//than what they are already viewing
if(currentContent!=theRequestedContent){
//make the requested content visible and enabled
this["holder_"+theRequestedContent]._visible=true;
//make the old content invisible and disabled
this["holder_"+currentContent]._visible=false;
currentContent=theRequestedContent;
}
}
This basicly uses a method similar to the Frame buffering
of realtime 3D graphics or originaly in hand drawn
cartoon animation. Your old content is not made invisible
until the new content has appeared so there is no background
flicker.
If you do have an unlimited amount of content then the same
method could be applied by using two Levels or Movie Clips,
your content is loaded into the inactive (_visibile=false;)
Level or Movie Clip. And you switch between these two Levels
or Movie Clips. In a way you are trying to do this with your
duplicated movie clip idea.
The above script would contain the ability to also check if
the content needs to be downloaded before it is displayed and
call the appropriate function. If the requested content does
need to be downloaded then the current content being viewed
does not change until the requested (new) content is loaded.
Give this some thought and post back ...
I will then spend sometime on your problem based on
you thoughts.
Milosav
Hmmm, yeah that is basically what I am looking for. The current page not to dissapear until the new page has been loaded (I want the pre-loader to show up on the current page tho)
There isn't an "infinite" amount of data to be loaded, but in order to show the preloader on top of the current page in my original concept...all newly loaded levels (or movieclips) had to be higher in depth than the current one, therefore making it so that all possible pages to be loaded would go on top of each other as long as the user continues to load pages.
How would you make that script you have there work with either 2 movieclips on seperate depths, or 2 seperate levels and have a user request a page, that pages preloader will show up on the current page until the new page is loaded, in which you will switch to the new page....all with no "flicker".
Like you said I have tried something similar to that with the dupicate movieclip...but am having a hard time fathoming why it isn't working, and your idea would???
Thanks for you help...this is GREATLY appreciated!
OK I have got a working sample now!!! The only thing is I guess I have to send the "depth" to the function for each button. I was hoping the function could automatically switch the depths around. I will think about this, but if you have any ideas that would be great!
Sorry, the reason why I would like it to take care of the depths itself is because I have a possible 30 movies that could be loaded in this way and I don't want to have 29 hidden and 1 visible. I would like there to be only 2 loaded at all times.
Hi Orangewhip,
I will put something basic together that I think will suit
your situation. I would be suprised if it was the perfect
answer to your problem first time around.
So if you think that it is headed in the right direction
I can then help you adapt it to you specific needs.
Expect something in a day or two ... I have relatives staying
and may not be able to do anything today.
But what you are looking for should not be a big problem.
Miloasv
Hi Orangewhip,
Here is a rough idea.
If you think it may be on the right track let
me know and I can clean it up .. and debug it.
It is a MainMovie on _level0 with three buttons
to load external .swf's.
A progress bar (Bar.swf) loaded into level6.
Content loaded onto Level4 and Level5.
Frame 1 of the loaded .swf's is blank with a
stop() action the content begins on Frame 2.Other
than button events there is no script in these
Movies. Each button event calls the function on
_level0 which does all the loading and level visibility
switching. The home button makes _level0 the currently
active content.
This script would need some more work but I quickly tested
it on the web and I am pretty sure that a robust version
could be put together and degugged in a few hours.
So have a look and let me know if this is heading towards
what you need.
You will not see the progress bar unless in a download environment.
And the external .swf file size was bulked up. But it is there and
based on my brief testing on the web it does work.
Milosav
Hi Orangewhip,
The "MainMovie" file in the zip I last posted is missing
a button event ... sorry ... here it is with all 3 buttons
working. Everything else is the same.
Milosav
Milosav,
I've started a new post over at:
http://www.flashkit.com/board/showth...5&goto=newpost
I was wondering if you could check it out. I'm wondering how I could go about doing a picture gallery...loading PNG files from my library into an empty movie clip. Could you give me some insight on this? I'd really appreciate it..I just thought I'd ask you cause you really know your stuff and have never steered me in the wrong direction!
Let me know...
-Foochuck akd Chaunce Rodriguez
:smoov:
HI foochuck,
Good to see that you are still around.
Placed something on the other thread.
I await your reply.
Milosav
Milosav,
For the previous Flash you had helped me out with...you had show me this button action to put in the frame of my movie:
but1.onRelease = function() {
loadAudioFile("male1.swf");
};
How could I translate this to a frame action..instead of having the button call the function, I'd like the frame to play it...I'd like to have this action start at the beginning of my flash movie. Please advise...
Thanks!
-Foochuck
Milosav,
Hi! great thread, at the risk of going off topic, don't suppose you could explain why or when one would use layers..in an understandable form, been trying to figure out that one for a bit...what the benefits would be, if any.
Thanks!
HI fergsta,
I am wondering if you mean Levels and not Layers.
So just in case here is something on both.
Layers.
A Flash Movie is often made up of a number of Layers.
Layers are like sheets of transparent paper stacked on top of
each other. Each can hold graphics, text, Movie Clips,
Sound etc.It makes organizing and handling all your graphics
etc easier than placing them all on one layer. The .zip file
includes some files ... one of them is called "Layers" and if
you have a look you will see some graphics and text fields
on each layer. I hope this gives you some idea of how you
could use them. You will note that graphics in layers above
other layers will cover the contents of Layers below. You can
move a layers to a different position in the stacking order
wich will produce different visibility of our elements.
Levels.
Levels have many of the same qualities as Layers (stacking
order and transparent) plus a lot more. Many Flash developers
will break a large Flash movie
into a number of smaller Movies. This is perhaps the most used
method of reducing the size of the Flash file.
So if you had a big Flash movie say 200Kb you may break it
up into 10 parts (.swf files) each being 20Kb. Then you can
load them into Levels as you want (or when the user wants)this
solves the problem of long download times. Also this method
of building in "modules" makes updating or improving sections
of your project much easier as you do not have to mess with
one huge file but just fix or improve the module you need to
then it will just be loaded in as before. This also very
helpfull when working in a team ... where you may have different developers working on different modules which all plug together
to form the whole project.
Lets say your main page opens with a navigation of five buttons.
When pressed each button will display different content. Rather
than load all this content in at the start ... it can be loaded
into Levels later ... when the user wants to see it ... or when
your Movie needs it. You can also control some properties of
Levels which make this a very powerfull thing.
ie: the following actionscript can manipulate Levels.
_level1._visible=false; //makes _level1 invisible.
_level1._alpha=50; //makes _level1 50% transparent
There are lots more than just these two.
In the .zip file you will find the file called Levels and
the file called Movie1.swf. If you play the Movie called
Levels it loads Movie1.swf into _level1 ... with the
actionscript loadMovieNum("Movie1.swf",1);
Anyway hope this helps a bit ...
You may have many more questions after having a look at these
files so post back with them.
The files are Flash MX I hope this is not a problem.
It is the same in Flash 5.
Milosav
yeah, sorry..I am slow, but not that slow!... i am going to absorb what you wrote, Thanks for your response.
amazing what a little ../ will do
now i gotta figure out how to get my fading buttons to work again, they stopped as soon as i made the nav bars movie clips...
Well I must milosav you do seem to b one of the most clued up peps on this forum not to mention helpfull. I have a problem that I have been trying to get to the bottom of for months. I would b eternally greatfull if you could offer some advise or may b give me an example on my swf files. I have done the classic example of pulling apart a 200k swf and breaking it into lots of little ones.
Problem is is I have 6 sections with sub sections.
For each of the sections there is an animation.
If one of the sub sections is hit I want the animation to stay where it is for the rest of the sub sections in that section
I should disapear when another section is activated. And in turn the animation will start for that section.
It's easy to understand by checking it in action at my site www.forsite.co.nz ,this is how I want the site to work, but not as one big swf with a long preload.
Thanks heaps
dAvE
Hi fergsta,
Are you using a timeline motion tween to do your fading
or actionscript?
This could be a good place to try some actionscript.
The following is something to play with. Flash MX.
Lets say you have a Movie Clip with the instance name
navBar (which is on your main timeline). And you want it to
fade. Here is a function which would fade it from a 0 _alpha
to 100% _alpha.
//this starts an interval (timer) which calls the function
//fadeNav every 100 milliseconds
faderInterval=setInterval(fadeNav,100);
//this is the function which does the fading every 100
//milliseconds
function fadeNav(){
//check if navBar is at 100% _alpha yet
if(navBar._alpha>=100){
//if it is 100% _alpha then we stop our faderInterval
clearInterval(faderInterval);
}
//otherwise we increase the _alpha
navBar._alpha+=1;
}
You can see that all this can take place in one Frame ...
no extra key frames ... no timeline tweening. This all means
a smaller file.
Check out this site (it has an expandable database
of images)and even has thumbs that when pressed load in larger
images (it also has fading buttons)
http://www.trump.net.au/~Milosav/tgfx
... the original .swf file
was around 40 Kb with only 5 images in the image gallery.
It would have been huge with the current number of images. But with a little actioscript the Main .swf file is now around 7Kb!!! And
content is delivered to the visitor fast even at narrow
bandwidth.
Milosav
Hi interstella,
What version of Flash are you using and for which
platform??????????????????
Looked at your site and for me on a 14400bps s-l-o-w
connection speed it was a long wait.
Looking at it I guess your six sections are
about
contacts
services
mission
work
random
This would be a good start. To modulizing your site. But
if you have broken it apart and are now rebuilding it I
would be carefull to spend sometime thinking about future
expansion or additional content that you may include in
your subsections. Just so that when you do put it back together
there is a place to plug these into without pulling apart the
file again sometime.
Flash can both stream as well as allow you to preload (or
control the streaming) it is a good thing not to get stuck on
either. Often a combination of both will be the answer.
But the first step is to decide what bandwidth you are
designing for? Because there is no use streamling your
site for a narrow bandwidth if you know that your clients all
surf on wide bandwidths.
Of course you are a company which is IT related so I think
it would be bad PR to have a site that did not load at an
acceptable speed on medium bandwidths ... and like greased
lightning on wider bandwidths ... this alone could be your
best advertisement.
How large (bytes)
would your navigation menu be if placed in a Movie Clip of it's own ???
I can see a possibility here of loading the navigation bar
(as an external .swf) into the MainMovie. This would give the
user some fast content and also a picture of what is to come.
Each button would load in a .swf file that contained and
also controled that sections subsections.
You would need (I advise) a multi.swf preloader which would keep track
of what was loaded and what was not. And a function which
controled what content was active on the stage.
These are not overly complex.
If you want to get into the specifics just chose a starting
point.
Milosav
hmmm, so all that fading is done without tweening frames? that is pretty useful to know. would have helped me doin my site.
but what i am doing now is flying over the buttons in the nav bar and as they flyout the buttos fade back to normal. owrks fine on the one nav bar that is not a clip, but the ones I had to make a movie clip to interact with each other the fade stoped workin(although now I think I may have been able to use levels somehow instead). I think the problem is related to the path again as they are now movie clips, just haven't been able to figure out where the problem lies yet...not a big script, but lots a little bits.
I'll get it, I hope...if not you can be sure I will back herer moanin and groanin!:)
Thanks!
hey milosav, thanks 4 your linez.
my navigation is 20k
the animations range from about 20k to 60k
the individual pages (or sub sections) range from about 3k to 20k
I am a designer and am kinda new action script, have had a few different suggestions on how to do this. can get it all workin fine apart from animations playing again when a subsection of the same section is activated....It should only play once for a section.
Most client will be on at least 128k connections, but I would like it to load quickly on a 56 k connection.
I am a very visual person and can understand action script if I see it in action....so is there any way I could send you my ziped up source files to an address and get you to give me an example of how you would do it, on one of the sections?
Im sure I would have no probz applying it to the rest of the site from there.
Much appreciation.
Dave.
Hi interstella,
Ok ... you can mail me your .zip files to:
[email protected]
I will check them out.
If they are over 1 MB could you please send them in a
few lots.
Milosav
milosav,
I hope you get this, as once again I think I have hit the limits of my knowledge.
I am trying to load a horizontal submenu as you roll over a button in the horizontal main menu. I have created the submenus as seperate movie clip files.
Now I can call one easily, loading it into the empty clip, positioned in the right spot. But when i get to the second button, I can't think how to load the second submenu, as an error keeps coming up telling me have have to have it in an onClipEvent or something.
also, i don't want the roll overs not to work if the movie clips have not loaded. I tried the example you gave us on loading movie clips and levels, but I think i just confused myself further.
If you can understand what i am going on about please help!
Thanks!
milosav,
I hope you get this, as once again I think I have hit the limits of my knowledge.
I am trying to load a horizontal submenu as you roll over a button in the horizontal main menu. I have created the submenus as seperate movie clip files.
Now I can call one easily, loading it into the empty clip, positioned in the right spot. But when i get to the second button, I can't think how to load the second submenu, as an error keeps coming up telling me have have to have it in an onClipEvent or something.
also, i don't want the roll overs not to work if the movie clips have not loaded. I tried the example you gave us on loading movie clips and levels, but I think i just confused myself further, and i still want to have the button flyover states and sounds, and it needs to work with the Flash 5 plugin.
If you can understand what i am going on about please help!
Thanks!
Here is where i got, looks like it does what i want, but this is the version i get the error about the onClipEvent as i am not preloading any of the clips.
http://www.thefoundationsite.com/flash/slidingmenu.zip
Here are the files now...I deleted all the a/s...I was trying to use your example.
http://www.thefoundationsite.com/fla...ingmenufla.zip
hey milosav.
Just wondering if ya got those forsite flas I sent. If so, hope they wernt too confusing. If there was any probz, let me know.
dave
Hi, fergsta
I think that you can do your menu this way. See the attached fla's of your menu.
Hey, that seems to work great! very simple and elegant solution...I would have never gotten there! I think I see what you have done, I like to understand why things work.
I greatly appreciate your help!
ferg.
Hi,
First off, this is the best thread I've found yet at hats off to Milosav for sharing your knowledge and time. I've learned a lot and have had many of my questions answered.
Milosav, I have downloaded many of your files and since I am looking for simplicity I'll address
Part 3.
What helped me most is your use of functions to organize your code. I am starting to do just that in my project. I understand Part3 and it works find for my sub level navigation (nav), where nav is a MC of buttons on the same in the same lessontemplate.swf that loads in external .swfs. (L1video1.swf, L1text1.swf, L1anim.swf, .....)
What I'd like to do is understand how I can use Part3 for my main navigation which is in an external .swf and is loaded on the same _level as lessontemplate.swf but in a different depth.
So the structure looks like this:
main.swf
-loads mainnav.swf into an empty MC
mainnav.swf - contains buttons
- user selects a button
- calls function with "section name"
-checks to see if section already have been selected
-checks to see if the template has been loaded
if not loads tempate.swf
sets navmc.IsLoaded to sectionname
-otherwise
assigns template.IsLoading to section name
template.swf - loads component .swf based on the assignments of "template.IsLoading"
My question is about preloading the template first. Would I have to put the preloader for the template.swf in the MC that holds my buttons in mainnav.swf?
I'm thinking of preloading my template.swf at the same time that maninav.swf gets loaded and setting _visible to false till I want to show it.
Here is some code I have:
Code in the first frame of mainnav.swf
stop ();
//this variable is checked before a section is loaded to ensure the movied loads only once
IsLoaded = "false";
//sectname refers to the section selected (_name of the button)
function testLoad (sectname)
{
//remember to check to see if the template is loaded
switch (sectname) {
case "overview":
if ( IsLoaded == sectname ) //check to see if the section is already loaded
{ trace (" section is already loaded");
break;
}
if ( _level0.template.IsLoaded == "false") //template not loaded yet
{
IsLoaded = sectname ;
loadMovie ("sectionframeideacurr.swf", "_level0.template" );
\\do I have to call a preloader here and where would it live
gotoAndPlay ( intromc.overview ); //this plays an animation
break;
}
else { // set variable in templatemc "IsLoading" to section name
_level0.template.IsLoading = sectname;
break;
}
//repeat for case "lessons" , "resources", and "help"
}
Code for example button
on (release)
{
_parent.testLoad ("overview");
}
Hope this helps,
thanks in advance
Lisa