Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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