A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Should I embedded a swf file in html page in order to solve this problem?

  1. #1
    Member
    Join Date
    Dec 2004
    Posts
    59

    Should I embedded a swf file in html page in order to solve this problem?

    I am having a problem getting a background sound to play in all the web browsers.

    Actually what I would like to do is a sound should be played auotmatically once a web page is loaded without clicking on anything to play the sound. I have used the <BGSOUND> tag and this is only works fine in IE, not for other web browsers. So to solve the problem, I have tried a way which is imported the sound in flash and save as swf file then embedded the swf file in html. So could I use this way to do it or is there any way beside this?

    Hope someone could give me some idea.

    Thanks in advance.

  2. #2
    Custom User Title
    Join Date
    Jul 2005
    Location
    TN
    Posts
    45
    You could embed a swf file that streams the sound off the sever--that'll help out with load times. Use this code:

    var variableName :Sound = new Sound();
    variableName .loadSound("path", true);

    The true part answers the question "isStreaming" for flash.

    Hope that helps!
    Last edited by iamdave; 07-26-2005 at 11:41 PM. Reason: Apparently when you put angled brackets around something, it gets removed from the post.

  3. #3
    Member
    Join Date
    Dec 2004
    Posts
    59
    Quote Originally Posted by iamdave
    You could embed a swf file that streams the sound off the sever--that'll help out with load times. Use this code:

    var <variable name>:Sound = new Sound();
    <variable name>.loadSound("<path>", true);

    The true part answer the question "isStreaming" for flash.

    Hope that helps!
    Where should I put in the code that you have suggested?

  4. #4
    Custom User Title
    Join Date
    Jul 2005
    Location
    TN
    Posts
    45
    Well, if all you're doing is creating a swf file to play this audio, then you'll only need one frame in your swf. So just put it all right there. You shouldn't need any more code than that.

  5. #5
    Member
    Join Date
    Dec 2004
    Posts
    59
    Quote Originally Posted by iamdave
    Well, if all you're doing is creating a swf file to play this audio, then you'll only need one frame in your swf. So just put it all right there. You shouldn't need any more code than that.

    I have tried it but nothing is played. Maybe you could help me out by checking my working file.
    Attached Files Attached Files

  6. #6
    Custom User Title
    Join Date
    Jul 2005
    Location
    TN
    Posts
    45
    WAVs won't stream. Has to be MP3 format. I fixed it.
    Attached Files Attached Files

  7. #7
    Member
    Join Date
    Dec 2004
    Posts
    59
    Quote Originally Posted by iamdave
    WAVs won't stream. Has to be MP3 format. I fixed it.
    I have tried with the new working file that you posted here, but still not working. No sound is played when I open the html page.

    Do I need to import the sound in flash and put on the timeline?

  8. #8
    Custom User Title
    Join Date
    Jul 2005
    Location
    TN
    Posts
    45
    Hmm. It worked fine for me when I opened the html file. Are you sure your speakers are on? You can import the sound into flash and have it play that way, however the entire file will have to download before it will play, which really isn't that big of a deal in this case. When you said 'background sound' I just assumed you meant some kind of ambient sound and that the file size would be fairly large, but the sound you're using is pretty small so it shouldn't make a difference. That's what I get for assuming. However, if you can't hear the sound now, it may not work for you that way either. I'm really not sure what the problem is at this point, since I had no problems with it on my machine.

  9. #9
    Member
    Join Date
    Dec 2004
    Posts
    59
    Quote Originally Posted by iamdave
    Hmm. It worked fine for me when I opened the html file. Are you sure your speakers are on? You can import the sound into flash and have it play that way, however the entire file will have to download before it will play, which really isn't that big of a deal in this case. When you said 'background sound' I just assumed you meant some kind of ambient sound and that the file size would be fairly large, but the sound you're using is pretty small so it shouldn't make a difference. That's what I get for assuming. However, if you can't hear the sound now, it may not work for you that way either. I'm really not sure what the problem is at this point, since I had no problems with it on my machine.

    The sound is played if I opened the swf file, but for HTML file is not.

    By the way, could you upload again the working file that you have done here?

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