Created
November 29, 2010 22:17
-
-
Save anonymous/720736 to your computer and use it in GitHub Desktop.
mari_1
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.MovieClip; | |
import flash.events.Event; | |
import flash.utils.*; | |
import flash.events.*; | |
import flash.display.Sprite; | |
import flash.events.MouseEvent; | |
import flash.net.navigateToURL; | |
import flash.net.URLRequest; | |
import tv.ustream.viewer.logic.Logic; | |
import tv.ustream.viewer.logic.media.Channel; | |
import tv.ustream.viewer.logic.media.Media; | |
import flash.external.ExternalInterface; | |
public class Main extends MovieClip | |
{ | |
private var viewer:Logic; | |
public var checker1:Channel = new Channel('6014465',true); | |
private var displayNum:int; | |
private var flg1:int = 0; | |
public var cm1:MovieClip = new mov_cm1(); | |
private var timer1:Timer = new Timer(2000,1); | |
// public var live1:MovieClip = new mc_live1(); | |
// public var live2:MovieClip = new mc_live2(); | |
// public var live3:MovieClip = new mc_live3(); | |
public function Main():void{ | |
if (stage){ | |
onAddedToStage(); | |
}else{ | |
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); | |
} | |
displayNum = 5; | |
cm1.width = 400; | |
cm1.height = 300; | |
timer1.addEventListener(TimerEvent.TIMER, Checker1); | |
timer1.start(); | |
bt_display.addEventListener( MouseEvent.CLICK , onClick ); | |
} | |
public function ChangeDisplay(channel:Number):void{ | |
if(viewer){viewer.destroy();} | |
viewer = new Logic(); | |
viewer.display.width = 400; | |
viewer.display.height = 300; | |
viewer.muted = true; | |
viewer.createChannel('6014465',true); // Display1:2953923 | |
} | |
public function onClick ( event:MouseEvent ) { | |
// URLRequestを設定 | |
// var url:URLRequest = new URLRequest( "display1.html" ); | |
// 実際にページに飛ぶ | |
// navigateToURL(url,'_self'); | |
ExternalInterface.call("function(){ javascript:changeDisplay(" + displayNum.toString() + "); }"); | |
} | |
private function onAddedToStage(...e):void | |
{ | |
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); | |
// | |
// display2: 3127344 | |
// display3: 3041721 | |
// live1.x = live2.x = live3.x = 10; | |
// live1.y = live2.y = live3.y = 10; | |
// this.display1.addChild(live1); | |
// this.display2.addChild(live2); | |
// this.display3.addChild(live3); | |
} | |
public function Checker1(e:TimerEvent){ | |
if(checker1.online == true && flg1 == 0){ | |
addEventListener(Event.COMPLETE, ChangeDisplay(1)); | |
display1.addChild(viewer.display); | |
flg1 = 1; | |
}else if(checker1.online == true && flg1 == -1){ | |
display1.removeChild(cm1); | |
addEventListener(Event.COMPLETE, ChangeDisplay(1)); | |
display1.addChild(viewer.display); | |
flg1 = 1; | |
}else if(checker1.online == false && flg1 == 0){ | |
display1.addChild(cm1); | |
flg1 = -1; | |
}else if(checker1.online == false && flg1 == 1){ | |
if(viewer){viewer.destroy();} | |
display1.removeChild(viewer.display); | |
display1.addChild(cm1); | |
flg1 = -1; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment