A Flash Developer Resource Site

Page 9 of 9 FirstFirst ... 56789
Results 161 to 172 of 172

Thread: loaded Movies and preloaders

  1. #161

    Trying to Use Milosav's example3 without loading from a button - HELP

    Hi,

    Millsav, I am using you third exmple of creating a preloader to load in all my top level movies.

    I'm not loading from a button, and when I but in the code in the 1st frame of my movie, dataLoaded and dataTotal =0. They never get bigger so the test condition doesn't work.

    First I tried to put it into the OnEnterFrame method, but it didn't work either. Then I decided to create an emptyMC on my main movie called "LoaderMC" which will do all the loading OnClipEvent (load), but that didn't work either.

    For purposes of simplicity, here is the code I put in the 1st frame of my main.swf. Not sure if this needs to be in onEnterFrame. I'm even using your movie1. Should I be able to pass the name of the container create, ex dancers to dataCheck?

    //DancersMC does get created and the debugger says the URL for this MC is "Movie1_P3.swf
    //however, dataLoaded and dataTotal stay at 0.

    stop ();
    //load in all the movies.

    this.createEmptyMovieClip("dancers",100);
    loadMovie("Movie1_P3.swf","dancers");
    dancers._x = 50;
    dancers._y = 150 ;

    loaderInterval=setInterval(dataCheck ,100);

    //function to check amount of data recieved
    function dataCheck(){

    //number of bytes loaded of "holder.swf"
    dataLoaded= dancers.getBytesLoaded();
    //number of bytes Total of "holder.swf"
    dataTotal= dancers.getBytesTotal();
    trace (dataTotal);
    if(dataLoaded>=dataTotal && dataLoaded>0)
    {

    //play "holder.swf" which is now loaded into Movie Clip instance "holder.swf"
    trace ("i am in");
    dancers.gotoAndPlay(2); //

    clearInterval(loaderInterval);
    }

    }


    thanks in advance,

    Lisa

  2. #162

    Wierd but I got it to work with the following code

    Hi,

    I got it to work with a LoaderMC on the main.swf. I was having problem calling using play (); and ended up changing it to gotoAndPlay (2); I wonder if that is because I have an MC on frame 2. I also have to put this.intromc.play (); on frame 2 of my external .swf to get the introMC to play.

    The code on the LoaderMC is:

    Right now there is no animation. I wanted to get the basics to work first. I'll add an animation later. This is an example of loading only one external .swf, but will be calling others in the future. Also, I am going to try to pass an argument to dataCheck for better streamling.

    onClipEvent (load) {

    //load in all the movies.

    _root.createEmptyMovieClip("dancers",100);
    loadMovie("dancers2.swf", _root.dancers);
    _root.dancers._x = 50;
    _root.dancers._y = 150 ;

    loaderInterval=setInterval(dataCheck ,100);

    //function to check amount of data recieved
    function dataCheck(){

    //number of bytes loaded of "holder.swf"
    dataLoaded= _root.dancers.getBytesLoaded();
    //number of bytes Total of "holder.swf"
    dataTotal=_root.dancers.getBytesTotal();

    if(dataLoaded>=dataTotal && dataLoaded>0)
    { //make loader Bar invisible
    // _level4._visible=false;
    //play "holder.swf" which is now loaded into Movie Clip instance "holder.swf"

    _root.dancers.gotoAndPlay (2);
    //reset movieLoading flag to false
    //movieLoading=false;
    //stop the loaderInterval
    clearInterval(loaderInterval);
    }
    //scale the progress bar.
    //_level4.theBar._xscale=(dataLoaded/dataTotal)*100;
    }
    }

    So much more to do, I'll be posting again when problems arise. I hope this thread continues.

    Lisa

  3. #163
    Senior Member
    Join Date
    Nov 2002
    Posts
    195
    Hi Lisa,

    Have read your other questions and will reply to those soon.

    You say. I got it to work with a LoaderMC on the main.swf.
    This may work but I think it is not needed and in some ways is
    a hack around a simpler method.

    I have attached a couple of files.(the fla's)
    Lisa.swf which loads externalMovie.swf into the
    created MC named "dancers".

    I use this a lot and have yet to have problems with it
    on or off the web (keeping in mind the issues below).

    These files give me a correct byte read with the
    trace(dataLoaded); Give them a shot and let me know if
    they work for you. If not we may be talking a system
    issue.

    There are some things that you should keep in mind as you
    get into loading external Movies.
    1. getBytesLoaded();and getBytesTotal(); can return
    often misleading results I have had reads of -1 both
    on and off the web. This is why the && dataLoaded>0
    addition to the evaluation statement.
    2. It has been noted that "sometimes" script on the First
    Frame can be missed!! This has been bought to the attention
    of Macromedia by Colin Moock (designer of the Moock Flash
    detection API).
    3. I have also found that there are times when a movie clip
    has not been instantiated at the time it's functions or
    properties are called ... even though there is no error
    in the script. ie:
    //create an empty MC
    createEmptyMovieClip("dancers",100);
    dataLoaded=dancers.getBytesLoaded();
    trace(dataTotal);
    trace(dancers);

    The output to this script should be some number representing
    the bytesTotal followed by _level0.dancers.
    But I would not be shocked to see it read:
    -1
    undefined
    I guess what I am saying is your script may not always be at
    fault. Flash is not perfect.

    Anyway check out the files ... let me know if this helps
    and if it changes the issue with your needing to use
    this.intromc.play(); though I have used this hack myself I
    usually have been able to remove it ... when I found the
    real problem.

    Milosav
    Attached Files Attached Files

  4. #164
    D . A . T . A [D]e_LeTe[GR]'s Avatar
    Join Date
    Dec 2002
    Posts
    242

    ->

    Originally posted by milosav
    Hi KGKraeer,

    First i would be carefull using scenes. They can be buggy
    and as your Movie becomes more complex they can become hard
    to handle. When you publish your final .swf all Scenes are
    reduced to one Scene on one timeline. If Scene 1 has 100 Frames
    then Scene 2 would start on Frame 101 ...but you have no control
    over this process. Even Team Macromedia members strongly
    advise against using Scenes. (why they keep them is beyond me,
    they and so many other Flash users avoid them!!!).

    As far as having a preloader that loads multiple .swf files
    yes you can do this. But there are some things you need to
    keep in mind.

    1. Flash will open as many simultaneous connections as it can.
    However most browsers have a limit of four. Mac on Netscape
    apparently has a user set max of 7. This means that:

    loadMovie("movie1.swf","mc1");
    loadMovie("movie2.swf","mc2");
    loadMovie("movie3.swf","mc3");
    loadMovie("movie4.swf","mc4");

    loaderInterval=setInterval(loadChecker,100);

    function loadChecker(){
    dataLoaded=mc1.getBytesLoaded()+mc2.getBytesLoaded ()+
    mc3.getBytesLoaded()+mc4.getBytesLoaded();
    dataTotal=mc1.getBytesTotal()+mc2.getBytesTotal()+
    mc3.getBytesTotal()+mc4.getBytesTotal();

    if(dataLoaded>=dataTotal && dataLoaded > 0)
    { mc1.gotoAndPlay(2);
    mc2.gotoAndPlay(2);
    mc3.gotoAndPlay(2);
    mc4.gotoAndPlay(2);
    clearInterval(loaderInterval);
    }

    //scale your loaderBar (if you placed your loader bar on _leve4)
    _level4.loaderBar._xscale=(dataLoaded/dataTotal)*100;
    }


    /////////////////////end////////////////////////////////

    In the above example due to the fact that the .swf's being
    loaded will be added to the data pipeline when both the
    browser and the bandwidth allows. The dataLoaded and dataTotal
    figures will change as .swfs are pushed into the pipeline.

    So it may not be until say movie3.swf is 70% loaded that you
    get the FULL dataTotal. All this means is that your progress
    bar actually shrinks back when another .swf is pushed into
    the pipeline. You can get around this by adding up the bytes
    in all the .swfs you are loading and hard coding that as your
    dataTotal variable. But you will want to test this to makes
    sure it is an accurate figure. This also means that if you
    update your .swf's and their file size changes you will have to
    go back and alter your preloader code (that would not be much hassle
    as it would all be in one place anyway).

    Basicly if your preloader bar was loaded into _level4 the
    above Example is a working mutiple .swf preloader. Using
    the Flash MX setInterval();

    Any questions ... post back.

    Milosav

    ?
    VERY NICE !

    T H E | E X T R A T E R R E S T R I A L | F L Y
    _______________________________________|

  5. #165
    Hi Milosav,

    The sample flas you createw for me (thank you !!!) were the same as mine except that I have an MC in the external file, which shouldn't make a different. Anyway, today is another day and when I opened up my files that implement the preloader on the 1st frame instead of an empty MC it worked!!!!!

    I'm still interested in see if there is a way to pass a variable to dataCheck. I tried passing the dancerMC but it didn't work. dancer is instatiated as _level0.dancer which is correct. I'll try again.

    From my last posts, I am also going to load in my template from the main swff too instead of having my nav movie to it. I'm going to have a stop (); on the 1st frame and then code in frame 2 which will load in the components based on what the user selects.

    I'll post again if things get sticky.

    Thank you so much.

    Lisa

  6. #166

    Passing an arguement to dataCheck

    Hi,

    Its all about syntax. SetInterval (funtion, interval, arg...) and it works.

    I was calling setInterval like : setInterval (dataCheck (dancers), 100);

    This should be setInterval (dataCheck, 100, dancers);

    cool.

    lisa

  7. #167

    fading buttons in a movie clip

    Hi Milosav,

    Hope you are still around, I was talking to you about this problem I was having with incorporating fade out roll over buttons in a movie clip. I still have not been able to figure out what is wrong. I have put your trace code into one and am now getting an error message(now that I have pulled the menu out of the main file and am just woking on it in its own file).

    Please have a look at it(or anyone else that is knowledgable).

    http://www.thefoundationsite.com/men...st/menubar.zip

    Thanks much, I appreciate any help you can give, i would really like to understand this as I would like to use it in one of my sites if I can figure it out.

    Thanks!

    cf.
    ferg

  8. #168
    Senior Member
    Join Date
    Nov 2002
    Posts
    195
    HI fergsta,
    I got an email for a response but it seems that it is out of
    date ??? not sure what is going on.
    So here is one which covers what seems to be your question.
    But I am afraid I may be answering the wrong question.
    So let me know.

    Here is a .zip file covering your latest question.

    It is a generic function that you can use to load in
    external.swf's.

    It can be called from a button or just by placing the
    function call on a frame (like the example).

    Any questions just let me know. I have not been very active
    on the forum due to other work.

    Milosav
    Attached Files Attached Files

  9. #169

    buttons

    Hi Milosav, yeah, there was a bit of a delay as i got distracted by work as well. I am sorry to bother you again with this, let me know if you are too busy to take a look, not a prob.

    anyway, if you have a chance, you can see from the files I posted above what I refer to. one bar works, the buttons fade, but the other(with the two bars and this a movie clip) the button fade stops working. i need to do the same now with the bar that works, so my fade will stop working there too.

    I thought it was simply an error in referencing the path of the movie clip, but I can't seem to see anywhwere that occurs.

    Thanks!
    ferg

  10. #170
    Junior Member
    Join Date
    Jul 2005
    Posts
    4
    Hi,






    Well I happen to be new to this whole thing, but I am working on a project using Flash. However, I'm having difficulty with the pre-loader I've just recently made for my project, how do I paste my pre-loader with the video without changing the loader itself? I already tried by adding a scene to the end of the load, but that also changed the appearance to the pre-loader, I'm very confused.

  11. #171
    Senior Member foochuck's Avatar
    Join Date
    Aug 2000
    Location
    Estero, FL
    Posts
    522
    whoa this thread just took a 2 year leap!
    Foochuck
    http://www.myspace.com/foochuck

  12. #172
    Junior Member
    Join Date
    Jul 2005
    Posts
    4
    I'd like to add for those of you out there that have a good idea for a film, then visit my website.


    http://www.boltwave.com/inc.html/

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