A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Preload multiple swfs into the browser memory cache.

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    5

    Preload multiple swfs into the browser memory cache.

    Flash CS4 using AS 2.0 for this.

    Here's a simple problem I am having. I have a website made up from multiple swfs. Which open up over the index swf.

    What I need to do is load 4 swf files into the memory so the transition between the page loads is smooth. The swfs are only a few kb in size but the delay in loading these (1 second) makes the transitions look very untidy.
    Once i've clicked on every section then the flashplayer has them stored in the cache so they run smooth, is there anyway just to load these in before the start page has loaded.

    here is the website http://www.bytheseauk.com

    thanks in advance.

    Ben Parcell.

  2. #2
    Senior Member
    Join Date
    May 2008
    Posts
    332
    How about putting them all in the first frame, with alpha 0? Then they are all loaded and you can later make them visible.
    EfV

  3. #3
    Junior Member
    Join Date
    Feb 2010
    Posts
    5
    Thanks this is a good idea, I shall try this.

  4. #4
    Junior Member
    Join Date
    Feb 2010
    Posts
    5
    Ok i've tried hiding the 4 swf files into frame 1 of the main animation like you said but this doesn't seem to load the movies into the cache. The flashplayer still looks for the individual swf files and loads them up after the link has been clicked. I need the swf files in the memory so as soon as the user clicks on the link then there is no lag in between the transition.

  5. #5
    Senior Member
    Join Date
    May 2008
    Posts
    332
    What is the action in each button that loads each separate part?
    EfV

  6. #6
    Junior Member
    Join Date
    Feb 2010
    Posts
    5
    Code:
    contactbt.onRelease=function(){
    loadMovie ("contact.swf",0);
    }
    servicesbt.onRelease=function(){
    loadMovie ("services.swf",0);
    }
    aboutbt.onRelease=function(){
    loadMovie ("about.swf",0);
    }
    portfoliobt.onRelease=function(){
    loadMovie ("portfolio.swf",0);
    }

  7. #7
    Senior Member
    Join Date
    May 2008
    Posts
    332
    Testing your site above confirms that those 4 .swfs have not been loaded with the main page.
    I'm not sure how you hide then in the first frame? Did you actually do the loadMovie for each in the first frame? If not, that should be included in the first frame. And while testing, leave alpha at 100% to make sure that they have loaded.
    The loadMovie as a button function may just be reloading the movie each time it's pressed. Instead create a new key frame on the main timeline for each new page. Use a frame label for the keyframe like "contact", "services", etc. set the alpha on each page to 0% except in the new keyframe for that page, there, set the alpha to 100%.
    Then your button OnRelease is not loadMovie but gotoAndStop("contact"). So when button is clicked the viewer is taken to the key frame labeled "contact" and the page is dispalyed at 100% alpha.
    Best wishes,
    Eye for Video

  8. #8
    Junior Member
    Join Date
    Feb 2010
    Posts
    5
    Ok i think i'm nearly there, when you said to put the swfs in the flash I literally dragged and dropped the external swfs onto the stage in frame 1 and then made alpha to 0%.

    Ok so using AS this time
    To load the movies into the page I use the code

    loadMovie ("contact.swf");

    how do I use this with the _alpha=0 ?

    I'm sorry about not grasping basic coding, i'm a beginner.
    Last edited by djparce; 02-12-2010 at 03:58 PM. Reason: progress

  9. #9
    Senior Member
    Join Date
    May 2008
    Posts
    332
    There may be a way to accomplish this using loadMovie in the first frame but since you want everything loaded right away, it's probably better to just import the .swf into the library instead. Then just drag it into the frame you want, skip the _alpha stuff. Then use gotoAndStop (or Play) at the particular frame label. All 4 swfs should load when you load the main .swf.
    Sorry if I lead you down a wrong path there for awhile.
    EfV

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