A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: unloading " #include "mp3Player.as" "

  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    59

    unloading " #include "mp3Player.as" "

    hi,

    As my title indicates, I need to figure out how to unload the song on a certain keyframe of my movie.

    It loads for the main menu, but as I move to a specific frame (call it frame 2) I would like to unload it, but even if i get rid of the action script on frame 2 it still plays the song, ... problem is frame 2 contains a movie with it's own music..

    is there a command such as
    #disclude "mp3Player.as"

    thanks for the help!

  2. #2
    Senior Member
    Join Date
    Aug 2007
    Posts
    291
    Can you post your code?

  3. #3
    Member
    Join Date
    Nov 2007
    Posts
    59
    well the code is saved as a .as file

    so in my movie clip the only code I use is: #include "mp3Player.as"
    soo.. I was hoping to find out how to basicaly undo the 'include' command.. If it would help you I could upload the .as files, but I'm not sure if they are connected to my problem

  4. #4
    Senior Member
    Join Date
    Aug 2007
    Posts
    291
    Quote Originally Posted by mauriceamadeus
    well the code is saved as a .as file

    so in my movie clip the only code I use is: #include "mp3Player.as"
    soo.. I was hoping to find out how to basicaly undo the 'include' command.. If it would help you I could upload the .as files, but I'm not sure if they are connected to my problem
    Well, I just meant that you could just copy and paste the code from the as file, but it doesn't really matter.

    I think there's a command called "stopAllSounds" or something like that. Give that a whirl.

    You could also add a conditional to the MP3player.as file so that it only plays if certain conditions are true. For instance:

    PHP Code:

    if(toggler == 1)
    {
        
    call the function that plays the music;
    }
    else
    {
         do 
    nothing;

    Then, you could set the "toggler" variable inside that AS file as ONE to start with and once you move to the second frame of the timeline, you can have the timeline set the toggler variable as ZERO and run the stopallsounds command. That might work for you.

  5. #5
    Senior Member Kirill M.'s Avatar
    Join Date
    May 2002
    Location
    Toronto, Canada
    Posts
    711
    You can't disclude an included as file. Using the #include directive actually tells the compiler "Take all the code in that file over there and shove it all in here", so it gets included inside the swf at compile time, it's not loaded dynamically while the swf is running. Try doing what Taidaishar said, I just wanted to clear this up for you so that you know what that piece of code does.

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