A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 27

Thread: how to load......?

  1. #1
    MetallicA all the way, baby! Bokkie's Avatar
    Join Date
    Apr 2002
    Location
    Eindhoven, Holland
    Posts
    287

    how to load......?

    Hey there,

    ive got quite a problem and this is a resource to find answers for it, but i cant find anything so heres the thing:

    Theres a client who wants to load a 1Mb file (compressed from 7 Mb), almost seamlessy, and almost without waiting for it, cause it will be send trough mail.

    I was thinking about cutting this file into 2, so all i have to do is load the first thing (50%) and while this movie is playing load the second (other 50%) on the background...

    But how to achieve this? Will the 1st part will blend fine with the 2nd part? Is there any tute to follow, cause i really need to know this...? And a better question: is there a better way, and plz share your thoughts?

    PLZ?

    Thnx in advance,

    BOK
    FakePilot = Master

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Sending swf files by mail is not a good idea as you have no control over who can see the content. Email apps are not always able to show the same things as your browser, even if the browser has the Flash plugin.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    MetallicA all the way, baby! Bokkie's Avatar
    Join Date
    Apr 2002
    Location
    Eindhoven, Holland
    Posts
    287
    thnx for the reply,

    thats not what i ment. The client always send mails to their client to keep them updated. Its just an URL...

    Sry for the misunderstanding...

    Thnx,
    BOK
    FakePilot = Master

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    So its just a website?

    Heres how to load external swf files...

    There are two ways of loading external files into Flash. Either you can load swf files into _levels or into movieclip targets.

    _levels only exist in the Flash player. They are like layers but for swf files The Flash player is like a overhead projector where the plastic films you put on top of each other are like the swf files in the player. There are 16000 available levels

    //To load a external swf into a _level from a button. The number 1 being the level to load into.

    on(release){
    loadMovieNum("myExternalFile.swf",1);
    }

    Movieclip targets are what it sounds like. A empty movieclip placed on the stage just for the purpose of loading a swf file into it. The advantage is that you can place it anywhere, manually ( as opposed to swf's in _levels) and also can control what of the objects should be on top or beneath.

    Usually you give the movieclip an instance name of container. ( you give a instance name by selecting the empty movieclip on stage and write the name in the Property Panel )

    //To load a external swf into a target movieclip from a button ( both being on the main timeline ).

    on(release){
    container.loadMovie("myExternalFile.swf");
    }

    The external movie's top left corner will place it self where the empty movieclip is.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    MetallicA all the way, baby! Bokkie's Avatar
    Join Date
    Apr 2002
    Location
    Eindhoven, Holland
    Posts
    287
    Thnx for posting, Pelle...!

    But it leaves me to one question though,allthough i will find a way to figure this loading out (first part), but what is the code to load the second part (2nd SWF)?

    And which of the two ways do you prefer for this matter?

    Thank you so much for giving input for my problem..!

    Cheers,
    BOK
    FakePilot = Master

  6. #6
    Member
    Join Date
    Mar 2005
    Location
    Minnesota, USA
    Posts
    58
    just a thought here....
    Is it just a website with multiple pages or does it have an intro or something similar into it? if its just a website with multiple pages you can seperate each page into its own .swf and externally load them into your movie. to do this you would just set up a loadscreen for each movie or create a transition loader movie like shown at

    http://www.kirupa.com/developer/mx/p...transition.htm

    if it has an intro, you can make your main site load while the intro is playing, seemingly cutting down the load time to the end user.
    It's just a job. Grass grows, birds fly, waves pound the sand. I just beat people up.
    Muhammad Ali

  7. #7
    MetallicA all the way, baby! Bokkie's Avatar
    Join Date
    Apr 2002
    Location
    Eindhoven, Holland
    Posts
    287
    thnx rhino,

    but it is not even a site....its just a simple html-page with a big swf in it.

    the client wants it to be downloaded faster, almost seamless when you enter it.

    Lets say theyve got a movie (delivered in Quicktime (7MB), i crompress it in an SWF (first After FX, and then Flash) then it will be like 1 MB. They dont think its good enough, and want it to be loaded faster.

    And as Pelle said...theres a way to load a little piece of an SWF, and while that one is playing, it will seamlessly load the rest of the, lets say, 750 Kb.

    Thank you for sharing your thoughts, but it isnt an site...just a very simple html-page, with a huge SWF in it...Cheers, m8...Thnx!

    BOK
    FakePilot = Master

  8. #8
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    If its small enough you can have it stream as the normal broadband connection is about 50 kb per second ( or do you have a modem audience? ).

    Dividing it intwo parts will make no difference. If you want to to have a larger portion buffered you can always make a intro with Flash graphics .

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  9. #9
    MetallicA all the way, baby! Bokkie's Avatar
    Join Date
    Apr 2002
    Location
    Eindhoven, Holland
    Posts
    287
    Originally posted by pellepiano
    If its small enough you can have it stream as the normal broadband connection is about 50 kb per second ( or do you have a modem audience? ).

    Dividing it intwo parts will make no difference. If you want to to have a larger portion buffered you can always make a intro with Flash graphics .
    * It should run for both audiences, altough it doesnt bother me much for the modem-users. No offence..

    * Thats just something they dont wanna have..just a big movie, which should start almost immediately.
    Is it not possible to buffer the rest of the movie, while playing the first little part of the movie?

    Sry for being such an arse, but i really need help with this.

    Thnx in advance, Pellepiano...really appreciate your thoughts

    BOK
    FakePilot = Master

  10. #10
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    If it does not load fast enough to stream, it makes no difference how many movies you divide it into, there will be no time to load a second movie in the background. The first movie obviously has to be completely loaded before there will be room for another movie start loading ( otherwise they will share and divide the kbps available ).

    And if its loading fast enough to stream you could have one movie that is 200mb. It would make no difference to te´he viewer.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  11. #11
    MetallicA all the way, baby! Bokkie's Avatar
    Join Date
    Apr 2002
    Location
    Eindhoven, Holland
    Posts
    287
    Thnx for helping me out with this, Pelle.

    Thanks for your patience...

    Cheers,
    BOK
    FakePilot = Master

  12. #12
    MetallicA all the way, baby! Bokkie's Avatar
    Join Date
    Apr 2002
    Location
    Eindhoven, Holland
    Posts
    287
    Hey Pelle,

    since youre the mod here, i was wandering if you can place this post in the Flash Video-section, cause i dont want to double-post.

    Im still on a dead end here...(And yes, im stupid)

    Cheers,
    BOK
    FakePilot = Master

  13. #13
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I m not a mod here, so I can not move posts, but I dont think anyone will mind if you make a new post in the video section, or refer to this post from there.

    Stilll I dont think you'll get that different answers.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  14. #14
    Senior Member
    Join Date
    May 2004
    Location
    Eastbourne, England
    Posts
    174
    back to a point made earlier:
    if it has an intro, you can make your main site load while the intro is playing, seemingly cutting down the load time to the end user.
    if you have a page saying view high or low bandwidth, if high is clicked how do you load a full flash site in a new window which has no buttons e.g http://hollywoodrecords.go.com/fortyfootecho/

    then if i create an intro and it is 5 Meg. The whole movie will download before playing, if it is 1 minute long that would normally be a wasted minute. How do i get the rest of the website to load or begin loading in this normal "dead" time.
    i had a look at http://www.kirupa.com/developer/mx/p...transition.htm but it is not really what i want - unless i dont misunderstood it. When i clicked the buttons to view the other pictures it did its closing animation, loading animation and opening animation then displayed them. I understood "preload external files" as while i was on image 1 the other 2 images would be loading in the background so as i clicked them it was instant, with no loading time. I was expecting it if i was re-visit the page now where i have them cached so it really is instant.

  15. #15
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    You use javascript to open a popup window wuith a specified size and no toolbar.

    //POPUP CODE

    on(release){
    getUrl("javascript:window.open('http://www.mysite.com/image1.html','newwindow','width=420,height=420,top =0,left=0'); void(0);")
    }

    (there should be no space between java and script, )

    And check out the popup script generator at www.flash-db.com/PopUp
    ..for more advanced versions

    The purpose of a intro ( in your case ) would be , not to use heavy graphics, but just to distract the viewer while the real site is loading. As you can not stop Flash from loading it will load in the background ( as long as the intro dont eat up the bandwith ).

    A intro with just text animations for instance will take up very little bandwith, enabling the rest of the file to load and get a head start so to speak ( buffering ).

    It is simple math. If your intro part is 50 kb and 30 seconds long, about 1.5 mb has loaded of the whole movie when the intro is done ( on a regular broadband connection ).

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  16. #16
    Member
    Join Date
    Mar 2005
    Location
    Minnesota, USA
    Posts
    58
    how long is the movie....how many minutes that is?
    It's just a job. Grass grows, birds fly, waves pound the sand. I just beat people up.
    Muhammad Ali

  17. #17
    Member
    Join Date
    Mar 2005
    Location
    Minnesota, USA
    Posts
    58
    I was trying something out in flash to see if you could come up with variables that would determine how much needs to be loaded before the movie will play strait through. This is what I came up with but it doesn't seem to work like I thought it would....granted...I'm rather new to flash but if anybody has any ideas as to how to make this work, it seems like it could be an elaberate way to load a webpage most efficiently.

    I don't know the exact download speeds for dial up and broadband but in my script i used 4k for dial up and 30k for broadband...its not right but it gives you the idea of what i was trying to do. also...the character_test.swf was the flash for learning how to have talking characters....anyway I was trying to test it on this and is loacated on my site. The swf that should determine what percentage the movie has to reach before it should play is broken down like this....

    there are two buttons, one is for dial up and the other is for broadband. the dialup button has the following script:

    on (release) {
    // speed in bps that dial up will take
    speed = 4000;
    // loads your movie
    loadMovieNum ("character_test.swf", 2);
    play ();
    }

    and the broadband button has the following script....

    on (release) {
    // speed in bps that dial up will take
    speed = 30000;
    // loads your movie
    loadMovieNum ("character_test.swf", 2);
    play ();
    }

    ...this will just determine weather they are on dial up or broadband and it also load the movie for them....

    The next frame is just a blank frame to try and keep organized

    then...on the next frame is where the numbers are determined to most efficiently load the website...I might have made a mistake in this area...the frames actions are as follows:

    // how many bytes are loaded in level 2
    bytes_loaded = Math.round(_level2.getBytesLoaded());
    // how many bytes total in level 2
    bytes_total = Math.round(_level2.getBytesTotal());
    // the percent that is loaded
    getPercent = bytes_loaded/bytes_total;
    // the lenght of the movie in seconds
    // assuming its a minute and a half
    total_time = 90;
    // how many seconds it will take to load
    load_time = bytes_total/speed;
    // the time after it will start playing
    start_play = load_time-total_time;
    // the percentage it needs to reach to start playing
    load_percentage = start_play/load_time;
    // how many seconds left until it starts to play
    time_left = Math.round(((bytes_total-bytes_loaded)/speed)-90);
    // check to see if the percentage is reached
    if (getPercent>=load_percentage) {
    // play frame 2 in level 2
    _level2.gotoAndPlay(4);
    this.gotoAndStop(5);
    } else {
    play ();
    }

    in the frame after this I just have a simple

    this.gotoAndPlay(3);

    and finally in frame 5 i have a

    stop();

    For some reason or anther it wont load the movie....its uploaded to

    http://rhinovalley.rh.funpic.org/faf/speed.swf

    and the file it loads is located at

    http://rhinovalley.rh.funpic.org/faf/character_test.swf

    The links wont work directly so you will have to copy and paste them into your browser

    if you directly to the character_test.swf you will get a blank screen and have to right click and press play for it to actually play. this is because there is a blank frame in frame one that only has a stop(); action to it so if it is loaded, it wont be visible until it is ready to play.

    I've also included a copy of the .fla in case somebody wanted to take a look at it if I did something wrong or just stupid....

    hope this could help....
    Attached Files Attached Files
    Last edited by rhinovalley; 04-10-2005 at 11:03 PM.
    It's just a job. Grass grows, birds fly, waves pound the sand. I just beat people up.
    Muhammad Ali

  18. #18
    Senior Member
    Join Date
    May 2004
    Location
    Eastbourne, England
    Posts
    174
    pellepiano
    As you can not stop Flash from loading it will load in the background
    I will have a webpage with an intro/looping animaiton with "enter site" on. Then a simple site with each page being a separate .swf movie. how is it best to link these together ??

    i have never tried loadmovie and levels? It seems quite easy - have the background at level 0 with each object i want in front being 1 higher. Is that all there is to it?

    also what is the difference between loadmovie and loadvariables ?

  19. #19
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    also what is the difference between loadmovie and loadvariables ?
    Its what it sounds like. One loads movies and the other loads or sends variables.

    There are two ways of loading external files into Flash. Either you can load swf files into _levels or into movieclip targets.

    _levels only exist in the Flash player. They are like layers but for swf files The Flash player is like a overhead projector where the plastic films you put on top of each other are like the swf files in the player. There are 16000 available levels

    //To load a external swf into a _level from a button. The number 1 being the level to load into.

    on(release){
    loadMovieNum("myExternalFile.swf",1);
    }

    Movieclip targets are what it sounds like. A empty movieclip placed on the stage just for the purpose of loading a swf file into it. The advantage is that you can place it anywhere, manually ( as opposed to swf's in _levels) and also can control what of the objects should be on top or beneath.

    Usually you give the movieclip an instance name of container. ( you give a instance name by selecting the empty movieclip on stage and write the name in the Property Panel )

    //To load a external swf into a target movieclip from a button ( both being on the main timeline ).

    on(release){
    container.loadMovie("myExternalFile.swf");
    }

    The external movie's top left corner will place it self where the empty movieclip is.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  20. #20
    Senior Member
    Join Date
    May 2004
    Location
    Eastbourne, England
    Posts
    174
    i tried making the contanier but obviously did sometihng wrong as i dont get the white circle so can't place it anywhere.

    can someone either make a simple example for me or look at mine and highlight what i am doing wrong. the load movie will be the main one and whatever sub page etc will be what i want to load in this case mytest.swf
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center