A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Variable names of Loaded MCs ?-- Help Please!

  1. #1
    -Web Boy
    Join Date
    Jul 2001
    Location
    Olympia, Wash.
    Posts
    65

    Variable names of Loaded MCs ?-- Help Please!



    What is the variable name of the movies that you load?

    I'm trying to make an "index" movie pre-load for each loaded movie, but I can't get the
    code:
    getBytesTotal

    and
    code:
    getBytesLoaded

    parts to work....

    I load the movies like this:
    code:

    loadMovie(NewMovie,emptyMC);



    And "NewMovie" is defined by what button you click.

    HELP PLEASE!

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    your post is really confusing...

    If you want to load an external file you use, like you wrote:
    code:

    loadMovie(NewMovie,emptyMC);
    // or preferably:
    emptyMC.loadMovie(NewMovie);


    Now, NewMovie, has to be a variable that stores the name of the external movie, something like:
    code:

    NewMovie = "external.swf"


  3. #3
    -Web Boy
    Join Date
    Jul 2001
    Location
    Olympia, Wash.
    Posts
    65
    hi,

    your post is really confusing...

    If you want to load an external file you use, like you wrote:
    code:

    loadMovie(NewMovie,emptyMC);
    // or preferably:
    emptyMC.loadMovie(NewMovie);


    Now, NewMovie has to be a variable that stores the name of the external movie, something like:
    code:

    NewMovie = "external.swf"

    Yes, I thought that was obvious.

    But what is the variable name of this/any loaded movie?

    How can I find the TotalBytes and BytesLoaded?
    Last edited by phallex; 11-13-2003 at 03:37 PM.

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    nope, that wasn't obvious... like I said in the first place.
    How can I find the TotalBytes and BytesLoaded?
    this is!


    To get those values you use the getTotalBytes() and getBytesLoaded() methods of the MovieClip class.
    Something like:
    code:

    var bl = empty_mc.getBytesLoaded();
    var bt = empty_mc.getBytesTotal();


  5. #5
    -Web Boy
    Join Date
    Jul 2001
    Location
    Olympia, Wash.
    Posts
    65

    To get those values you use the getTotalBytes() and getBytesLoaded() methods of the MovieClip class.
    Something like:
    code:

    var bl = empty_mc.getBytesLoaded();
    var bt = empty_mc.getBytesTotal();

    Nope. I tried that, and it doesn't ouput to my text fields (which have the same variable names), and it hangs if I do a loop:
    code:

    NewMovieTotal = emptyMC.getBytesTotal();
    NewMovieLoaded = emptyMC.getBytesLoaded();
    if (NewMovieLoaded == NewMovieTotal){
    gotoAndPlay("continue");
    }
    else{
    gotoAndPlay("load");
    }

    On the "load" frame, I would be loading the movie, and on the "continue" frame, it would stop looping and play the rest of the movie. The Script above would be in-between the two frames.

    But this doesn't work. It just stalls, and doesn't do anything.

  6. #6
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    There are somethings to take in account:
    everything takes sometime before the movie starts loading.
    till then, both NewMovieTotal and
    NewMovieLoaded are undefined (or 0), which mets the second condition, so you have to prevent this from happening

    I hope you don't keep asking flash to load the movie... he understands at first!

    this is the logic:
    code:

    frame1
    emptyMC.loadMovie(NewMovie);
    frame2
    // nothing
    frame3
    NewMovieTotal = emptyMC.getBytesTotal();
    NewMovieLoaded = emptyMC.getBytesLoaded();
    if (NewMovieTotal>4 && NewMovieLoaded >= NewMovieTotal){
    // the movie is loaded
    }
    else{
    gotoAndPlay(2);
    }


    This is how it was done in flash 5, and it's important to get the logic.
    In flash MX onEnterFrame() or setInterval() replace the timeline loop
    And finally, the MovieClipLoader Class, in MX 2004, replaces everything else.

  7. #7
    -Web Boy
    Join Date
    Jul 2001
    Location
    Olympia, Wash.
    Posts
    65
    In flash MX onEnterFrame() or setInterval() replace the timeline loop
    Huh? Timeline Loop? You mean my "if" loop?

    What are these new features and how can I read up on them?

    It's not in the Actionscript Reference in my copy of MX.

  8. #8
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    if() is not a loop (although you can use a in a loop, like in this case)
    a for() or a while()... is a loop

    and here you have a timeline loop, because the same frames are (eventually) played over and over



    onEnterFrame() is a method of the MovieClip Class.
    setInterval() is a global function.

    And I'm sure they are in your reference.

    And here is a quick way to find them:
    just write any of them in the actions panel (in expert mode), click with mouse cursor in the middle of the words, and then press SHIFT+F1

  9. #9
    -Web Boy
    Join Date
    Jul 2001
    Location
    Olympia, Wash.
    Posts
    65
    http://www.rightsys.com/temp/screen.jpg

    Well, you can't blame me for not knowing.

  10. #10
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    don't double click the onEnterFrame(), just click it (in order not to select it, but to leave the cursor there)

    anyway, in the reference panel, if you use the index and look for MovieClip.onEnterFrame(), you'll find it.

    I can see in your picture you have a setProperty(). This is deprecated. Use dot notation instead:
    code:

    follower._rotation = something

    Last edited by nunomira; 11-13-2003 at 11:27 PM.

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