A Flash Developer Resource Site

Page 5 of 10 FirstFirst 123456789 ... LastLast
Results 81 to 100 of 189

Thread: For everyone with a preloader problem

  1. #81
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    The answer seems pretty obvious to me.... do exactly what you said "load each page individually". All you need to do is break up each page up into individual .SWF's, and then load them all externally when needed. Also, you may want to upgrade to at least Flash MX04, or hopefully Flash 8...

    Hope that helps,
    Sportzguy933

  2. #82
    Member
    Join Date
    Jul 2001
    Posts
    86

    Thanks but?

    Thanks for your reply Sportszguy
    I just had a ccouple of questions.
    So i make all the scenes into SWFs. I got that part.
    And i put the preloaders infront of each SWF. i got that.

    But as far as my buttons, how does it work?
    Its now go to and play scene 1 , scene 2, ect.
    What script do i put on the buttons to go to an swf?
    And is this something ill be able to test while Im working on it or will it have to be up on the internet to see work?
    In other words are the commands for the buttons going to be go to and play "this" URL address ?
    I know these are stupid questions but i need the answers.
    Thanks.
    Last edited by tyler78210; 07-17-2006 at 04:31 PM.

  3. #83
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    1.) I can NOT commnt enough on how BAD it is to put your preloaders IN THE .SWF YOU ARE TRYING TO LOAD!! Dng it this way is only asking for toruble and more work down the road when yoru back posting questions like: "Why does my preloader start at 60%"...etc


    2.) to load an external.swf into you MAIN.swf (by way of button) you can do the following:

    1.) you can load it into a _level (think of it as stacking like a pieces of paper on top of another one..and so on...)
    2.) you can load into a containerClip. (containerClip is nothing more that a blankClip movieClip)

    expanding on #2 here. You can hae a movieClip (with an instance name of course) on the stage that you placed there.. OR..you can create an empty MovieClip on the fly (dynamically)

    So lets say in your project..you have your MAIN.swf..ts has your logo, theme/color and your buttons in it. You will LAOS need a target (a movieClip) to load you external.swf's into..

    so drag an EMPTY movie Clip to the stage.. and give it an instance name of (for this exmaple we'll use) containerClip.

    on your buttons you coudl have the code of:
    Code:
    on(press) {
        containerClip.loadMovie("whatever.swf");
    }
    thats it.. you can re-use this 'containerClip' to load other content in it as well...images, video, .swf's...and it will REPLACE the current content.

    good luck

  4. #84
    Member
    Join Date
    Aug 2002
    Location
    Edinburgh, UK
    Posts
    46
    fao: whispers

    I've been reading your posts over the different topics that you've been replying to and I'm afraid I still don't get it.

    I understand the explanation as to why my preloader won't display properly and that I should have my preloader in my main swf that my smaller movies are being loaded into.

    What I don't get is the script to use for the preloader to check the unoaded swf. Can you post an example of the script you use?
    Edenangels
    Sexy Funky Filthy House

  5. #85
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    what does fao mean?

    what topics what I replying to that you did NOT understand?

    there is alink in my footer called preloader help, that explains the code I use... but if you would like a trimmed up, smaller, simpler example we can do it right here..

  6. #86
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    in its most basic form.. it would be sometign similar to this:
    Code:
    onClipEvent (enterFrame) {
    	tb = Math.round(_root.containerClip.getBytesTotal()/1024);
    	lb = Math.round(_root.containerClip.getBytesLoaded()/1024);
    	if (tb>0 && lb>0) {
    	//if (tb>lb) {
    		percent = Math.round((lb/tb)*100);
    		_root.textField_txt.text = percent;
    		if (lb>=tb) {
    			_root.textField_txt.text = "LOADED";
    		}
    	}
    }
    what you need to test this is the following:
    a button on _root timeline (instance name: load_btn)
    an empty movieClip on the _root timeline (instance name: containerClip)
    a dynamic textField on _root timeline (instance name: textField_txt)

    code for the button:
    Code:
    load_btn.onPress = function() {
        _root.containerClip.loadMovie("someImage.jpg"); //same folder as the flashMovie
    }
    now what you have here is a re-usable container..that you can load anything into.... and when you do ..the textField will show a percentage of how much is loaded

  7. #87
    Member
    Join Date
    Jul 2001
    Posts
    86

    Whispers

    Your shooting way over my head.
    Isnt there a simple way to break a site up with preloaders?
    Whats the easiest way?
    I dont understand alot of what you said about levels and instances.

  8. #88
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    sorry, but if you dont understand what an instance is, you need to go back and do some reading.....

    and that IS the easiest way to preload external content..(and for this example you can ignore _levels)

  9. #89
    Junior Member
    Join Date
    Jul 2006
    Posts
    10

    Whispers Re:Advice

    Before I get into this lengthy explanation. Let me just say THANXS IN ADVANCE to anyone who can pass on some helpful information.

    Thanks for the information. Let me just clarify what you've said:

    1. Never place a preloader directly on the timeline of a movie being loaded
    into your main movie.

    2. It's good coding practice to load your swf files into a container clip in
    your main movie - if possible, try to avoid using _levels.

    3. The preloader code can be attached to the wrapper of your container clip
    (the target clip you will load your swf into); thus each time a onClipEvent
    (load) is triggered the preloader will be activated.

    4. Alternatively, the preloader code can be placed on the timeline of your
    movie; for example in 'Scene 1'.

    Currently, I'm working on a small project that I haven't had a chance to
    test. I was wondering if you could look at the code and tell me if you
    think it will fly. Note: I'm using Flash Mx 2004 and Actionscript 2.0.
    Hopefully, this approach will accomodate attached sounds, shared
    libraries, and multiple swfs that load into levels.


    Note the master.swf timeline is ten frames long. On Fr01 I
    load 'trigger.swf' (which contains a single shared library item)
    into _level5 which initiates the downloading of my
    shared library . On the main timeline of the master file there is a static text
    box that from FR01 - FR09 reads 'ASSETS DOWNLOADING' - hopefully
    the shared library isn't too large and this can serve as a rudimentary preloader for the shared library. Once the library is downloaded, the
    code _level0.play() (which is placed on the timeline of trigger.swf)
    will move the master timeline to FR10 where the trigger file is flushed
    out and the content files are loaded into their respective levels using
    the preloader (which is an external swf file that is loaded into _level50) and controlled with the script on the main timeline of the master file.

    Note 'content.swf' has numerous sound objects (52) and sound files inside
    of movie clips which are strung out along the timeline of content.swf. All
    of these sounds are quite short so I didn't think it would be practical to
    stream the sounds. Thus I'm loading an swf file into _level5 with 52
    attachedSounds which add about to 102kb.

    I've read some stuff about classes and shared libraries being loaded into
    FR01 before the preloading script; thus causing a hiccup before the
    preloader is displayed on the stage. Would this also apply to sound objects
    as they are being loaded into _level5.

    Anyways, the code is below. If you can think of a more elegant
    (simple) solution, please pass it on. Also any information on the pitfalls
    of loading shared libraries, classes, and sound objects as attached sounds
    is greatly appreciated.


    FILE 'master.fla' (_level0)

    Code: Actions FR01

    stop();

    // Initialize the Movie Clip Loader and Listener

    var myMCL:MovieClipLoader = new MovieClipLoader();
    var myListener:Object = new Object();
    myMCL.addListener(myListener);

    /*preloader code using listener: by default the MovieClipLoader sends the target_mc being downloaded, total bytes, and the amount of bytes currently loaded */

    myListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
    _level50._visible = true;
    var preloadPercent:Number = Math.round((loadedBytes/totalBytes) * 100);
    _level50.preloader.gotoAndStop(preloadPercent);
    _level50.preloadInfo1.text = preloadPercent + " % loaded";
    _level50.preloadInfo2.text = Math.round(loadedBytes/1000) + " kb
    loaded / " + Math.round(totalBytes/1000) + " kilobytes total";
    }

    myListener.onLoadComplete = function(target_mc) {
    _level50._visible = false;
    }

    // Load external files trigger (1st) and the preloader (2nd)

    myMCL.loadClip("trigger.swf", 5);
    myMCL.loadClip("preloader.swf", 50);

    ------------------------------------------------------------------------

    Code: Actions FR10

    stop();

    myMCL.loadClip("main_menu.swf", 20);
    myMCL.loadClip("content.swf", 5);
    myMCL.loadClip("music.swf", 6);
    Last edited by lastradius; 07-18-2006 at 04:47 AM.

  10. #90
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    not sure about loading shared libraries (never done it)....can I ask what your using it for?

    anyways... your also using the movieClipLoader, where as the code above it just a 'home-made' version of one...


    you can also go here:
    http://www.gotoandlearn.com/ and watch the preloading external.swf files video.

  11. #91
    Junior Member
    Join Date
    Jul 2006
    Posts
    10
    Thanks in Advance, Last Radius

    I teach ESL in Vietnam and was thinking of creating a site that will help people (kids) learn English. In the example above, the user can navigate the content timeline; for instance, the user is initially presented with the letters 'A a'; the word 'ant'; and an image of an ant. The user can click on a speaker icon and hear the letter 'a' or click on another speaker icon and hear the word 'ant'. Next, the user clicks on an arrow and navigates to 'B b' with the picture of a bear, etc. You can see why I don't want to stream the sounds because they are very small files that are essentially button click sounds. I'm just trying to build a preloader that is seamless and efficiently loads all of my files. I think the approach for the shared library is workable, but I'm not really using a preloader. I've read that if you preload the shared library it will be downloaded twice; once, when you preload it; and again, when you request the first item from the shared library (source: flash mx 2004 Beyond the Basics 'Lynda Weinman'); thus it is best to place a trigger (a single item from the library itself) on the first frame of your movie that initiates the downloading of the library. I think this is how it is going to work: The user opens the movie and the downloading of the shared library is triggered. The viewer is presented with the static text 'Assets Downloading' when the library is completely loaded the master swf is sent to FR10 which flushes out the trigger clip, removes the static text, etc.

    One more question: If you have several sound objects (using the attachSound method), will there be a hiccup before your preloader is visible on the stage. For example, the player loads the sound files (104kb) and then the preloader becomes visible on the stage. If so, what is the point of the preloader and what would you recommend as a work around.

    Thanks for the help

  12. #92
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    First of all, you won't know all the answers until you test your movie, but I can tell you that using the attachSound method, means calling on a pre-loaded sound from a library, so there is no point in preloading the sound.

    If I were you, I would just load all of the sounds at once, when you first ebter the website.

    Good Luck,
    Sportzguy933

  13. #93
    Junior Member
    Join Date
    Jul 2006
    Posts
    10
    Thanks for the reply. One Question: How would you preload the sounds all at once before you enter the website.

    1. Attach the sounds to the master clip
    2. Attach the sounds to an mclip on the timeline of the master clip
    3. Create a separate swf file that is loaded into the master clip

    Hmmm who knows - like you said I'm going to have to put it up and run some tests. There seems to be a lot of confusion surrounding preloading flash sites; especially when you get into using classes, shared libraries, sound objects, loading movies into levels, etc. Preloaders are an integral part of the flash experience, so you would think these solutions were readily available. It ain't so joe! If I could count the times I've tried to get a simple solution to questions of this nature! Anyways, thanks for taking the time to answer my questions.

    Thanks
    Last Radius

  14. #94
    Junior Member
    Join Date
    Jul 2006
    Posts
    4
    I'm having that hiccup before my preloader shows up as well. I use the attachSound element and the loader bar shows up at around 75%. Is there a better way to use sound?

    I know its an over-asked question but noone ever seems to give a real solution. As far as I can tell the only solution is an external preloader, but again noone ever seems to have any Tuts or answers that somewhat of a Flash noob can use. So I'll ask:

    Are there any good Tuts out there that address the "Preloader loading too late" question, with real answers? Someone must know how to do it 'cause I see flash with sounds and preloaders all the time. I'm begging you, PLEASE! PLEASE! help this newbie out a bit?" Thank you.




    Still searching for that stupid preloader:
    Prodigy_Savan

  15. #95
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    If you read some of Whispers' earlier posts, he more or less addressed the problem... Your preloader should NOT be in the same movie that is being loaded (externally). As for your problem, Lastradius, you can easily load the entire contents of the movie by simply putting a preloader on the route timeline before the movie starts (make a new scene and put it infront of the movie)... just follow the tutorial on the first post in this thread. If you don't want to do that, you can always load each sound externally, instead of using the atttachSound method, and therefore expecting the sounds to basically load altogether, probably causing this "hiccup" you were talking about, or at least contributes to it... Speaking of that, please explain exactly what it is, or post an example of it (the "hiccup").

    Good Luck,
    Sportzguy933

  16. #96
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    wow..this is leaving a bad taste in my mouth.

    every got a REAL answer..not only to WHY this happens..but HOW to fix it.

    The fix was explained...posted to, linked to..and even EXPLAINED line by line. post #86 explains it in its most BASIC format.

    Maybe YOU arent asking REAL questions then...cause the answer is the same. :|

    If yoru having trouble..POST a question about the EXAMPLE being used here..so everyone can be on the same page.

    A tip for EVERYONE would be to make a NEW (blank) .fla..and do NOTHING but practice a preloader for an image or .swf..once y ou have that down...integrate it into your project.

  17. #97
    Junior Member
    Join Date
    Jul 2006
    Posts
    4
    I'm sorry guys. I didn't mean to ask a question that was already answered. The button code in post #86 threw me off since I just needed a preloader that implemented when a visitor entered the page, without any buttons.

    I actually managed to use part of the external preloader sportzguy933 posted in post#1. Again I'm sorry for the confusion, and for sounding pushy. I've been trying to solve this problem for quite some time now.

  18. #98
    Junior Member
    Join Date
    Jul 2006
    Posts
    10
    Quote Originally Posted by Prodigy_Savan
    I'm having that hiccup before my preloader shows up as well. I use the attachSound element and the loader bar shows up at around 75%. Is there a better way to use sound?

    I know its an over-asked question but noone ever seems to give a real solution. As far as I can tell the only solution is an external preloader, but again noone ever seems to have any Tuts or answers that somewhat of a Flash noob can use. So I'll ask:

    Are there any good Tuts out there that address the "Preloader loading too late" question, with real answers? Someone must know how to do it 'cause I see flash with sounds and preloaders all the time. I'm begging you, PLEASE! PLEASE! help this newbie out a bit?" Thank you.




    Still searching for that stupid preloader:
    Prodigy_Savan
    Savan: A quick fix for preloading attached sounds

    1. Open your main movie; for example 'master.fla'
    2. Create two scenes: The first scene that holds your basic preloader' and a second
    scene that holds your movies content.
    3. Import the Sound Files that you want to attach to the library
    4. Set the linkage of these files but uncheck the 'Export in First Frame'
    5. Press CTRL + F8 to create a new symbol; for example 'sounds_mc'
    6. In Symbol Edit Mode create two layers 'actions' and 'mp3s'
    7. Select FR01 of the action layer and place a stop(); action
    8. In the 'mp3s' layer click on FR100 and add a frame (F5 on your keyboard)
    9. In the 'mp3s' layer click on FR02 and add a blank keyframe
    0. Select the blank keyframe on FR02 and add your sound to the timeline

    Note, Add a layer for every mp3 you are going to use in your file and
    place the related file on the layer - that is, place the sound file on the
    timeline. Note, these sound files placed on the timeline will never play
    because we have placed a stop(); on FR01 of the actions layer. What,
    we are doing is manually placing the files on a timeline so flash can
    recognize them and in conjunction with step4 above begin downloading
    the sound files after the preloader has appeared on stage.

    1. Return to the MTL of 'master.fla' and select the 'content' Scene
    2. On FR01 drag 'sound_mc' from the library and place offstage
    3. Make sure you declare you sound objects after 'sound_mc' has been placed
    on the MTL of 'master.fla'; for example:

    var sound01:Sound = new Sound(this);
    sound01.attachSound("linkageID");
    sound01.start(0, 0);

    I think it is important to include the this designation, and make sure you declare
    attach and call the sound instance after they have been placed on the timeline.

    Now, Flash won't load the script before the preloader. The hiccup before the preloader is flash loading the classes, components, sound objects.

    Maybe not an elegant solution but it seems to work. Note I've only tested this in the Flash test bed, so let me know how it worked for you.

  19. #99
    Junior Member
    Join Date
    Jul 2006
    Posts
    10
    Quote Originally Posted by sportzguy933
    If you read some of Whispers' earlier posts, he more or less addressed the problem... Your preloader should NOT be in the same movie that is being loaded (externally). As for your problem, Lastradius, you can easily load the entire contents of the movie by simply putting a preloader on the route timeline before the movie starts (make a new scene and put it infront of the movie)... just follow the tutorial on the first post in this thread. If you don't want to do that, you can always load each sound externally, instead of using the atttachSound method, and therefore expecting the sounds to basically load altogether, probably causing this "hiccup" you were talking about, or at least contributes to it... Speaking of that, please explain exactly what it is, or post an example of it (the "hiccup").

    Good Luck,
    Sportzguy933
    The reason I wanted to use the attachSound method is because all of my sound files are extremely short (button sounds) and it probably wouldn't make sense to stream them. I understand what you are saying with regards to not placing a preloader on every movie that is loaded into your main movie. In the future, when I am using longer sound files I will simply stream the files and avoid the somewhat less than elegant work around. Any feedback is appreciated.

    Thanks Last Radius

  20. #100
    Junior Member
    Join Date
    Jul 2006
    Posts
    10
    Quote Originally Posted by whispers
    wow..this is leaving a bad taste in my mouth.

    every got a REAL answer..not only to WHY this happens..but HOW to fix it.

    The fix was explained...posted to, linked to..and even EXPLAINED line by line. post #86 explains it in its most BASIC format.

    Maybe YOU arent asking REAL questions then...cause the answer is the same. :|

    If yoru having trouble..POST a question about the EXAMPLE being used here..so everyone can be on the same page.

    A tip for EVERYONE would be to make a NEW (blank) .fla..and do NOTHING but practice a preloader for an image or .swf..once y ou have that down...integrate it into your project.
    Sorry, if I am driving you nuts. I understand the coding. I was just trying to find a solution to the hiccup before the preloader that results from using attached Sounds. Would post #86 resolve this problem.

    Thanks Last Radius

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