Preloader trouble

Hi,
I'm involved with my first Flash Project using Action Script.
Im having some problems with my preloader. I have the following
script to prevent the page playing before it has been completely
loaded. The problem is that if someone clicks out of the page while
it was still loading, 'myInterval' won't be cleared and will mess
things up. I'm assuming I need an 'else' command. Just not sure
how, Any help?
stop();
myInterval = setInterval (preloader, 50);
function preloader() {
if (getBytesLoaded()>=getBytesTotal() ) {
play()
clearInterval (myInterval)
}

Let me rephrase: I have a movie clip loader and a preloader
in a master page. I load to this master page different swf files
using the mcl. Some of them take more time to load so I've added an
"interval function" to tell flash not to start playing the page
until its fully loaded. Now, the problem occurs if someone, while
loading a page with the interval script, doesn't wait until the
page is fully loaded and clicks on another link (any link) and
starts loading another swf clip. The site freezes and wont work
until it gets reloaded.
I am aware that I do have to cancel that condition somehow...
Sorry for being such a mess explaining this. I'm just learning
action script and its hard to explain when you don't have the
proper lingo.
Jose Luis

Similar Messages

  • Preloading trouble

    Hi all,
    I have encountered some trouble with the preloader in
    Captivate 3:
    I used the default preloader in a captivate project, and when
    I test it I see that the preloader image is not displayed until
    very late in the game, just a few seconds before the project is
    fully loaded. So, basically I see a blank screen for a while, then
    a few seconds of the preloader image and then the swf itself.
    I've not made any changes to the preloader code.
    I use Captivate 3, publish to flash 8 and view in explorer.
    Does anyone know the root for this problem and how to fix it?
    Why isn't the preloader displayed as soon as I start loading the
    project?
    Thank in advance,
    Anat

    .oO(Mike-H)
    >I have a page with an image gallery, thanks to David
    Powers help. It works via
    >spry/javascript. It loads fine, all the images work, but
    when I click on a
    >thumbnail, I have to wait for up to 3 seconds to see the
    larger image.
    Quite normal.
    >If I
    >change the image group, I also have to wait to see the
    new thumbnails loaded.
    Sure. Quite normal.
    >This is on a very fast internet connection, I am
    concerned that it will be even
    >more pronounced by anyone using a slower connection.
    >
    > In the past I have seen various methods of preloading
    images: using an onload
    >directive in the body tag, using a javascript function,
    and putting all the
    >files at the bottom of a page in a hidden div (a div with
    css display:none). My
    >questions is: do these help
    No.
    Think about it. The files have to be downloaded anyway.
    Whether on
    demand or "preloaded" - it always takes time.
    Preloading almost never really works and may even have severe
    drawbacks,
    like in case of image galleries. If you preload the entire
    gallery, the
    user's browser will download and download and download - it
    will take
    some time until the progess bar shows 100%. Not good.
    Additionally this
    will cause _a_lot_ of totally unnecessary traffic on both
    client and
    server side. You don't know which images the user wants to
    see, so why
    push them all into the browser already? This doesn't really
    make sense.
    So forget the entire preloading idea. Simply link the
    thumbnails to the
    page and don't worry if clicking on a larger image may take 3
    or 5
    seconds. That's what users are used to, it's not a real
    problem.
    Micha

  • AS3 PreLoader Troubles

    I have been trying to make my simple animated preloader work and am just about ready to throw in the towell.
    import flash.events.ProgressEvent;
    import flash.events.Event;
    import flash.net.URLRequest;
    myLoader.addEventListener(Event.COMPLETE, onComplete);
    myLoader.addEventListener(ProgressEvent.PROGRESS , onProgress);
    function onProgress(e:ProgressEvent):void
        var pct:Number = e.bytesLoaded / e.bytesTotal;
    function onComplete(e:Event):void
        preloader_mc.X = -1000;
    myLoader.load(new URLRequest("D.swf")); 
    PLEASE HELP!!!!!

    use:
    import flash.events.ProgressEvent;
    import flash.events.Event;
    import flash.net.URLRequest;
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
    myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS , onProgress);
    function onProgress(e:ProgressEvent):void
        var pct:Number = e.bytesLoaded / e.bytesTotal;
    function onComplete(e:Event):void
        preloader_mc.X = -1000;
    myLoader.load(new URLRequest("D.swf")); 

  • Flash 8 Preloader Troubles

    Hiya - sorry to revisit an old issue - but Im still
    struggling. Most of my sites are under 1MB, but a new one is around
    2MB, (I know - Ive told the client
    Im using a simple percentage loaded script, which
    Ive used before and Im content with, except this time the delay
    before the preloader shows is marked. Ive googled, looked through
    various forums etc, but havent found a simple laymans terms tute,
    or explanation on how I can correct this. The preloader takes
    forever to appear, durign which time the screen is just the bg
    colour. I have moved other codes to the third frame, (so that its
    only the preloader that starts in frame one) but still no joy.
    Thanks again,
    Scotia

    Hi Lisa;
    I just had something similar to the problem you are having.
    The Solution was eluding me for about half-an-hour. Then I realized
    that the preloader I made earlier was published for flash 6. While
    I was editing the site, I had to use an option available in flash 8
    publish settings. Once I saved the site in Flash 8 settings I was
    having errors with the action script. I didn't make any changes at
    all to the preloader actions script in my editing but it was now
    showing an error. I got lucky and attempted to re-publish the site
    back to Flash 6 Publish settings.....It worked. Also the flash 8
    feature that I added still worked. So simply try and "Go back to
    the future" and change your publish settings back to Flash 6
    settings. No guarantees, but it worked for me.
    Good Luck,
    Rod

  • Preloader troubles...

    Im trying to add a preloader to my portfolio..im adding a scene called preloader then placing it first in the play order...then i add the animation-movieclip and the preloader code in that scene...  so the preloader should be the first thing that shows up...instead the whole movie loads in frame 0 when i run the simulate download command in flash....
    In the bandwidth profile it shows it stuck on frame 0...when i try it on my site it loads everything on a blank screen then zip pass preloader scene and jumps in to the main movie....
    My question is why is it loading at frame 0 when frame 0 doesnt even exist....i get no errors whatsoever...
    here is the code im using...
    import flash.events.ProgressEvent;
    function update(e:ProgressEvent):void
    var percent:Number = Math.floor( (e.bytesLoaded*100)/e.bytesTotal );
    if(preloaderMC is MovieClip){
    preloaderMC.gotoAndStop(percent);
    if(percent == 100){
    play();
    loaderInfo.addEventListener(ProgressEvent.PROGRESS, update);
    // Extra test for IE
    var percent:Number = Math.floor( (this.loaderInfo.bytesLoaded*100)/this.loaderInfo.bytesTotal );
    if(percent == 100){
    nextFrame();
    stop();

    Yes i do have embeded fonts but not in frame 1....In the band width profiler readout it says frame 0 thats where everything loads then after it loads it goes to frame1 of the preloader scene..thats the problem im having....if it had just went to frame 1 of the preloader scene and load everything it would be fine..

  • Having Trouble With Image Preloads

    Can somebody please tell me what I'm doing wrong?
    Check out my homepage -
    http://www.huppbrian.us
    The links on there are all supposed to rollover, and they
    do... kinda.
    Hold your mouse over one of them, and you'll see the
    appropriate rollover behavior... eventually.
    Yes, I did check the "preload images" box for them all (only
    the buttons and scroll jpg).
    Funny thing is that if you click on one of the links, and
    then click the back button, the rollovers on the home page then
    work fine.
    Any ideas???

    I haven't renamed anything as far as I know.  I made a new folder when I hit Folder option and it's highlighted as well as the path shows up in the processor box.  Just when I choose run it tells me to specify a folder.  The only thing I can think of is that maybe something messed up b/c I'm copied the files and folders over from my PC but it let me save as on the mac.  Also the folder I'm choosing to put them in is on the Mac harddrive.  IDK...

  • Preloader causes trouble in other scene

    Hello..
    I have a flash file with 2 scene..
    1 scene - loader
    2 scene - main
    When i test the scene "main" (deleted the scene "loader" from
    my file) it works perfectly with the animations i have given it.
    But when I add the scene "loader", the "main" scene doesn't load
    completely..
    Only with scene 2 "main"
    Scene
    Main
    Scene 1 and 2 "loader" and "main"
    Scene
    Loder and Main
    code i used for the preloader
    quote:
    stop();
    myInterval = setInterval(preloader, 100);
    function preloader(){
    if (_root.getBytesLoaded() >= _root.getBytesTotal() ){
    gotoAndStop("main", 1);
    clearInterval(myInterval);
    Any idea what this could be??
    Thank you

    First, you are using references to "scenes" for action script
    navigation (you should use frame labels). Also, you have a
    gotoAndStop to frame 1 of that scene. Depending on how other
    symbols are on this time line, and since you told it to stop on
    frame 1, flash may not have had time to initialize other symbols
    before the play head stopped. I've come across this before - it's
    hard to explain, but under certain circumstances it can happen. Is
    there only one frame on the "main" scene? If so, try extending that
    time line to 2 frames and place a stop action on frame 2, and
    change your preloader script to gotoAndPlay("frameLabel"); - you
    will need to label the first frame of the "main" scene with
    something and replace "frameLabel". Do you place your actions on
    the top-most layer, and in your publish settings, under the flash
    tab, what is the load order?

  • Preloader loading trouble

    Hello all,
    I have this loader that starts playing the content, before
    the content has loaded entirely.
    Now this is a problem because my content still sits there and
    does nothing until it's all loaded anyhow.
    Any thoughts.
    Thanks
    \\C

    You can hide the file that is downloading until its fully
    loaded and/or until you want to actually use it.
    1. Put a blank frame at the start of the .swf that you are
    loading. Tell the clip to play when you want to use it.
    2. Have the content in the loaded swf contained in a
    movieClip and set that clip's visible property to false. Set it to
    true when you want to use the loaded clip.
    3. Give the loader object a position off the visible area of
    the stage. Move the loader to the correct position on the stage
    once the file has loaded.
    4. Set the loader object's alpha property to false, and
    change the value to true when the file has loaded.
    Mix and match and add animation as needed.

  • Problem with preloader and sounds

    Hello everyone,
    I am making a movie that has 12 sound files in it. I am
    having trouble getting this to work with a preloader. I was using a
    seperate flash movie and using the movieClipLoader to load in the
    movie that has the sounds in it. However my employer wishes to have
    everything in a single swf file. I know the concept, that the
    sounds in the movie using attachSound need to be loaded before
    first frame... but I need the preloader to take them into
    account... how do I do that? I tried putting my preloader on frame
    one, then had 12 keyframes in a row and just dragged the sounds
    onto the stage (one for each keyframe there), and then the main
    movie starts on frame 14... but that stil doesnt work... how can i
    do this?

    Just to let anyone know... I did figure this out on my own...
    it makes it messy though and I dont like it... buuuuut what are you
    going to do... I had to set the linkage in each sound in the
    library to export and then uncheck the export in first frame...
    then i had to create keyframes for each sound and put it on the
    stage in frames 2-13. Preloader on frame 1 and main movie on frame
    14... it works now.

  • Trouble playing QuickTime movie from Keynote

    Hi everyone,
    Keynote '09 5.1.1 (1034), QuickTime Player 10.0 (131)
    I've got a Keynote presentation that I'd like to have as a movie so it can be shared. I want to utilize the "manual advance" feature that pauses the video when specified and waits for a click to advance the slideshow. But when I export (Share>Export>Quicktime), I have trouble getting the movie to play right.
    Without a playback control panel (doesn't appear--and isn't supposed to I gather), after playing around with the magic mouse and keyboard, here's what I get (I can't find an explanation of keyboard shortcuts):
    Just clicking the mouse plays the first slide, then stops the show at the end of that first slide. Clicking again does the same thing. It doesn't advance. The slideshow is designed to go automatically to the next slide and does so in Keynote.
    Scrolling up can forward the video to the next slide or more, but then clicking just plays the first slide again and stops. Scrolling down goes backward in the same way.
    Scrolling left or right while the video is playing lowers or raises the volume.
    Hitting the up arrow key plays it backwards, sound and all. Hitting the down arrow plays it forwards.
    Only after playing it (not just scrolling it--playing it) backwards--then forwards--will it advance to the next slide and work as I hoped it would, pausing at the right places where a click is needed to advance the movie. I found this by accident, but it works repeatedly, even after closing out QuickTime and opening the movie again.
    Can someone please tell me what I'm doing wrong? I'm new to Keynote and don't use QuickTIme for much other than previewing videos. I'm hoping to share this video with many other people who aren't very computer literate, and making many similar videos. I want the other viewers to be able to play the video and just click once in a while (when the video asks them to.)
    I would very much appreciate any help.

    Welcome to the discussions, Christopher.
    Over in the Keynote discussions we've been going over this for quite awhile. Unfortunately, there's no easy solution to your problem. I've even gone as far as attempting to preload the chapter track thinking that might solve the problem, but it doesn't work.
    One thing I don't think I've tried is setting up the first slide to advance "on-click" so that there's no animation before the first transition. The problem, of course, is that there's no "loading" animation to let it know when it's ready to go.
    Another thing I haven't tried but that might work is to create the movie so that it doesn't autoplay, and then, using the embed commands, set autoplay to be the full length of the movie (so that it will automatically play, but only after it's completely downloaded). Look here for the autoplay embed commands.
    http://developer.apple.com/documentation/QuickTime/Conceptual/QTScriptingHTML/QTScripting_HTML_Document/chapter_1000_section3.html

  • Preloader :Error #1009: Cannot access a property or method of a null object reference.

    Hi,
    I'm having a lot of trouble getting a preloader to work on my Flash website. I'm new to actionscript, the site works fine but when I place the preloader in frame 1, I get.
    Error#1009: Cannot access a property or method of a null object reference.
    Then it lists three areas. The buttons on the site don't work anymore.
    I've followed the Lynda com tutorials so don't know what is causing this error.
    Included is the word.doc with the error code, preloader code, the main flash frame 2 code and the debug information.
    Any help would be great.
    Thanks!

    You need to make sure 'cards' is named properly and is present when that line of code executes.  If it is somewhere down a timeline, it is not present.
    As far as your preloader code goes, what is infoLoader.  I have to assume it's some form of component since you don't have any code to instantiate it.

  • Why can't i use special fonts in preloader

    hi,
    im having trouble with embedding a specific font in my
    preloader.
    flash only lets me use device fonts (arial, courier etc.), if
    i try to embed the characters, it wont show anything at all in the
    loader.
    1) html
    2) source
    fla
    thanks for any replies guys!

    In your .fla, you have the dynamic text object in frame 1 of
    the first
    layer. In the second frame, you have an blank keyframe and
    the
    actionscript to control the dynamic text.
    Move that keyframe with the actionscript to a new layer on
    frame 1, you
    should get much better results.
    Rob
    Rob Dillon
    Adobe Community Expert
    http://www.ddg-designs.com
    412-243-9119
    http://www.macromedia.com/software/trial/

  • Using Preloader But Content Not Loading

    Hi.
    Here's the Cliffs Notes version:
    I've a 2 frame movie: Frame 1 is the preloader; Frame 2 a movie clip (web site).
    Both work fine individualy, but the dynamic content I want pre-loaded is not loaded into the movie clip (web site) after the preloader animations.
    Verbose version:
    I'm have a preloader on frame 1 of the timeline. Here's the code:
    stop ();
    this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, onLoading);
    this.loaderInfo.addEventListener (Event.COMPLETE, onComplete);
    function onLoading (evt:ProgressEvent):void
              var loaded:Number = evt.bytesLoaded / evt.bytesTotal;
              percent_txt.text = (loaded * 100).toFixed(0) + "%";
              var counter = (loaded * 100) * 3.6;
              masked_mc.mask = masking_mc;
              masked_mc.rotation = counter;
    //          trace (masked_mc.rotation);
              if (masked_mc.rotation < 0)
                        masked_mc.mask = null;
    function onComplete (event:Event):void
              this.loaderInfo.removeEventListener (ProgressEvent.PROGRESS, onLoading);
              this.loaderInfo.removeEventListener (Event.COMPLETE, onComplete);
              gotoAndStop (2);
    On frame 2 is only a movie clip (a web site).
    In this movie clip on frame 1, I have a dynamic text field into which gets loaded some external text, styled with HTML and CSS.
    At the moment, when a visitor comes to the site for the first time, he can actually see the text load, then see the CSS styles get applied. I would like to use my preloader so that this text loading and styling is completed before they get to see the home page.
    Trouble is the, while the preloader itself works, the HTML and CSS still does not get loaded until after the preloader. This makes sense as the code for calling and loading the HTML/CSS is in the movie clip.
    So I thought, put the code....
    //NEWS --------------------------
    // Load the external .swf "navidNews.swf".
    var navidNewsSWF:String = "assets/fla/navidNews.swf";
    var navidNewsURLRequest:URLRequest = new URLRequest(navidNewsSWF);
    var navidNewsLoader:Loader = new Loader();
    navidNewsLoader.load(navidNewsURLRequest);
    //Put "navidNews.swf" on the stage.;
    newsContainer_mc.addChild(navidNewsLoader);
    into frame 1, same as that for the code for the preloader. But because the empty movie clip into which navidNews.swf is loaded is not in the same frame as the preloader there are errors.
    Okay, move empty movie clip newsContainer_mc into frame 1 with preloader, which will hide the news container.
    What am I missing? Should I not put a movie clip of my web site on frame 2, but instead move the preloader into the web site movie clip, putting it on frame 1?
    I've been playing musical frames with this thing for two days now.......

    load the text and css in frame one (they need not be be used until frame 2) and incorporate those into your preloader.

  • Preloading Delays with exported objects

    I am having some trouble with a game I am creating. When debuging the preloader does not show until about 75% of the movie is loaded. Before this the movie is just a blank white stage. I have several objects that need to be exported and they have all been changed to not export in frame 1 but this did not help. I unlinked the original class (the stage's custom definition) which acted as the bridge between external classes and the main stage and turned that into a variable. After all this I still can't get it to start before 55%. Anyone know why it is doing this? Any help would be greatly appreciated.

    fonts embedded in the authoring environment will be exported in frame 1 and you need to change the frame in which classes are exported, not only by unticking the export in frame one box for library objects, but you also need to change the flash settings:  file/publish settings/flash/settings and change the frame number from 1.

  • Preloader Image Script and Pop-Up Window Behavior

    Hello --
    My client's referring site --
    www.moscaritolo.com/originals.htm. Please note: I am not a
    programmer, but more of a designer and don't possess the skills of
    writing code so in the development of this site for my client, I
    decided to use this preloadslider -
    http://www.dynamicdrive.com/dynamicindex14/preloadslide.htm
    - by Jason Moon to display the images. So far, I really like it and
    so does my client.
    However, I now have a problem with the pop-up window behavior
    for the triptych image on the originals.htm page. When you hit the
    triptych pop-up behavior, the preloader stops working on the main
    page and (#) stays in the address bar even when you've closed the
    pop-up window for the triptypch image. Next, I tried just making
    the word triptych a standard link to a new htm page and using the
    back button on the browser and STILL, the preloader will not work
    properly..? Any ideas..?
    Text

    please code sample ? demo code is enough to try
    with.This has nothing to do with samples. You should know
    which encodings you use. You decalre it in the HTML
    i have not mentioned encoding in the HTML.
    by html encoding , i think you mean this (bold letter)
    // created by dreamweaver 2004
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>
    <body>
    </body>
    </html>if you mean that...NO, I DID NOT USE that thing in my JSP. i deleted that.
    and XML headers. XML encoding, i have this at the start of XML....
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    // XML data
    Java, if nothing else is said, uses
    UTF16.
    in my form i have method="post".And what do you receive? What does "corrupted" mean?
    Not well-formed? Garbage characters? Truncated?error message: [STDOUT] xmlStringelectric.xml.ParseException: java.io.IOException: could not find 59 line 1, char 46682:
    NO, i dont blame my parser. if i provide the XML seperately, then my parser works fine.
    but when i send the XML via JSP to the parser it does not work.
    that means sending of XML is making some trouble.

Maybe you are looking for

  • Moving Photos in LR 4

    I have installed a new H/D and want to make it a dedicated photo drive and scratch disk for CS5. I moved my cataolog onto the new drive and I had to have LR "point" to the new location in order to open so that's all good now. What's the procedure to

  • $PROFILES$.FILENAME, $PROFILES$.PRINTER and $PROFILES$.CONC_COPIES

    Hello All, I am developing BI Publisher reports. One of my requests is to auto print the generated output(PDF) file. When I asked the client to use normal printing functionality from concurrent manager, they said it requires user level profile option

  • ABAP-Workflow : which way to send email after creating Purchase Order ?

    Hi expert, I'm a new workflow so I have not  understood about workflow . Please help me ... Today, I have recieved a request from client as below:    +    SAP system auto send a email to USER B after  creating Purchase Orders by User A.    *++.  USer

  • HT5527 Why can I not share files anymore now that MobileMe is gone?

    Previously, I could send large files to clients via links with MobileMe. I cannot find how to do this anymore. Is this option still available?

  • Generating Master Data Export DataSources Error

    Hi Guys    I 0VENDOR info object to be exported to other BI system . Iam using Generating Master Data Export DataSources. When I right click on 0vendor and say Generate export data source it shoud create 80VENDORM , 80VENDORT. But when I am doing tha