A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Preloading external SWF?

  1. #1
    Junior Member
    Join Date
    Aug 2000
    Posts
    5

    Arrow

    Hi,

    I'm new to this board & fairly new to Flash (but getting better <heh>). I am working on a Flash site that loads in a music loop via an external movie file (SWF). I worked in a little animation for the music on/off button to appear in my movie, so the problem is this:

    Even though I have the music SWF down to a teensy 17K, I know that some modem users are already having trouble with the animation pausing midway while it waits for the full SWF to load. Browsing around the help sites the other day, I could've sworn I saw something about preloading external SWF's at the beginning of the main movie file, but now I can't seem to locate it. Argh! (Should've bookmarked immediately, I know... )

    So... Is it possible to preload external files? I do have a preloader in place & would like to add the extra SWF to it somehow if possible. If you know of a way to do this, please let me know. If I can preload the file, I can up its size & improve the audio quality a bit.

    Many thanks! And I'll try to be a bit more brief in future posts... <heh>

    -oriain

  2. #2

    Loading external SWF

    That is an option for sure:

    On (Release)
    Load Movie ("name.swf", 1)
    End on

    name.swf is the movie to load
    1 is the level to load the movie in, if you use level 0 it will replace the main movie.

    To unload the movie from it's location (to turn the music off) just use:

    Unload Movie (1)

    1 is the level again...

    Greez,
    Flash.Pro
    http://www.flashpro.nl
    Flash news, tutorials, articles, resources and more...


  3. #3
    Junior Member
    Join Date
    Aug 2000
    Posts
    5
    Thanks for the reply. I'm still a little confused and it's probably b/c I wasn't specific enough in my first post.

    Here's what I want to do:

    1) Load in the music file/SWF at the start of the preloader
    2) Keep the music file stopped until the rest of the preloader finishes (i.e., the full movie downloads)
    3) Begin the main movie and
    4) Begin playing the music file at a specific point during the movie.

    Is this possible? The example you gave made it seem as if I needed a button to begin the loading/playing of the music, but what I'm looking for is a way to have the music begin play automatically -- but just not until everything else in the main movie file is loaded & ready to roll.

    Does that make any sense at all?

    -oriain

  4. #4
    Senior Member
    Join Date
    Mar 2000
    Posts
    123
    Huh I once had the same prob the Method is TO load the Swf and In those Swf Put A two blank keyframes With a preloader on them

    than after the pre loader put the sound loops put in the externel Swf
    and if you want to do it even more smart put in the
    "If frame is loaded "
    Go to The Frame with the sound loop or if you want to start the sound later send it to a frame with no sound and with a stop on it "This line is NOT OPTIONAL"

    and
    set variable loaded=true

    than in the main timeline put the normal preloader and a a If command to check if Loaded=true and if he Equels True play the movie.

    This is pretty complecated so Email Me if you need More help

    And about stoping the sound loop you should not use unload movie cause it will remove the movie from the browser memory
    so put in the externel movie a frame with stop all sounds or just Sync stop and from the of button on the main movie
    Use this line
    On mouse event
    Begin tell target ("_level1") (If this is where you loaded the movie 2.)
    go to frame * *=the number of the frame with the stop sounds command.
    end tell target

    huh forgot if you want to start the loop and a special point
    just chenge the extrenel movie preloader to send flash after the movie has loaded to a frame with no sound and with a top action on it.

    and in the point you want it to play just put an action on the frame you want the sound to start

    On mouse event
    Begin tell target ("_level1") (If this is where you loaded the movie 2.)
    go to frame * *=the number of the frame with the sounds .
    end tell target

    as i said before for more help email me
    and if you still dont get it after the email send the file
    [Edited by BugiMan on 08-10-2000 at 12:44 PM]

  5. #5

    Don't need a button

    The action I gave you could also be attached on a keyframe in the main movie (don't use the on release then ffcourse)...


    Attach it on the second frame off your preloader or attach it on frame 601 (example) in your main movie if you want it to start on fram 601.

    It's a simple!

    Greez,
    Flash.Pro

  6. #6
    Senior Member
    Join Date
    Mar 2000
    Posts
    123
    Hey Flash.Pro I think the use of Unload Movie Here is wrong cause it will delete the sound loop from the CaHCeH
    If he dont want to tell target the level and send it to a frame WIth a stop sounds on it He sould load an empty movie to the level And it will not remove the movie from the Cahceh trust me on this

  7. #7
    Junior Member
    Join Date
    Aug 2000
    Posts
    5
    Thanks for the help guys. Just so you know, I tried the Tell Target method but eventually gave up. This is a long message -- sorry but I thought you might want to here how things went...

    I had the music movie load during the preloader (level 1), but had a stop frame at the beginning of it. Then, during an intro sequence, I put in a Tell target to "_level1" (Go to & play 2). That seemed to work fine.

    However, I had a second movie that came in when the user entered a specific section of the site. It was a simple 1K text message that said "Music disabled." This loaded on level 2. I did this b/c there were a number of external links on this page & each led to other Flash movies w/their own music (so I didn't want mine to interfere or clash).

    THEN... I had a second version of the main menu screen that users would see when returning from the "music disabled" section. It turned the music back on automatically. SO... I put in the same Tell Target commands for level 1 here. As part of these commands, I had the alpha of level 1 or level 2 (whichever I needed to blank) go to zero. That eliminated the unload movie problem (I thought...)

    BUT... Weird, weird crap happened with this setup. When I ran the SWF locally on my own machine, it worked *perfectly* -- no problems whatsoever. But when I ran the Flash-generated HTML document containing the SWF, the music file wouldn't always run at the beginning of the main movie. In fact, it ran once every 2 or 3 times I tried it. Even more bizarre, I tested the file online with three computers & all 3 experienced something different. On a Mac, the first music movie & the "music disabled" file loaded fine, but the second call of the music movie would not work. On my main machine over a 56K modem connection, the first music file would not load, but the disabled & second music calls worked fine. Over my cable modem connection, everything worked, but not every time I accessed the page.

    This got way too bizarre for me to handle without injuring friends & neighbors, so I just took all of the Tell Target stuff out for now... I'm going to try just doing a small movie that does nothing but load two external files & see if I can make it all work on a smaller scale. Maybe then I'll put it back in my big, loose-coded portfolio project.

    Thanks again for your help. I'll post again if I can ever figure out what went wrong on this end!

    -mike

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