Created
November 18, 2010 11:27
-
-
Save miminashi/704874 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
<?xml version="1.0" encoding="utf-8"?> | |
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete(event)"> | |
<mx:Script> | |
<![CDATA[ | |
import mx.binding.utils.ChangeWatcher; | |
import mx.core.UIComponent; | |
import flash.system.Security; | |
import flash.system.SecurityDomain; | |
import tv.ustream.viewer.logic.Logic; | |
private var channelIds:Object = { | |
1:'624019', | |
2:'6290718' | |
}; | |
private var viewer:Logic; | |
private var uicomp:UIComponent = new UIComponent(); | |
private function onCreationComplete(event:Event):void | |
{ | |
loadRsl(); | |
} | |
private function loadRsl():void | |
{ | |
var context:LoaderContext; | |
var loader:Loader; | |
// ViewerのURL | |
var viewerRsl:String = 'http://www.ustream.tv/flash/viewer.rsl.swf'; | |
Security.allowDomain('*'); | |
context = new LoaderContext(false, ApplicationDomain.currentDomain); | |
loader = new Loader(); | |
// 読み込みが完了した際に呼ばれるイベントハンドラを登録 | |
loader.contentLoaderInfo.addEventListener('complete', onLoadComplete); | |
loader.load(new URLRequest(viewerRsl), context ); | |
} | |
private function onLoadComplete(event:Event):void | |
{ | |
changeChannel(1); | |
} | |
private function changeChannel(channel:Number):void | |
{ | |
if(viewer) | |
{ | |
viewer.destroy(); | |
} | |
viewer = new Logic(); | |
viewer.display.x = 0; | |
viewer.display.y = 0; | |
viewer.display.width = 320; | |
viewer.display.height = 240; | |
uicomp.addChild(viewer.display); | |
videoDisplay.addChild(uicomp); | |
viewer.createChannel(channelIds[channel]); | |
} | |
private function onDisplay1Clicked(event:Event):void | |
{ | |
changeChannel(1); | |
} | |
private function onDisplay2Clicked(event:Event):void | |
{ | |
changeChannel(2); | |
} | |
]]> | |
</mx:Script> | |
<mx:Canvas x="10" y="10" width="320" height="240" id="videoDisplay" borderStyle="none" borderThickness="0" borderColor="#000000" backgroundColor="#000000"> | |
</mx:Canvas> | |
<mx:Button x="345" y="48" label="Display1" click="onDisplay1Clicked(event)"/> | |
<mx:Button x="345" y="78" label="Display2" click="onDisplay2Clicked(event)"/> | |
<mx:Button x="345" y="108" label="Dispaly3"/> | |
<mx:Button x="345" y="138" label="Dispaly4"/> | |
<mx:Button x="345" y="168" label="Display5"/> | |
<mx:Button x="345" y="198" label="Display6"/> | |
<mx:Button x="345" y="228" label="Display7"/> | |
<mx:Text x="345" y="14" text="*" width="75" height="21" textAlign="center" fontSize="18" fontWeight="bold"/> | |
</mx:Application> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment