
May 28th, 2009, 12:09 AM
|
|
Registered User
|
|
Join Date: May 2009
Posts: 6
Time spent in forums: 38 m 16 sec
Reputation Power: 0
|
|
hi
Quote: | Originally Posted by justTom Here's the situation. If I use Publish Setting and choose a different folder for the .swf and .html file that Flash CS3 will be generating then the audio/sound will not work when open the .html file in a browser. However, if I choose to the "Publish" option or "Publish Setting" but choose the same folder for the .html and .swf folder then the sound will work when opening the .html file inside a browser. But there is a problem with this approach. In my website, here's the file structure:
Here's the code in the flash file for loading the audio file.
Code:
//start of sound section is for sound
var soundReq:URLRequest = new URLRequest("audioFiles/myBGMusic.mp3");
var sound:Sound = new Sound();
sound.load(soundReq);
sound.addEventListener(Event.COMPLETE, onComplete);
//end of sound section
function onComplete(event:Event):void
{
sound.play();
}
Ultimately, I want to embed the .swf in my .aspx page. Here's what I have in my .aspx page. The flash plays fine but no sound/audio when it should.
Code:
<head runat="server">
<title>Untitled Page</title>
<script src="scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<Bewise:FlashControl ID="FlashControl1" runat="server"
AlternativeImage="~/FlashFiles/e-Solicitations.gif" Height="400px"
MovieUrl="~/FlashFiles/e-Solicitations.swf" Width="375px"
XHTMLcompliant="True" />
</div>
</form>
</body>
The site file structure as shown above. Any suggestion is much appreciated. |
if you just import the sound file manually into flash's library (file>import>to library) then right click it in your library and hit "linkage", check off "export for actionscript" and "export in first frame" and give it a linkage instance name, then you can refer to it in actionscript from the library rather than from an external folder. all you have to do is use this:
mySound = new Sound();
mySound.attachSound("linkage_name");
on (whatever the trigger is) {;
_root.mySound.start();
}
just use anything you want in place of mySound.
i don't know if that's what you're looking for, but that's one way to refer to a sound thats in the library.
|