CS5 Flash app has sounds when run locally but it's mute when run in a server
I'm making this small app in Flash CS5 using AS3. Sounds are being reproduced using flash.media.Sound and flash.media.SoundChannel. Locally , everything sound perfect, but when I run the game from a server it just goes mute.
Any hel开发者_JS百科p is apreciated.
Thanks.
It looks like a security issue, you need to use a crossdomain policy file.
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="yourDomainName.com"/>
</cross-domain-policy>
and when loading a Sound , you do this:
private var sound:Sound = new Sound(); private var bufferTime:Number = 1000;// set your bufferTime here // the second argument sets checkPolicyFile to true private var context:SoundLoaderContext = new SoundLoaderContext( bufferTime , true ); //anywhere in your code //assuming you have defined your URLRequest variable. sound.load( request , context );
精彩评论