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

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