Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2004
    Location
    Los Angeles
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Flash - Problem with external .swf loader

    I have a "loader" movieclip that works great at the beginning of a flash file (see code below) but when I import the published .swf into a parent flash file it only shows up as a blank screen while it loads. Then, once the external .swf is fully loaded, the "loader" appears for a brief second and then the movieclip plays.

    I need to get it so the loader inside the external .swf shows up while the .swf is being loaded into the parent file.

    Any help is GREATLY appreciated!


    Code:
    lBytes = _root.getBytesLoaded();
    tBytes = _root.getBytesTotal();
    percentLoaded = Math.floor((lBytes/tBytes)*100);
    loader.bar._xscale = percentLoaded;
    loader.percent.text = percentLoaded + "% of " + Math.floor(tBytes/1024) + "K loaded.";
    if (lBytes>=tBytes && tBytes>0) {
    	if (count>=12) {
    		gotoAndStop("intro");
    	} else {
    		count++;
    		gotoAndPlay("preload");
    	}
    } else {
    	gotoAndPlay("preload");
    }

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just a few questions for clarification:

    lBytes = _root.getBytesLoaded();
    I take it, you're trying to preload the main movie???

    loader.bar._xscale = percentLoaded;
    Shouldn't this be:

    _root.loader.bar._xscale = etc.

    if (count>=12)
    where is the initial value of count set? In frame 1 of loader MC?

    gotoAndStop("intro");
    gotoAndPlay("preload");
    Are these frame labels on the main timeline. If so, this should read:

    _root.gotoAndStop("intro"), etc.


    -james
    Last edited by jamescover; 08-17-2004 at 08:17 AM.
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #3
    Regular Coder
    Join Date
    Apr 2004
    Location
    Los Angeles
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks James for the quick response! Here are the answers to your questions:

    1. Correct
    2. "Loader" is a movieclip in the main movie, so it still works, but good point.
    3. Count is obsolete...that's legacy code so the following could be reduced to gotoAndStop("intro");
    Code:
    	if (count>=12) {
    		gotoAndStop("intro");
    	} else {
    		count++;
    		gotoAndPlay("preload");
    	}
    4. Again, because they are labels in the main movie, it still works, but you're right - that's better coding.

    This code works fine as a loader for a single .swf. The bigger issue is that it doesn't work as a loader when the publised .swf is imported into a parent .swf

    Basically I just need code (this code or anything else) that shows a "loading..." screen for an imported .swf. Right now flash loads the external .swf and then runs the "loading..." screen for half a second. But that doesn't help because the user has had to wait 10-20 seconds for the external .swf to load.

    Thanks again for the help!

    PS. I like the footnote below your name

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks James for the quick response! Here are the answers to your questions:
    Sorry, for taking so long to respond. I'm busy with a db project, and I thought/hoped someone else would chime in after you clarified a few things.

    Unfortunately, I'm afraid I'm still not following what you are trying to accomplish, or the hierarchy of your movie. I thought you were preloading the main movie, but I don't understand why you would (apparently) load the preloader movie as an external swf. If this is, in fact, what you are doing, I suggest recreating it as an MC or Scene (if you prefer) in the main movie.

    PS. I like the footnote below your name
    That's good news, indeed!



    -james
    Last edited by jamescover; 08-18-2004 at 08:03 AM.
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "


  •  

    Posting Permissions

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