A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [Resolved] Re: How to Preload Sound Objects that use attachSound

Hybrid View

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Location
    Boston, MA
    Posts
    9

    Re: How to Preload Sound Objects that use attachSound

    I am trying to adapt the info from www.kennybellew.com/tutorial for a site that i'm working on...

    I have a movie that loads a secondary movie into level10. This secondary movie has buttons that I need to play sound clips when pressed. I have followed the tutorial (How to preload sound objects that use the attachSound method) up to step 3. So what I have now is the secondary movie with an empty movie clip off stage and a movie clip on stage which loads the sound objects into the off stage cllp.

    My question is this...Do I need the 2nd preloader script mentioned in step 3 that directly refers to the sound or will the preloader that i have in the first frame of the _root timeline recognize whether or not the sound has been fully loaded? The movie clip to load the sound is on frame 2 of the _root timeline.

    Hopefully that's clear for someone...I'm pretty new at this actionscripting stuff and really need some help here...thanks much...

    www.kennybellew.com/tutorial

  2. #2
    Junior Member
    Join Date
    Oct 2004
    Location
    Boston, MA
    Posts
    9
    or...could my current preloader be modified to recognize whether or not the sound objects are fully loaded?

    This is my current preloader script:

    Frame1

    _parent.stop();


    Frame2

    kBytesLoaded = _parent.getBytesLoaded()/1024;
    kBytesTotal = _parent.getBytesTotal()/1024;
    kBytesRemaining - kBytesTotal - kBytesLoaded;
    percentLoaded = 100 * kBytesLoaded / kBytesTotal;
    loadBar._xScale = percentLoaded;

    Frame3

    if (percentLoaded < 99){gotoAndPlay(2);}
    else {_parent.play();
    stop();}

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Don't quite understand what you're getting at... But if you're using attached soundObjects in your movie which is then loaded on level 10 of another main movie, a generic preloader within your main movie would preload the whole of the movie loaded on level 10, without the need of extra preloaders to preload the sounds within the loaded movie...

  4. #4
    Junior Member
    Join Date
    Oct 2004
    Location
    Boston, MA
    Posts
    9
    ok...I have actually figured out something completely different...

    I have added the sound clips to frames2-5 (Sync is set to Stop)...my preloader is on frame1...I have then defined my sound objects on frame 6 and I have turned off "Export in First Frame" for each sound...this way the sounds load with the rest of the movie but do not play until they are called to from my buttons...

    Now...this seems to work perfectly when I test my movie or I open the swf directly but I have uploaded the site and the sounds do not play...any ideas? I am on a Mac using FlashMX 2004 Pro...

    the site is http://www.paulyalen.com/flash.html
    choose "Paul's Work" and then "Song Titles and Audio clips"
    Last edited by wademi; 10-15-2004 at 08:52 PM.

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You've now lost me completely!

  6. #6
    Junior Member
    Join Date
    Oct 2004
    Location
    Boston, MA
    Posts
    9
    sorry about that...I got the idea from this thread...

    Originally posted by SpockBert
    Rob

    Yeah you've unchecked "exported in 1st frame" so your preloaders work without any delay, problem is now your sounds aren't cached so when Flash goes to attach the sounds they're not loaded.

    Your problem can be solved real easy, if your uncheck "export in 1st frame" you need to have your sounds somewhere in the movie BEFORE the frame where your attachSound code is.

    I know what you're thinking, don't want them to play first but what you do is put the sounds early on in the movie (so that they preload along with everything else) but on the sound frame have the sync set to "stop" its usually set to "event" by default.

    Having it on "stop" means the sound will never actually play, so you won't even know its there, but having the sounds cached means when you go to attachSounds later on it will work.
    Basically, my secondary movie works just fine when I test it alone...the preloader loads all of the sound and graphics and everything and the sounds play just fine...the problem is when that secondary movie is loaded into my main movie on level10...for some reason this makes the sound not work...

    hopefully that helps you...

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