Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /NNDDv2/trunk/src/org/mineap/nndd/view/VideoInfoView.as

Parent Directory Parent Directory | Revision Log Revision Log


Revision 490 - (hide annotations) (download)
Sun Apr 10 03:38:54 2011 UTC (12 years, 11 months ago) by mineap
File size: 51049 byte(s)
InfoViewの投稿者タブに投稿者名/アイコン/ユーザIDを表示するようにした
1 mineap 370 /**
2     * VideoInfoView.as
3     *
4     * Copyright (c) 2008-2009 MAP - MineApplicationProject. All Rights Reserved.
5     *
6     * @author shiraminekeisuke
7     *
8     */
9    
10     import flash.events.Event;
11     import flash.events.MouseEvent;
12     import flash.events.NativeWindowBoundsEvent;
13     import flash.events.TextEvent;
14     import flash.geom.Rectangle;
15     import flash.utils.Timer;
16    
17     import mx.collections.ArrayCollection;
18     import mx.collections.Sort;
19     import mx.collections.SortField;
20     import mx.controls.Alert;
21     import mx.controls.CheckBox;
22     import mx.controls.DataGrid;
23     import mx.controls.HSlider;
24     import mx.controls.RadioButton;
25     import mx.core.Application;
26     import mx.core.DragSource;
27     import mx.events.AIREvent;
28     import mx.events.CloseEvent;
29     import mx.events.DataGridEvent;
30     import mx.events.DragEvent;
31     import mx.events.FlexEvent;
32     import mx.events.ListEvent;
33     import mx.events.SliderEvent;
34    
35 mineap 439 import org.mineap.nicovideo4as.model.SearchType;
36 mineap 370 import org.mineap.nndd.LogManager;
37     import org.mineap.nndd.Message;
38     import org.mineap.nndd.model.NNDDVideo;
39     import org.mineap.nndd.model.PlayList;
40     import org.mineap.nndd.model.SearchItem;
41     import org.mineap.nndd.model.SearchSortString;
42     import org.mineap.nndd.playList.PlayListManager;
43     import org.mineap.nndd.player.PlayerController;
44     import org.mineap.nndd.util.PathMaker;
45     import org.mineap.util.config.ConfUtil;
46     import org.mineap.util.config.ConfigManager;
47 mineap 439 import org.mineap.util.font.FontUtil;
48 mineap 370
49     private var videoPlayer:VideoPlayer;
50     private var playerController:PlayerController;
51     private var logManager:LogManager;
52    
53     public var isPlayListRepeat:Boolean = false;
54     public var isSyncComment:Boolean = true;
55     public var isPlayerFollow:Boolean = true;
56     public var isRenewCommentEachPlay:Boolean = false;
57     public var isRenewOtherCommentWithCommentEachPlay:Boolean = false;
58     public var isResizePlayerEachPlay:Boolean = true;
59     public var isHideUnderController:Boolean = false;
60     public var commentScale:Number = 1.0;
61     public var fps:Number = 15;
62     public var isShowOnlyPermissionComment:Boolean = false;
63     public var showCommentCount:int = 250;
64     public var showCommentSec:int = 3;
65     public var isAntiAlias:Boolean = true;
66     public var commentAlpha:int = 100;
67     public var isEnableJump:Boolean = true;
68     public var isAskToUserOnJump:Boolean = true;
69     public var isInfoViewAlwaysFront:Boolean = false;
70     public var isCommentFontBold:Boolean = true;
71     public var isShowAlwaysNicowariArea:Boolean = false;
72     public var selectedResizeType:int = RESIZE_TYPE_NICO;
73     public var isAlwaysEconomyForStreaming:Boolean = false;
74     public var isHideTagArea:Boolean = false;
75     public var isAppendComment:Boolean = false;
76     public var isHideSekaShinComment:Boolean = false;
77     public var isShowHTMLOwnerComment:Boolean = true;
78     public var isEnableWideMode:Boolean = true;
79     public var relationSortIndex:int = 0;
80     public var relationOrderIndex:int = 0;
81     public var isNgUpEnable:Boolean = true;
82 mineap 487 public var isSmoothing:Boolean = true;
83 mineap 370
84     public static const RESIZE_TYPE_NICO:int = 1;
85     public static const RESIZE_TYPE_VIDEO:int = 2;
86    
87     public var videoUrlMap:Object = new Object();
88    
89     public var myListMap:Object = new Object();
90    
91     private var lastRect:Rectangle = new Rectangle();
92    
93     private var seekTimer:Timer;
94     private var seekValue:Number = 0;
95    
96     public var isActive:Boolean = false;
97    
98     public var playListName:String = "";
99    
100     [Bindable]
101     public var commentListProvider:ArrayCollection = new ArrayCollection();
102     [Bindable]
103     public var ownerCommentProvider:ArrayCollection = new ArrayCollection();
104     [Bindable]
105     private var playListProvider:ArrayCollection = new ArrayCollection();
106     [Bindable]
107     public var localTagProvider:Array = new Array();
108     [Bindable]
109     public var nicoTagProvider:Array = new Array();
110     [Bindable]
111     public var ichibaLocalProvider:ArrayCollection = new ArrayCollection();
112     [Bindable]
113     public var ichibaNicoProvider:ArrayCollection = new ArrayCollection();
114     [Bindable]
115     public var ngListProvider:ArrayCollection = new ArrayCollection();
116     [Bindable]
117     public var owner_text_nico:String = "";
118     [Bindable]
119     public var owner_text_local:String = "";
120     [Bindable]
121     private var myListDataProvider:Array = new Array();
122     [Bindable]
123     public var savedCommentListProvider:Array = new Array();
124     [Bindable]
125     public var owner_text_temp:String = "";
126     [Bindable]
127     public var relationDataProvider:ArrayCollection = new ArrayCollection();
128     [Bindable]
129     public var relationSortComboboxDataProvider:Array = new Array("���������������", "���������������", "���������", "���������");
130     [Bindable]
131     public var relationOrderComboboxDataProvider:Array = new Array("������", "������");
132     [Bindable]
133     private var label_playListTitle_dataProvider:String = "";
134 mineap 484 [Bindable]
135     public var videoType:String = "";
136     [Bindable]
137     public var connectionType:String = "";
138     [Bindable]
139     public var videoServerUrl:String = "";
140     [Bindable]
141     public var messageServerUrl:String = "";
142 mineap 490 [Bindable]
143     public var economyMode:String = "";
144     [Bindable]
145     public var nickName:String = "";
146     [Bindable]
147     public var isPremium:String = "";
148     [Bindable]
149     public var pubUserNameIconUrl:String = "";
150     [Bindalbe]
151     public var pubUserName:String = "";
152     [Bindalbe]
153     public var pubUserLinkButtonText:String = "";
154 mineap 370
155     public function init(playerController:PlayerController, videoPlayer:VideoPlayer, logManager:LogManager):void{
156     this.videoPlayer = videoPlayer;
157     this.playerController = playerController;
158     this.logManager = logManager;
159    
160     this.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void{
161     stage.addEventListener(AIREvent.WINDOW_ACTIVATE, function(event:AIREvent):void{
162     isActive = true;
163     });
164     stage.addEventListener(AIREvent.WINDOW_DEACTIVATE, function(event:AIREvent):void{
165     isActive = false;
166     });
167    
168     });
169    
170     readStore();
171     }
172    
173     public function resetInfo():void{
174     localTagProvider = new Array();
175     nicoTagProvider = new Array();
176     ichibaLocalProvider = new ArrayCollection();
177     ichibaNicoProvider = new ArrayCollection();
178    
179     owner_text_local = "";
180     owner_text_nico = "";
181     owner_text_temp = "";
182     }
183    
184     private function windowClosing(event:Event):void{
185    
186     event.preventDefault();
187    
188     // if(this.videoPlayer != null && !this.videoPlayer.closed){
189     // this.videoPlayer.close();
190     // }
191     //
192     // this.playerController.destructor();
193    
194     this.visible = false;
195    
196     }
197    
198     private function play():void{
199     this.playerController.play();
200     }
201    
202     private function stop():void{
203     this.playerController.stop();
204     }
205    
206     private function checkBoxAppendCommentChanged(event:Event):void{
207     this.isAppendComment = event.target.selected;
208     Application.application.setAppendComment(this.isAppendComment);
209     }
210    
211     public function setAppendComment(boolean:Boolean):void{
212     this.isAppendComment = boolean;
213     if(checkBox_isAppendComment != null){
214     checkBox_isAppendComment.selected = boolean;
215     }
216     }
217    
218     public function relationItemDoubleClickHandler(event:ListEvent):void{
219     if(relationDataProvider.length > event.rowIndex){
220     var url:String = relationDataProvider[event.rowIndex].col_link;
221     if(url != null && url.length > 0){
222     var videoId:String = PathMaker.getVideoID(url);
223     if(videoId != null){
224     playerController.playMovie(url);
225     }
226     }
227     }
228     }
229    
230     public function checkBoxNgUpChanged(event:Event):void{
231     this.isNgUpEnable = checkBox_isNgUpEnable.selected;
232     if(this.playerController != null){
233     this.playerController.reloadLocalComment();
234     }
235     }
236    
237 mineap 487 public function checkBoxSmoothingChanged(event:Event):void{
238     this.isSmoothing = checkBox_isSmoothing.selected;
239     if(this.playerController != null){
240     this.playerController.setVideoSmoothing(this.isSmoothing);
241     }
242     }
243    
244 mineap 370 private function checkBoxPlayerAlwaysFrontChanged(event:Event):void{
245     this.videoPlayer.isAlwaysFront = (event.currentTarget as CheckBox).selected;
246     this.videoPlayer.alwaysInFront = (event.currentTarget as CheckBox).selected;
247     }
248    
249     private function checkBoxInfoViewAlwaysFrontChanged(event:Event):void{
250     this.isInfoViewAlwaysFront = (event.currentTarget as CheckBox).selected;
251     this.alwaysInFront = (event.currentTarget as CheckBox).selected;
252     }
253    
254     private function checkBoxCommentFontBoldChanged(event:Event):void{
255     this.isCommentFontBold = this.checkBox_commentBold.selected;
256     playerController.setCommentFontBold(this.isCommentFontBold);
257     }
258    
259     private function checkboxSyncCommentChanged():void{
260     this.isSyncComment = this.checkbox_SyncComment.selected;
261     this.commentListProvider.sort = new Sort();
262     this.commentListProvider.sort.fields = [new SortField("vpos_column",true)];
263     this.commentListProvider.refresh();
264     }
265    
266     private function checkboxRepeatAllChanged():void{
267     this.isPlayListRepeat = this.checkBox_repeatAll.selected;
268     if(isPlayListRepeat){
269     videoPlayer.setIsRepeat(false);
270     }
271     }
272    
273     private function checkboxPlayerFollowChanged(event:Event):void{
274     this.isPlayerFollow = this.checkbox_playerFollow.selected;
275     if((event.currentTarget as CheckBox).selected){
276     this.videoPlayer.followInfoView(this.videoPlayer.lastRect);
277     }
278     }
279    
280     private function checkboxHideUnderControllerChanged(event:Event):void{
281     this.isHideUnderController = this.checkbox_hideUnderController.selected;
282     if(this.videoPlayer.stage.displayState != StageDisplayState.FULL_SCREEN_INTERACTIVE){
283     if((event.currentTarget as CheckBox).selected){
284     //������������������������������
285     this.videoPlayer.showUnderController(false, true);
286     }else{
287     //������������������������������
288     this.videoPlayer.showUnderController(true, true);
289     }
290     }
291     this.videoPlayer.videoController.resetAlpha(true);
292     }
293    
294     private function checkboxHideTagAreaChanged(event:Event):void{
295     this.isHideTagArea = this.checkbox_hideTagArea.selected;
296     if(this.videoPlayer.stage.displayState != StageDisplayState.FULL_SCREEN_INTERACTIVE){
297     if((event.currentTarget as CheckBox).selected){
298     //���������������������������
299     this.videoPlayer.showTagArea(false, true);
300     }else{
301     //������������������������������������
302     this.videoPlayer.showTagArea(true, true);
303     }
304     }
305     this.videoPlayer.videoController.resetAlpha(true);
306     }
307    
308     public function changeWideMode():void{
309     if(isResizePlayerEachPlay){
310     if(this.selectedResizeType == VideoInfoView.RESIZE_TYPE_NICO){
311     isEnableWideMode = !isEnableWideMode;
312     if(checkbox_enableWideMode != null){
313     checkbox_enableWideMode.selected = isEnableWideMode;
314     }
315     this.playerController.resizePlayerJustVideoSize(this.videoPlayer.nowRatio);
316     }
317     }
318     }
319    
320     private function checkboxResizePlayerEachPlay(event:Event):void{
321     this.isResizePlayerEachPlay = this.checkbox_resizePlayerEachPlay.selected;
322     radioGroup_resizeType.selectedValue = selectedResizeType;
323     if(this.isResizePlayerEachPlay){
324     this.playerController.resizePlayerJustVideoSize(this.videoPlayer.nowRatio);
325     this.radioButton_resizeNicoDou.enabled = true;
326     this.radioButton_resizeVideo.enabled = true;
327     if(this.selectedResizeType == VideoInfoView.RESIZE_TYPE_NICO){
328     this.checkbox_enableWideMode.enabled = true;
329     }else{
330     this.checkbox_enableWideMode.enabled = false;
331     }
332     }else{
333     this.videoPlayer.nowRatio = -1;
334     this.radioButton_resizeNicoDou.enabled = false;
335     this.radioButton_resizeVideo.enabled = false;
336     this.checkbox_enableWideMode.enabled = false;
337     }
338    
339     }
340    
341     private function checkBoxAlwaysEconomyChanged(event:Event):void{
342     isAlwaysEconomyForStreaming = this.checkBox_isAlwaysEconomyForStreaming.selected;
343     }
344    
345    
346     private function checkBoxShowAlwaysNicowariAreaChanged(event:Event):void{
347     isShowAlwaysNicowariArea = this.checkBox_showAlwaysNicowariArea.selected;
348     videoPlayer.setShowAlwaysNicowariArea(isShowAlwaysNicowariArea);
349     }
350    
351     public function setShowAlwaysNicowariArea(isShow:Boolean):void{
352     if(this.checkBox_showAlwaysNicowariArea != null){
353     this.checkBox_showAlwaysNicowariArea.selected = isShow;
354     }
355     isShowAlwaysNicowariArea = isShow;
356     }
357    
358     private function checkBoxRenewCommentChanged():void{
359     isRenewCommentEachPlay = checkBox_renewComment.selected;
360     checkBox_renewTagAndNicowari.enabled = isRenewCommentEachPlay;
361     checkBox_isAppendComment.enabled = isRenewCommentEachPlay;
362     }
363    
364     private function checkBoxCommentBoldChanged(event:Event):void{
365     this.isCommentFontBold = checkBox_commentBold.selected;
366     playerController.setCommentFontBold(this.isCommentFontBold);
367     }
368    
369     public function setRelationComboboxEnable(enabled:Boolean):void{
370     if(combobox_relationSort != null){
371     (combobox_relationSort as ComboBox).enabled = enabled;
372     }
373     if(combobox_relationOrder != null){
374     (combobox_relationOrder as ComboBox).enabled = enabled;
375     }
376     }
377    
378     private function thumbPress(event:SliderEvent):void{
379     this.playerController.sliderChanging = true;
380     }
381    
382     private function thumbRelease(event:SliderEvent):void{
383     this.playerController.sliderChanging = false;
384     this.playerController.seek(event.value);
385     }
386    
387     private function sliderVolumeChanged(evt:SliderEvent):void{
388     this.playerController.setVolume(evt.value);
389     }
390    
391     private function sliderFpsChanged(event:SliderEvent):void{
392     this.fps = getFps(event.value);
393     this.playerController.changeFps(this.fps);
394     }
395    
396     private function sliderShowCommentCountChanged(event:SliderEvent):void{
397     this.showCommentCount = event.value;
398     }
399    
400     private function addNGListIdButtonClicked():void{
401     var index:int = -1;
402     if(tabNavigator_comment.selectedIndex == 0){
403     index = this.dataGrid_comment.selectedIndex;
404     }else if(tabNavigator_comment.selectedIndex == 1){
405     index = this.dataGrid_oldComment.selectedIndex;
406     }
407     if(index > -1){
408     this.playerController.ngListManager.addNgID(commentListProvider.getItemAt(index).user_id_column);
409     }
410     }
411    
412     private function addNGListWordButtonClicked():void{
413     var index:int = -1;
414     if(tabNavigator_comment.selectedIndex == 0){
415     index = this.dataGrid_comment.selectedIndex;
416     }else if(tabNavigator_comment.selectedIndex == 1){
417     index = this.dataGrid_oldComment.selectedIndex;
418     }
419     if(index > -1){
420     this.playerController.ngListManager.addNgWord(commentListProvider.getItemAt(index).comment_column);
421     }
422     }
423    
424     private function addPermissionIdButtonClicked():void{
425     var index:int = -1;
426     if(tabNavigator_comment.selectedIndex == 0){
427     index = this.dataGrid_comment.selectedIndex;
428     }else if(tabNavigator_comment.selectedIndex == 1){
429     index = this.dataGrid_oldComment.selectedIndex;
430     }
431     if(index > -1){
432     this.playerController.ngListManager.addPermissionId(commentListProvider.getItemAt(index).user_id_column);
433     }
434     }
435    
436     private function headerReleaseHandler(event:DataGridEvent):void{
437     if(event.columnIndex == 1){
438     this.isSyncComment = false;
439     this.checkbox_SyncComment.selected = false;
440     }
441     }
442    
443     /**
444     * TextInput������������������������ID���NG���������������������������
445     *
446     */
447     private function addItemToNgList():void{
448     playerController.ngListManager.addItemToNgList(textInput_ng.text, combobox_ngKind.selectedLabel);
449     }
450    
451     private function ngListItemClicked(event:ListEvent):void{
452     playerController.ngListManager.ngListItemClicked(event);
453     }
454    
455     /**
456     * ���������������������NG���������NG������������������������������������
457     *
458     */
459     private function removeItemFromNgList():void{
460     playerController.ngListManager.removeItemFromNgList();
461     }
462    
463     private function ngTextInputEnter(event:FlexEvent):void{
464     playerController.ngListManager.addItemToNgList(textInput_ng.text, combobox_ngKind.selectedLabel);
465     }
466    
467     private function fpsDataTipFormatFunction(value:Number):String{
468     return new String(getFps(value));
469     }
470    
471     private function getFps(value:Number):Number{
472     switch(value){
473     case 1:
474     return 7.5;
475     case 2:
476     return 15;
477     case 3:
478     return 30;
479     case 4:
480     return 60;
481     case 5:
482     return 120;
483     default:
484     return 15;
485     }
486     }
487    
488     private function getValueByFps(fps:Number):int{
489     switch(fps){
490     case 7.5:
491     return 1;
492     case 15:
493     return 2;
494     case 30:
495     return 3;
496     case 60:
497     return 4;
498     case 120:
499     return 5;
500     default:
501     return 2;
502     }
503     }
504    
505     private function keyListener(event:KeyboardEvent):void{
506     if(event.keyCode == Keyboard.ESCAPE){
507     }else if(event.keyCode == Keyboard.F11 || (event.keyCode == Keyboard.F && (event.controlKey || event.commandKey))){
508     // trace("Ctrl + " + event.keyCode);
509     this.videoPlayer.changeFull();
510     }else if(event.keyCode == Keyboard.C){
511     // trace(event.keyCode);
512     this.stage.nativeWindow.activate();
513     }else if(event.keyCode == Keyboard.SPACE){
514     this.playerController.play();
515     }else if(event.keyCode == Keyboard.LEFT){
516     //���
517     if(seekTimer != null){
518     seekTimer.stop();
519     }
520     seekTimer = new Timer(100, 1);
521     seekTimer.addEventListener(TimerEvent.TIMER_COMPLETE, function(event:Event):void{
522     var newValue:Number = videoPlayer.videoController.slider_timeline.value + seekValue;
523     if(newValue <= (videoPlayer.videoController.slider_timeline as HSlider).minimum){
524     newValue = 0;
525     }else if(newValue >= (videoPlayer.videoController.slider_timeline as HSlider).maximum){
526     newValue = (videoPlayer.videoController.slider_timeline as HSlider).maximum;
527     }
528     trace(newValue +" = "+videoPlayer.videoController.slider_timeline.value +"+"+ seekValue);
529     playerController.seek(newValue);
530     seekValue = 0;
531     });
532     seekTimer.start();
533     this.seekValue -= 10;
534     }else if(event.keyCode == Keyboard.RIGHT){
535     //���
536     if(seekTimer != null){
537     seekTimer.stop();
538     }
539     seekTimer = new Timer(100, 1);
540     seekTimer.addEventListener(TimerEvent.TIMER_COMPLETE, function(event:Event):void{
541     var newValue:Number = videoPlayer.videoController.slider_timeline.value + seekValue;
542     if(newValue <= (videoPlayer.videoController.slider_timeline as HSlider).minimum){
543     newValue = 0;
544     }else if(newValue >= (videoPlayer.videoController.slider_timeline as HSlider).maximum){
545     newValue = (videoPlayer.videoController.slider_timeline as HSlider).maximum;
546     }
547     trace(newValue +" = "+videoPlayer.videoController.slider_timeline.value +"+"+ seekValue);
548     playerController.seek(newValue);
549     seekValue = 0;
550     });
551     seekTimer.start();
552     this.seekValue += 10;
553     }else if(event.keyCode == Keyboard.UP){
554     this.playerController.setVolume(this.videoPlayer.videoController.slider_volume.value + 0.05);
555     }else if(event.keyCode == Keyboard.DOWN){
556     this.playerController.setVolume(this.videoPlayer.videoController.slider_volume.value - 0.05);
557     }
558     }
559    
560     private function radioButtonResizeTypeChanged(event:Event):void{
561     this.selectedResizeType = int(RadioButton(event.currentTarget).value);
562    
563     if(this.selectedResizeType == VideoInfoView.RESIZE_TYPE_NICO){
564     this.checkbox_enableWideMode.enabled = true;
565     }else{
566     this.checkbox_enableWideMode.enabled = false;
567     }
568    
569     this.playerController.resizePlayerJustVideoSize(this.videoPlayer.nowRatio);
570     }
571    
572     private function checkboxEnableWideModeChanged(event:Event):void{
573     this.isEnableWideMode = event.target.selected;
574     this.playerController.resizePlayerJustVideoSize(this.videoPlayer.nowRatio);
575     }
576    
577     private function checkBox_repeatAllCompleteHandler(event:FlexEvent):void{
578     checkBox_repeatAll.selected = isPlayListRepeat;
579     }
580    
581     private function checkBoxIsSOPCChanged(event:MouseEvent):void{
582     isShowOnlyPermissionComment = checkBox_isShowOnlyPermissionComment.selected;
583     if(this.playerController != null){
584     this.playerController.reloadLocalComment();
585     }
586     }
587    
588     private function checkBoxRenewTagNicowariChanged():void{
589     isRenewOtherCommentWithCommentEachPlay = checkBox_renewTagAndNicowari.selected;
590     }
591    
592     private function checkBoxIsEnableJump(event:MouseEvent):void{
593     isEnableJump = event.currentTarget.selected;
594     (checkBox_askToUserOnJump as CheckBox).enabled = isEnableJump;
595     }
596    
597     private function checkBoxIsAskToUserOnJump(event:MouseEvent):void{
598     isAskToUserOnJump = event.currentTarget.selected;
599     }
600    
601     private function checkBoxHideSekaShinComment(event:MouseEvent):void{
602     isHideSekaShinComment = event.currentTarget.selected;
603    
604     if(this.playerController != null){
605     this.playerController.reloadLocalComment();
606     }
607     }
608    
609     private function commentListDoubleClicked(event:ListEvent):void{
610     var time:String = event.target.selectedItem.vpos_column;
611    
612     var min:int = int(time.substring(0,time.indexOf(":")));
613     var sec:int = int(time.substring(time.indexOf(":")+1));
614    
615     if(playerController.windowType == PlayerController.WINDOW_TYPE_FLV){
616     this.playerController.seek(min*60 + sec);
617     }else{
618     this.playerController.seek((min*60 + sec)*playerController.swfFrameRate);
619     }
620     }
621    
622     private function ichibaDataGridDoubleClicked(event:ListEvent):void{
623     trace((event.currentTarget as DataGrid).dataProvider[event.rowIndex].col_link);
624     var url:String = (event.currentTarget as DataGrid).dataProvider[event.rowIndex].col_link;
625     if(url != null){
626     navigateToURL(new URLRequest(url));
627     }
628     }
629    
630     private function commentScaleSliderChanged(event:SliderEvent):void{
631     this.commentScale = event.value;
632     this.playerController.windowResized(true);
633     }
634    
635     private function sliderShowCommentTimeChanged(event:SliderEvent):void{
636     this.showCommentSec = event.value;
637     }
638    
639     private function sliderCommentAlphaChanged(event:SliderEvent):void{
640     this.commentAlpha = event.value;
641     playerController.getCommentManager().setCommentAlpha(this.commentAlpha/100);
642     }
643    
644     private function myDataTipFormatFunction(value:Number):String{
645     var nowSec:String="00",nowMin:String="0";
646     nowSec = String(int(value%60));
647     nowMin = String(int(value/60));
648    
649     if(nowSec.length == 1){
650     nowSec = "0" + nowSec;
651     }
652     if(nowMin.length == 1){
653     nowMin = "0" + nowMin;
654     }
655     return nowMin + ":" + nowSec;
656     }
657    
658     private function windowCompleteHandler():void{
659    
660     videoPlayer.alwaysInFront = videoPlayer.isAlwaysFront;
661     this.alwaysInFront = this.isInfoViewAlwaysFront;
662    
663     // checkbox_repeat.selected = isRepeat;
664     // checkbox_showComment.selected = isShowComment;
665     checkbox_SyncComment.selected = isSyncComment;
666     checkBox_isShowOnlyPermissionComment.selected = isShowOnlyPermissionComment;
667     checkbox_showHtml.selected = isShowHTMLOwnerComment;
668    
669     videoPlayer.setShowAlwaysNicowariArea(isShowAlwaysNicowariArea);
670     playerController.setCommentFontBold(this.isCommentFontBold);
671    
672     videoPlayer.showUnderController(!isHideUnderController, true);
673     videoPlayer.showTagArea(!isHideTagArea, true);
674    
675     this.setStyle("fontFamily", ConfigManager.getInstance().getItem("fontFamily"));
676 mineap 439 this.setStyle("fontSize", Number(ConfigManager.getInstance().getItem("fontSize")));
677 mineap 370 }
678    
679     private function relationCanvasCreationCompleteHandler(event:FlexEvent):void{
680     combobox_relationOrder.selectedIndex = relationOrderIndex;
681     combobox_relationSort.selectedIndex = relationSortIndex;
682     }
683    
684     private function relationSortComboboxChange(event:Event):void{
685     relationSortIndex = combobox_relationSort.selectedIndex;
686     playerController.setNicoRelationInfoForRelationSortTypeChange();
687     }
688    
689     private function relationOrderComboboxChange(event:Event):void{
690     relationOrderIndex = combobox_relationOrder.selectedIndex;
691     playerController.setNicoRelationInfoForRelationSortTypeChange();
692     }
693    
694     private function configCanvasCreationCompleteHandler(event:FlexEvent):void{
695     checkbox_PlayerAlwaysFront.selected = videoPlayer.isAlwaysFront;
696     checkbox_InfoViewAlwaysFront.selected = isInfoViewAlwaysFront;
697     checkbox_playerFollow.selected = isPlayerFollow;
698     radioGroup_resizeType.selectedValue = selectedResizeType;
699    
700     checkbox_resizePlayerEachPlay.selected = isResizePlayerEachPlay;
701     if(isResizePlayerEachPlay){
702     // playerController.resizePlayerJustVideoSize();
703     radioButton_resizeNicoDou.enabled = true;
704     radioButton_resizeVideo.enabled = true;
705     }else{
706     radioButton_resizeNicoDou.enabled = false;
707     radioButton_resizeVideo.enabled = false;
708     }
709    
710     checkBox_showAlwaysNicowariArea.selected = isShowAlwaysNicowariArea;
711    
712     checkBox_commentBold.selected = isCommentFontBold;
713    
714     checkbox_hideUnderController.selected = isHideUnderController;
715     slider_commentScale.value = commentScale;
716     slider_fps.value = getValueByFps(fps);
717    
718     checkBox_renewComment.selected = isRenewCommentEachPlay;
719     slider_showCommentCount.value = showCommentCount;
720     slider_showCommentTime.value = showCommentSec;
721     slider_commentAlpha.value = commentAlpha;
722     checkBox_renewTagAndNicowari.selected = isRenewOtherCommentWithCommentEachPlay;
723     checkBox_renewTagAndNicowari.enabled = isRenewCommentEachPlay;
724    
725     checkBox_enableJump.selected = isEnableJump;
726     checkBox_askToUserOnJump.selected = isAskToUserOnJump;
727     checkBox_askToUserOnJump.enabled = isEnableJump;
728    
729     checkBox_isAlwaysEconomyForStreaming.selected = isAlwaysEconomyForStreaming;
730    
731     checkbox_hideTagArea.selected = isHideTagArea;
732    
733     isAppendComment = Application.application.getAppendComment();
734     checkBox_isAppendComment.selected = isAppendComment;
735     checkBox_isAppendComment.enabled = isRenewCommentEachPlay;
736     checkBox_hideSekaShinComment.selected = isHideSekaShinComment;
737    
738     checkBox_isNgUpEnable.selected = isNgUpEnable;
739 mineap 487 checkBox_isSmoothing.selected = isSmoothing;
740 mineap 370
741     if(playerController.getCommentManager() != null){
742     playerController.getCommentManager().setAntiAlias(isAntiAlias);
743     }
744     }
745    
746     public function isRepeatAll():Boolean{
747     return this.isPlayListRepeat;
748     }
749    
750     private function windowResized(event:NativeWindowBoundsEvent):void{
751     lastRect = event.afterBounds;
752     }
753    
754     private function windowMove(event:NativeWindowBoundsEvent):void{
755     lastRect = event.afterBounds;
756     }
757    
758     public function playListDoubleClicked():void{
759     if(playListProvider.length > 0){
760     var url:String = videoUrlMap[playListProvider[dataGrid_playList.selectedIndex]];
761     playerController.initForVideoPlayer(url, dataGrid_playList.selectedIndex);
762     }
763     }
764    
765     /**
766     * ���������������������������������������������������������������������������������������������������
767     *
768     */
769     public function selectComment(no:Number):void{
770    
771     for(var i:int = 0; i<commentListProvider.length; i++){
772     if(commentListProvider[i].no_column == no){
773     (dataGrid_comment as DataGrid).selectedIndex = i;
774    
775     return;
776     }
777     }
778    
779     }
780    
781     private function readStore():void{
782    
783     try{
784     /*���������������������������������������������*/
785    
786     var confValue:String = null;
787     confValue = ConfigManager.getInstance().getItem("isPlayListRepeat");
788     if (confValue == null) {
789     //���������������
790     }else{
791     isPlayListRepeat = ConfUtil.parseBoolean(confValue);
792     }
793    
794     confValue = ConfigManager.getInstance().getItem("isSyncComment");
795     if (confValue == null) {
796     //���������������
797     }else{
798     isSyncComment = ConfUtil.parseBoolean(confValue);
799     }
800    
801     confValue = ConfigManager.getInstance().getItem("isPlayerFollow");
802     if (confValue == null) {
803     //���������������
804     }else{
805     isPlayerFollow = ConfUtil.parseBoolean(confValue);
806     }
807    
808     confValue = ConfigManager.getInstance().getItem("isRenewCommentEachPlay");
809     if (confValue == null) {
810     //���������������
811     }else{
812     isRenewCommentEachPlay = ConfUtil.parseBoolean(confValue);
813     }
814    
815     confValue = ConfigManager.getInstance().getItem("isResizePlayerEachPlay");
816     if (confValue == null) {
817     //���������������
818     }else{
819     isResizePlayerEachPlay = ConfUtil.parseBoolean(confValue);
820     }
821    
822     confValue = ConfigManager.getInstance().getItem("isHideUnderController");
823     if (confValue == null) {
824     //���������������
825     }else{
826     isHideUnderController = ConfUtil.parseBoolean(confValue);
827     }
828    
829     confValue = ConfigManager.getInstance().getItem("commentScale");
830     if (confValue == null) {
831     //���������������
832     }else{
833     commentScale = Number(confValue);
834     }
835    
836     confValue = ConfigManager.getInstance().getItem("commentFps");
837     if (confValue == null) {
838     //���������������
839     }else{
840     this.fps = Number(confValue);
841     this.playerController.changeFps(this.fps);
842     }
843    
844     confValue = ConfigManager.getInstance().getItem("isShowOnlyPermissionComment");
845     if (confValue == null) {
846     //���������������
847     }else{
848     isShowOnlyPermissionComment = ConfUtil.parseBoolean(confValue);
849     }
850    
851     confValue = ConfigManager.getInstance().getItem("showCommentCount");
852     if (confValue == null) {
853     //���������������
854     }else{
855     showCommentCount = int(confValue);
856     }
857    
858     confValue = ConfigManager.getInstance().getItem("showCommentSec");
859     if (confValue == null) {
860     //���������������
861     }else{
862     showCommentSec = int(confValue);
863     }
864    
865     confValue = ConfigManager.getInstance().getItem("isRenewOtherCommentWithCommentEachPlay");
866     if (confValue == null) {
867     //���������������
868     }else{
869     isRenewOtherCommentWithCommentEachPlay = ConfUtil.parseBoolean(confValue);
870     }
871    
872     confValue = ConfigManager.getInstance().getItem("isAntiAlias");
873     if (confValue == null) {
874     //���������������
875     }else{
876     isAntiAlias = ConfUtil.parseBoolean(confValue);
877     }
878    
879     confValue = ConfigManager.getInstance().getItem("commentAlpha");
880     if (confValue == null) {
881     //���������������
882     }else{
883     commentAlpha = int(confValue);
884     }
885    
886     confValue = ConfigManager.getInstance().getItem("isEnableJump");
887     if (confValue == null) {
888     //���������������
889     }else{
890     isEnableJump = ConfUtil.parseBoolean(confValue);
891     }
892    
893     confValue = ConfigManager.getInstance().getItem("isAskToUserOnJump");
894     if (confValue == null) {
895     //���������������
896     }else{
897     isAskToUserOnJump = ConfUtil.parseBoolean(confValue);
898     }
899    
900     confValue = ConfigManager.getInstance().getItem("isInfoViewAlwaysFront");
901     if (confValue == null) {
902     //���������������
903     }else{
904     isInfoViewAlwaysFront = ConfUtil.parseBoolean(confValue);
905     }
906    
907     confValue = ConfigManager.getInstance().getItem("selectedResizeType");
908     if (confValue == null) {
909     //���������������
910     }else{
911     selectedResizeType = int(confValue);
912     }
913    
914     confValue = ConfigManager.getInstance().getItem("isCommentFontBold");
915     if (confValue == null) {
916     //���������������
917     }else{
918     isCommentFontBold = ConfUtil.parseBoolean(confValue);
919     }
920    
921     confValue = ConfigManager.getInstance().getItem("isShowAlwaysNicowariArea");
922     if (confValue == null) {
923     //���������������
924     }else{
925     isShowAlwaysNicowariArea = ConfUtil.parseBoolean(confValue);
926     }
927    
928     confValue = ConfigManager.getInstance().getItem("isHideTagArea");
929     if (confValue == null) {
930     //���������������
931     }else{
932     isHideTagArea = ConfUtil.parseBoolean(confValue);
933     }
934    
935     confValue = ConfigManager.getInstance().getItem("isAlwaysEconomyForStreaming");
936     if (confValue == null) {
937     //���������������
938     }else{
939     isAlwaysEconomyForStreaming = ConfUtil.parseBoolean(confValue);
940     }
941    
942     confValue = ConfigManager.getInstance().getItem("isAppendComment");
943     if (confValue == null) {
944     //���������������
945     }else{
946     isAppendComment = ConfUtil.parseBoolean(confValue);
947     }
948    
949     confValue = ConfigManager.getInstance().getItem("isHideSekaShinComment");
950     if (confValue == null) {
951     //���������������
952     }else{
953     isHideSekaShinComment = ConfUtil.parseBoolean(confValue);
954     }
955    
956     confValue = ConfigManager.getInstance().getItem("isShowHTMLOwnerComment");
957     if (confValue == null) {
958     //���������������
959     }else{
960     isShowHTMLOwnerComment = ConfUtil.parseBoolean(confValue);
961     }
962    
963     //x,y,w,h
964     confValue = ConfigManager.getInstance().getItem("controllerWindowPosition_x");
965     var controllerPosition_x:Number = 0;
966     if (confValue == null) {
967     //���������������
968     }else{
969     controllerPosition_x = Number(confValue);
970     this.addEventListener(FlexEvent.CREATION_COMPLETE, function():void{
971     nativeWindow.x = lastRect.x = controllerPosition_x;
972     });
973     }
974    
975     confValue = ConfigManager.getInstance().getItem("controllerWindowPosition_y");
976     var controllerPosition_y:Number = 0;
977     if (confValue == null) {
978     //���������������
979     }else{
980     controllerPosition_y = Number(confValue);
981     this.addEventListener(FlexEvent.CREATION_COMPLETE, function():void{
982     nativeWindow.y = lastRect.y = controllerPosition_y;
983     });
984     }
985    
986     confValue = ConfigManager.getInstance().getItem("controllerWindowPosition_w");
987     var controllerPosition_w:Number = 380;
988     if (confValue == null) {
989     //���������������
990     }else{
991     controllerPosition_w = Number(confValue);
992     this.addEventListener(FlexEvent.CREATION_COMPLETE, function():void{
993     nativeWindow.width = lastRect.width = controllerPosition_w;
994     });
995     }
996    
997     confValue = ConfigManager.getInstance().getItem("controllerWindowPosition_h");
998     var controllerPosition_h:Number = 520;
999     if (confValue == null) {
1000     //���������������
1001     }else{
1002     controllerPosition_h = Number(confValue);
1003     this.addEventListener(FlexEvent.CREATION_COMPLETE, function():void{
1004     nativeWindow.height = lastRect.height = controllerPosition_h;
1005     });
1006     }
1007    
1008     confValue = ConfigManager.getInstance().getItem("isEnableWideMode");
1009     if(confValue == null){
1010     //���������������
1011     isEnableWideMode = true;
1012     }else{
1013     isEnableWideMode = ConfUtil.parseBoolean(confValue);
1014     }
1015    
1016     confValue = ConfigManager.getInstance().getItem("relationSortIndex");
1017     if(confValue == null){
1018     //���������������
1019     }else{
1020     relationSortIndex = int(confValue);
1021     }
1022    
1023     confValue = ConfigManager.getInstance().getItem("relationOrderIndex");
1024     if(confValue == null){
1025     //���������������
1026     }else{
1027     relationOrderIndex = int(confValue);
1028     }
1029    
1030     confValue = ConfigManager.getInstance().getItem("isNgUpEnable");
1031     if(confValue == null){
1032     // ���������������
1033     }else{
1034     isNgUpEnable = ConfUtil.parseBoolean(confValue);
1035     }
1036    
1037 mineap 487 confValue = ConfigManager.getInstance().getItem("isSmoothing");
1038     if(confValue != null){
1039     isSmoothing = ConfUtil.parseBoolean(confValue);
1040     }
1041     if(playerController != null){
1042     playerController.setVideoSmoothing(this.isSmoothing);
1043     }
1044 mineap 439
1045 mineap 487
1046 mineap 370 }catch(error:Error){
1047     trace(error.getStackTrace());
1048     Alert.show(Message.M_CONF_FILE_IS_BROKEN, Message.M_ERROR);
1049     logManager.addLog(Message.FAIL_LOAD_CONF_FILE_FOR_VIDEO_INFO_VIEW + ":" + Message.M_CONF_FILE_IS_BROKEN + ":" + ConfigManager.getInstance().confFileNativePath + ":" + error);
1050     }
1051    
1052     }
1053    
1054     public function saveStore():void{
1055    
1056     try{
1057    
1058     trace("saveStore_videoInfoView");
1059    
1060     /*������������������������������������*/
1061     ConfigManager.getInstance().removeItem("isPlayListRepeat");
1062     ConfigManager.getInstance().setItem("isPlayListRepeat", isPlayListRepeat);
1063    
1064     ConfigManager.getInstance().removeItem("isSyncComment");
1065     ConfigManager.getInstance().setItem("isSyncComment", isSyncComment);
1066    
1067     ConfigManager.getInstance().removeItem("isPlayerFollow");
1068     ConfigManager.getInstance().setItem("isPlayerFollow", isPlayerFollow);
1069    
1070     ConfigManager.getInstance().removeItem("isRenewCommentEachPlay");
1071     ConfigManager.getInstance().setItem("isRenewCommentEachPlay", isRenewCommentEachPlay);
1072    
1073     ConfigManager.getInstance().removeItem("isResizePlayerEachPlay");
1074     ConfigManager.getInstance().setItem("isResizePlayerEachPlay", isResizePlayerEachPlay);
1075    
1076     ConfigManager.getInstance().removeItem("isHideUnderController");
1077     ConfigManager.getInstance().setItem("isHideUnderController", isHideUnderController);
1078    
1079     // ������������������������������������
1080     ConfigManager.getInstance().removeItem("controllerWindowPosition_x");
1081     ConfigManager.getInstance().setItem("controllerWindowPosition_x", lastRect.x);
1082    
1083     ConfigManager.getInstance().removeItem("controllerWindowPosition_y");
1084     ConfigManager.getInstance().setItem("controllerWindowPosition_y", lastRect.y);
1085    
1086     ConfigManager.getInstance().removeItem("controllerWindowPosition_w");
1087     ConfigManager.getInstance().setItem("controllerWindowPosition_w", lastRect.width);
1088    
1089     ConfigManager.getInstance().removeItem("controllerWindowPosition_h");
1090     ConfigManager.getInstance().setItem("controllerWindowPosition_h", lastRect.height);
1091    
1092     ConfigManager.getInstance().removeItem("commentScale");
1093     ConfigManager.getInstance().setItem("commentScale", commentScale);
1094    
1095     ConfigManager.getInstance().removeItem("commentFps");
1096     ConfigManager.getInstance().setItem("commentFps", fps);
1097    
1098     ConfigManager.getInstance().removeItem("isShowOnlyPermissionComment");
1099     ConfigManager.getInstance().setItem("isShowOnlyPermissionComment", isShowOnlyPermissionComment);
1100    
1101     ConfigManager.getInstance().removeItem("showCommentCount");
1102     ConfigManager.getInstance().setItem("showCommentCount", showCommentCount);
1103    
1104     ConfigManager.getInstance().removeItem("showCommentSec");
1105     ConfigManager.getInstance().setItem("showCommentSec", showCommentSec);
1106    
1107     ConfigManager.getInstance().removeItem("isRenewOtherCommentWithCommentEachPlay");
1108     ConfigManager.getInstance().setItem("isRenewOtherCommentWithCommentEachPlay", isRenewOtherCommentWithCommentEachPlay);
1109    
1110     ConfigManager.getInstance().removeItem("isAntiAlias");
1111     ConfigManager.getInstance().setItem("isAntiAlias", isAntiAlias);
1112    
1113     ConfigManager.getInstance().removeItem("commentAlpha");
1114     ConfigManager.getInstance().setItem("commentAlpha", commentAlpha);
1115    
1116     ConfigManager.getInstance().removeItem("isEnableJump");
1117     ConfigManager.getInstance().setItem("isEnableJump", isEnableJump);
1118    
1119     ConfigManager.getInstance().removeItem("isAskToUserOnJump");
1120     ConfigManager.getInstance().setItem("isAskToUserOnJump", isAskToUserOnJump);
1121    
1122     ConfigManager.getInstance().removeItem("isInfoViewAlwaysFront");
1123     ConfigManager.getInstance().setItem("isInfoViewAlwaysFront", isInfoViewAlwaysFront);
1124    
1125     ConfigManager.getInstance().removeItem("selectedResizeType");
1126     ConfigManager.getInstance().setItem("selectedResizeType", selectedResizeType);
1127    
1128     ConfigManager.getInstance().removeItem("isCommentFontBold");
1129     ConfigManager.getInstance().setItem("isCommentFontBold", isCommentFontBold);
1130    
1131     ConfigManager.getInstance().removeItem("isShowAlwaysNicowariArea");
1132     ConfigManager.getInstance().setItem("isShowAlwaysNicowariArea", isShowAlwaysNicowariArea);
1133    
1134     ConfigManager.getInstance().removeItem("isAlwaysEconomyForStreaming");
1135     ConfigManager.getInstance().setItem("isAlwaysEconomyForStreaming", isAlwaysEconomyForStreaming);
1136    
1137     ConfigManager.getInstance().removeItem("isHideTagArea");
1138     ConfigManager.getInstance().setItem("isHideTagArea", isHideTagArea);
1139    
1140     ConfigManager.getInstance().removeItem("isAppendComment");
1141     ConfigManager.getInstance().setItem("isAppendComment", isAppendComment);
1142    
1143     ConfigManager.getInstance().removeItem("isHideSekaShinComment");
1144     ConfigManager.getInstance().setItem("isHideSekaShinComment", isHideSekaShinComment);
1145    
1146     ConfigManager.getInstance().removeItem("isShowHTMLOwnerComment");
1147     ConfigManager.getInstance().setItem("isShowHTMLOwnerComment", isShowHTMLOwnerComment);
1148    
1149     ConfigManager.getInstance().removeItem("isEnableWideMode");
1150     ConfigManager.getInstance().setItem("isEnableWideMode", isEnableWideMode);
1151    
1152     ConfigManager.getInstance().removeItem("relationSortIndex");
1153     ConfigManager.getInstance().setItem("relationSortIndex", relationSortIndex);
1154    
1155     ConfigManager.getInstance().removeItem("relationOrderIndex");
1156     ConfigManager.getInstance().setItem("relationSortIndex", relationSortIndex);
1157    
1158     ConfigManager.getInstance().removeItem("isNgUpEnable");
1159     ConfigManager.getInstance().setItem("isNgUpEnable", isNgUpEnable);
1160    
1161 mineap 487 ConfigManager.getInstance().removeItem("isSmoothing");
1162     ConfigManager.getInstance().setItem("isSmoothing",isSmoothing);
1163    
1164 mineap 370 ConfigManager.getInstance().save();
1165    
1166     }catch(error:Error){
1167     Alert.show(Message.M_CONF_FILE_IS_BROKEN, Message.M_ERROR);
1168     logManager.addLog(Message.FAIL_SAVE_CONF_FILE_FOR_VIDEO_INFO_VIEW + ":" + Message.M_CONF_FILE_IS_BROKEN + ":" + ConfigManager.getInstance().confFileNativePath + ":" + error);
1169     trace(error.getStackTrace());
1170     }
1171    
1172     }
1173    
1174     public function resetWindowPosition():void{
1175     // ������������������������������������
1176     try{
1177    
1178     // ������������������������������������������������������������
1179     ConfigManager.getInstance().removeItem("controllerWindowPosition_x");
1180     ConfigManager.getInstance().setItem("controllerWindowPosition_x", 0);
1181    
1182     ConfigManager.getInstance().removeItem("controllerWindowPosition_y");
1183     ConfigManager.getInstance().setItem("controllerWindowPosition_y", 0);
1184    
1185     ConfigManager.getInstance().removeItem("controllerWindowPosition_w");
1186     ConfigManager.getInstance().setItem("controllerWindowPosition_w", 400);
1187    
1188     ConfigManager.getInstance().removeItem("controllerWindowPosition_h");
1189     ConfigManager.getInstance().setItem("controllerWindowPosition_h", 580);
1190    
1191     ConfigManager.getInstance().save();
1192    
1193     this.readStore();
1194    
1195     }catch(error:Error){
1196     Alert.show(Message.M_CONF_FILE_IS_BROKEN, Message.M_ERROR);
1197     logManager.addLog(Message.FAIL_SAVE_CONF_FILE_FOR_VIDEO_INFO_VIEW + ":" + Message.M_CONF_FILE_IS_BROKEN + ":" + ConfigManager.getInstance().confFileNativePath + ":" + error);
1198     trace(error.getStackTrace());
1199     }
1200    
1201     if(this.nativeWindow != null && !(this as Window).closed){
1202    
1203     this.visible = true;
1204    
1205     this.nativeWindow.x = 0;
1206     this.nativeWindow.y = 0;
1207    
1208     this.width = 380;
1209     this.height = 520;
1210     }
1211     }
1212    
1213     /**
1214     *
1215     * @param urlList
1216     * @param videoNameList
1217     * @param playListName
1218     */
1219     public function setPlayList(urlList:Array, videoNameList:Array, playListName:String):void{
1220    
1221     this.playListName = playListName;
1222     label_playListTitle_dataProvider = playListName;
1223    
1224     for each(var title:String in videoNameList){
1225     playListProvider.addItem(title);
1226     }
1227    
1228     for(var index:int = 0; index<urlList.length; index++){
1229     videoUrlMap[videoNameList[index]] = urlList[index];
1230     }
1231    
1232     if(this.dataGrid_playList != null){
1233     // (dataGrid_playList as DataGrid).validateDisplayList();
1234     }
1235     }
1236    
1237     /**
1238     *
1239     * @param url
1240     * @param title
1241     *
1242     */
1243     public function addPlayListItem(url:String, title:String):void{
1244    
1245     videoUrlMap[title] = url;
1246    
1247     }
1248    
1249     /**
1250     *
1251     * @param url
1252     * @param title
1253     * @param index
1254     *
1255     */
1256     public function addPlayListItemWithList(url:String, title:String, index:int):void{
1257     playListProvider.addItemAt(title,index);
1258    
1259     addPlayListItem(url, title);
1260    
1261     if(this.dataGrid_playList != null){
1262     (dataGrid_playList as DataGrid).dataProvider = playListProvider;
1263     (dataGrid_playList as DataGrid).validateDisplayList();
1264     }
1265    
1266     }
1267    
1268    
1269     /**
1270     *
1271     * @param title
1272     * @param index
1273     *
1274     */
1275     public function removePlayListItem(index:int):void{
1276     var title:String = String(playListProvider.removeItemAt(index));
1277    
1278     //���������������������������������������������������������������
1279     for each(var videoName:String in playListProvider){
1280     if(title == videoName){
1281     //������������������videoUrlMap���������������������
1282     return;
1283     }
1284     }
1285     //���������������������videoUrlMap������������
1286     videoUrlMap[title] = null;
1287    
1288     if(this.dataGrid_playList != null){
1289     (dataGrid_playList as DataGrid).dataProvider = playListProvider;
1290     (dataGrid_playList as DataGrid).validateDisplayList();
1291     }
1292     }
1293    
1294     /**
1295     *
1296     * @return
1297     *
1298     */
1299     public function getPlayList():Array{
1300     var array:Array = new Array();
1301     for(var i:int = 0; i<playListProvider.length; i++){
1302     array.push(String(playListProvider[i]));
1303     }
1304    
1305     var returnArray:Array = new Array();
1306    
1307     for each(var title:String in array){
1308     returnArray.push(videoUrlMap[title]);
1309     }
1310    
1311     return returnArray;
1312     }
1313    
1314     /**
1315     * ���������������������������������������������������������������
1316     * @return
1317     *
1318     */
1319     public function getNameList():Array{
1320     var array:Array = new Array();
1321     for(var i:int = 0; i<playListProvider.length; i++){
1322     array.push(String(playListProvider[i]));
1323     }
1324    
1325     return array;
1326     }
1327    
1328     /**
1329     *
1330     *
1331     */
1332     public function resetPlayList():void{
1333     this.playListName = "";
1334     if(label_playListTitle != null){
1335     label_playListTitle.text = playListName;
1336     }else{
1337     canvas_videoInfo.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void{
1338     canvas_playList.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void{
1339     label_playListTitle.text = playListName;
1340     });
1341     });
1342     }
1343    
1344     videoUrlMap = new Object();
1345    
1346     playListProvider.removeAll();
1347    
1348     if(this.dataGrid_playList != null){
1349     (dataGrid_playList as DataGrid).dataProvider = playListProvider;
1350     (dataGrid_playList as DataGrid).validateDisplayList();
1351     (dataGrid_playList as DataGrid).validateNow();
1352     }
1353     }
1354    
1355     /**
1356 mineap 476 * ���������������������������������������������
1357 mineap 370 *
1358 mineap 476 * @details edvakf���������������������������
1359     * @see https://github.com/edvakf/NNDDMOD/commit/6984ba8919727a98c249e1bc8a4848705de27df5
1360     */
1361     public function shufflePlayList():void{
1362     var tempArrayCollection:ArrayCollection = new ArrayCollection();
1363     for each(var object:Object in playListProvider){
1364     tempArrayCollection.addItem(object);
1365     }
1366     var i:int = tempArrayCollection.length;
1367     while (--i) {
1368     var j:int = Math.floor( Math.random() * (i + 1) );
1369     if (i == j) {
1370     continue;
1371     }
1372     var object:Object = tempArrayCollection.getItemAt(i);
1373     tempArrayCollection.setItemAt( tempArrayCollection.getItemAt(j), i );
1374     tempArrayCollection.setItemAt( object, j );
1375     }
1376     playListProvider = tempArrayCollection;
1377     }
1378    
1379     /**
1380     *
1381 mineap 370 * @param index
1382     * @return
1383     *
1384     */
1385     public function getPlayListUrl(index:int):String{
1386     var videoTitle:String = playListProvider[index];
1387    
1388     return videoUrlMap[videoTitle];
1389     }
1390    
1391     /**
1392     *
1393     * @param event
1394     *
1395     */
1396     public function playListDragDropHandler(event:DragEvent):void{
1397     if(event.dragInitiator == dataGrid_playList){
1398    
1399     //���������������(������������������������������������������)
1400    
1401     }else{
1402    
1403     //DataGrid���������Drag������������������������������
1404    
1405     if(event.dragInitiator as DataGrid){
1406     var selectedItems:Array = (event.dragInitiator as DataGrid).selectedItems;
1407     var addItems:Array = new Array();
1408    
1409     for(var i:int=0; i<selectedItems.length; i++){
1410    
1411     //������������������������
1412     var url:String = selectedItems[i].dataGridColumn_videoPath;
1413     if(url == null || url == ""){
1414     //��������������� or ���������videoPath���������������������
1415     url = selectedItems[i].dataGridColumn_nicoVideoUrl;
1416    
1417     if(url == null || url == ""){
1418     //������������������������������
1419     url = selectedItems[i].dataGridColumn_videoLocalPath;
1420    
1421     if(url == null || url == ""){
1422     //������������������videoLocalPath���������������������
1423     url = selectedItems[i].dataGridColumn_videoUrl;
1424    
1425     if(url == null || url == ""){
1426     //������������������������
1427     continue;
1428     }
1429     }
1430     }
1431     }
1432    
1433     var title:String = selectedItems[i].dataGridColumn_videoName;
1434     var index:int = title.indexOf("\n");
1435     if(index != -1){
1436     //������������������������������������������������������������������������
1437     title = title.substring(0, index);
1438     }
1439    
1440     addItems.push(title);
1441     addPlayListItem(url, title);
1442     }
1443    
1444     }
1445    
1446     event.dragSource = new DragSource();
1447     event.dragSource.addData(addItems, "items");
1448     }
1449     }
1450    
1451     /**
1452     *
1453     * @param event
1454     *
1455     */
1456     public function playListClearButtonClicked(event:MouseEvent):void{
1457     resetPlayList();
1458     }
1459    
1460 mineap 476 public function playListShuffleButtonClicked(event:MouseEvent):void{
1461     shufflePlayList();
1462     }
1463    
1464 mineap 370 /**
1465     *
1466     * @param event
1467     *
1468     */
1469     public function playListItemDeleteButtonClicked(event:MouseEvent):void{
1470     var selectedIndices:Array = (dataGrid_playList as DataGrid).selectedIndices;
1471    
1472     for(var index:int = selectedIndices.length; index != 0; index--){
1473     removePlayListItem(selectedIndices[index-1]);
1474     }
1475     }
1476    
1477     /**
1478     *
1479     * @param event
1480     *
1481     */
1482     public function playListSaveButtonClicked(event:MouseEvent):void{
1483     //1.���������������������������������������������������������or���������������
1484     //2.���������������������������������������������
1485     //3.������������������������������������
1486     var urlArray:Array = new Array();
1487     var nameArray:Array = new Array();
1488     for each(var name:String in playListProvider){
1489     urlArray.push(videoUrlMap[name]);
1490     nameArray.push(name);
1491     }
1492    
1493     var isExist:Boolean = false;
1494     if(playListName != null){
1495     var playList:PlayList = PlayListManager.instance.isExist(playListName);
1496    
1497     if(playList != null){
1498     isExist = true;
1499     }
1500     }
1501    
1502     if(!isExist){
1503     // ���������������������������
1504     playerController.addNewPlayList(urlArray, nameArray);
1505     }else{
1506     Application.application.activate();
1507     Alert.show("���������������������������(" + playListName + ")���������������������������\n���������������������������������������������������������������������������������������", Message.M_MESSAGE, Alert.YES | Alert.NO | Alert.CANCEL, null, function(event:CloseEvent):void{
1508     if(event.detail == Alert.YES){
1509     // ���������
1510     playerController.updatePlayList(playListName, urlArray, nameArray);
1511     }else if(event.detail == Alert.NO){
1512     // ���������������tuika
1513     var title:String = playerController.addNewPlayList(urlArray, nameArray);
1514     label_playListTitle_dataProvider = title;
1515     }else{
1516    
1517     }
1518     });
1519    
1520     }
1521    
1522     }
1523    
1524     /**
1525     *
1526     * @param index
1527     *
1528     */
1529     public function showPlayingTitle(index:int):void{
1530     if(dataGrid_playList != null){
1531     (dataGrid_playList as DataGrid).scrollToIndex(index);
1532     (dataGrid_playList as DataGrid).selectedIndex = index;
1533     }else{
1534     canvas_playList.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void{
1535     (dataGrid_playList as DataGrid).scrollToIndex(index);
1536     (dataGrid_playList as DataGrid).selectedIndex = index;
1537     });
1538     }
1539     }
1540    
1541     /**
1542     *
1543     * @param event
1544     *
1545     */
1546     public function tagListDoubleClickEventHandler(event:ListEvent):void{
1547     if(event.itemRenderer.data != null){
1548     if(event.itemRenderer.data is String){
1549     var word:String = String(event.itemRenderer.data);
1550     Application.application.search(new SearchItem(word,
1551     SearchSortString.convertSortTypeFromIndex(4), SearchType.TAG, word));
1552     }
1553     }
1554     }
1555    
1556     /**
1557     *
1558     * @param event
1559     *
1560     */
1561     public function button_goToWebClicked(event:Event):void{
1562     this.playerController.watchOnWeb();
1563     }
1564    
1565     /**
1566     *
1567     * @param event
1568     *
1569     */
1570     public function tweet(event:Event):void{
1571     this.playerController.tweet();
1572     }
1573    
1574     /**
1575     *
1576     * @param event
1577     *
1578     */
1579     public function addHatenaBookmark(event:Event):void{
1580     this.playerController.addHatenaBookmark();
1581     }
1582    
1583     /**
1584     *
1585     * @param event
1586     *
1587     */
1588     public function openNicoSound(event:Event):void{
1589     this.playerController.openNicoSound();
1590     }
1591    
1592     /**
1593     *
1594     * @param event
1595     *
1596     */
1597     public function openNicomimi(event:Event):void{
1598     this.playerController.openNicomimi();
1599     }
1600    
1601     /**
1602     *
1603     * @param event
1604     *
1605     */
1606     public function button_addDownloadList(event:Event):void{
1607    
1608     this.playerController.addDlList();
1609    
1610     }
1611    
1612     /**
1613     *
1614     * @param event
1615     *
1616     */
1617     public function myListAddButtonClicked(event:Event):void{
1618     var selectedItem:Object = comboBox_mylist.selectedItem;
1619    
1620     if(selectedItem != null){
1621     var name:String = String(selectedItem);
1622     this.playerController.addMyList(myListMap[name]);
1623    
1624     }else{
1625    
1626     }
1627     }
1628    
1629     /**
1630     *
1631     * @param myListNames
1632     * @param myListNums
1633     *
1634     */
1635     public function setMyLists(myListNames:Array, myListNums:Array):void{
1636    
1637     var selectedIndex:int = comboBox_mylist.selectedIndex;
1638     var selectedName:String = myListDataProvider[selectedIndex];
1639    
1640     myListDataProvider = new Array();
1641     for(var i:int = 0; i<myListNames.length; i++){
1642     myListMap[myListNames[i]] = myListNums[i];
1643     myListDataProvider[i] = myListNames[i];
1644     if(selectedName == myListDataProvider[i]){
1645     selectedIndex = i;
1646     }
1647     }
1648    
1649     comboBox_mylist.dataProvider = myListDataProvider;
1650    
1651     if(myListDataProvider.length >= 1){
1652     comboBox_mylist.selectedIndex = 0;
1653     }
1654    
1655     comboBox_mylist.validateNow();
1656    
1657     if(selectedIndex == -1){
1658     var value:Object = ConfigManager.getInstance().getItem("infoViewSelectedMyListIndex");
1659     if(value != null){
1660     selectedIndex = int(value);
1661     }else{
1662     selectedIndex = 0;
1663     }
1664     }
1665     comboBox_mylist.selectedIndex = selectedIndex;
1666    
1667     }
1668    
1669     private function ownerTextLinkClicked(event:TextEvent):void{
1670     if(event.text.indexOf("mylist/") != -1){
1671     // trace(event.text);
1672     Application.application.renewMyList(event.text);
1673     }else if(event.text.indexOf("watch/") != -1){
1674     var videoId:String = PathMaker.getVideoID(event.text);
1675     // trace(videoId);
1676     playerController.playMovie("http://www.nicovideo.jp/watch/" + videoId);
1677     }else{
1678     trace(event);
1679     }
1680     }
1681    
1682     private function playListReverseButtonClicked(event:Event):void{
1683     var tempArrayCollection:ArrayCollection = new ArrayCollection();
1684    
1685     for each(var object:Object in playListProvider){
1686     tempArrayCollection.addItemAt(object, 0);
1687     }
1688    
1689     playListProvider = tempArrayCollection;
1690     }
1691    
1692     public function get playList():PlayList{
1693     var playList:PlayList = null;
1694    
1695     if(getPlayList().length > 0){
1696    
1697     playList = new PlayList();
1698    
1699     playList.name = playListName;
1700    
1701     for(var index:int = 0; index < (getPlayList() as Array).length; index++){
1702     var path:String = getPlayList()[index];
1703     var name:String = getNameList()[index];
1704     var nnddVideo:NNDDVideo = new NNDDVideo(path, name);
1705    
1706     playList.items.push(nnddVideo);
1707     }
1708     }
1709    
1710     return playList;
1711     }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26