-
-
Save PowZone/3b6a0edccb36f948c28e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import flash.display.Sprite; | |
import flash.events.Event; | |
import flash.events.NetStatusEvent; | |
import flash.events.UncaughtErrorEvent; | |
import flash.media.Sound; | |
import flash.media.SoundTransform; | |
import flash.net.NetConnection; | |
import flash.net.NetStream; | |
public class PlayM4A extends Sprite { | |
private var nc:NetConnection; | |
private var ns:NetStream; | |
private var st:SoundTransform; | |
public function PlayM4A():void { | |
nc = new NetConnection(); | |
nc.connect(null); | |
ns = new NetStream(nc); | |
//これしないとエラーでる | |
ns.client = { | |
onXMPData: function(data:Object):void { }, | |
onMetaData: function(data:Object):void { } | |
} | |
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); | |
ns.play("MySound.m4a"); | |
st = ns.soundTransform; | |
st.volume -= 0.3; | |
ns.soundTransform = st; | |
} | |
private function netStatusHandler(e:NetStatusEvent):void { | |
trace(e.info.code); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment