dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [CS3] Preloader to an existing movie

  1. #1
    Junior Member
    Join Date
    Nov 2007
    Posts
    11

    [CS3] Preloader to an existing movie

    I have a finished movie which is about 20 frames and 150k
    I add this script to a movie clip on frame one at the bottom layer:

    PHP Code:
     onClipEvent (enterFrame) {
        
    loading _parent.getBytesLoaded();
        
    total _parent.getBytesTotal();
        if (
    percent == undefinedpercent 0;
        
    percent -= (percent-((loading/total)*100))*.25;
        
    per int(percent);
        
    percentage per+"%";
        
    loadBar._width per;
        if (
    percent>99) {
            
    _parent.gotoAndPlay(2);
        }

    The movie plays fine [and starts on frame2], but when I hit control-enter again to simulate download conditions, the preloader only loads right before the movie which leads me to believe the preloader isn't actually working.

    Is there something wrong with my logic or the way I am using preloaders?
    Last edited by DCG; 03-20-2008 at 06:09 PM.

  2. #2
    flip-flopper scottPadgett's Avatar
    Join Date
    Jan 2005
    Location
    Boston
    Posts
    425
    what are you trying to preload? the movieclip that you placed this code on, or the main movie itself where your _parent property is pointing?
    :: scott ::

  3. #3
    Junior Member
    Join Date
    Nov 2007
    Posts
    11
    Quote Originally Posted by scottPadgett
    what are you trying to preload? the movieclip that you placed this code on, or the main movie itself where your _parent property is pointing?
    I am trying to preload the entire movie

  4. #4
    flip-flopper scottPadgett's Avatar
    Join Date
    Jan 2005
    Location
    Boston
    Posts
    425

    works for me

    Hi,

    I don't see anything wrong with your basic premise here. It works when I tried it out.

    Take a look at this file that I worked up. I tweaked a filepath a bit for my specific test, as I placed your code on the loader bar directly, and I also changed a line of your code to use .xscale instead of .width property for your loader bar, which allows your loader to be any width.

    http://wscottpadgett.com/flashkit/preloaderTest.fla.zip
    :: scott ::

  5. #5
    Junior Member
    Join Date
    Nov 2007
    Posts
    11
    oh cool...thanks for your help

  6. #6
    Junior Member
    Join Date
    Nov 2007
    Posts
    11
    Would having attached movie clips effect this?

    This works fine when I use it in front of a basic animation but when I actually plug it in to my movie (that has many attached movie clips) it still does not work. Any ideas?

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