Changeset 81f97048316e171afdf367aab5b4cda2fc87c267
- Timestamp:
- 03/08/11 12:39:16 (15 months ago)
- Author:
- Robin Gareus <robin@…>
- Parents:
- f35a3cded31bcba366c5d2ee708fe889dbb5fd8f
- Children:
- 3297694796b1587d45038bec5ddc044ab42309af
- git-committer:
- Robin Gareus <robin@gareus.org> / 2011-03-08T13:39:16Z+0100
- Message:
-
sansarmes: abslayout & subtitles
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rf53c943
|
r81f9704
|
|
| 3 | 3 | xmlns:mx="http://www.adobe.com/2006/mxml" |
| 4 | 4 | width="720" height="460" |
| 5 | | layout="vertical" |
| | 5 | layout="absolute" |
| 6 | 6 | verticalAlign="middle" |
| 7 | 7 | backgroundColor="#ffffff" |
| … |
… |
|
| 9 | 9 | creationComplete="onAppInit()" > |
| 10 | 10 | |
| 11 | | <mx:HTTPService id="service" resultFormat="text" |
| | 11 | <mx:HTTPService id="lyrreq" resultFormat="text" |
| | 12 | url="http://tac1.theartcollider.org/sansarmes/txtdb.php" |
| | 13 | result="onReqOK(event)" |
| | 14 | fault="onReqFault(event)" |
| | 15 | concurrency="single" |
| | 16 | method="POST" /> |
| | 17 | |
| | 18 | <mx:HTTPService id="pubreq" resultFormat="text" |
| 12 | 19 | url="http://tac1.theartcollider.org/sansarmes/publish.php" |
| 13 | 20 | result="onPubOK(event)" |
| … |
… |
|
| 26 | 33 | import mx.core.SoundAsset; |
| 27 | 34 | import mx.core.mx_internal; |
| 28 | | |
| | 35 | import mx.collections.ArrayCollection; |
| | 36 | import flash.filters.DropShadowFilter; |
| 29 | 37 | |
| 30 | 38 | private var conn:NetConnection; |
| … |
… |
|
| 52 | 60 | private var myVu:Shape; |
| 53 | 61 | private var vutimer:Timer; |
| | 62 | |
| | 63 | // karaoke lyrics |
| | 64 | private var lyricsarray:Array; |
| | 65 | private var karaoketime:Array; |
| | 66 | private var usesubtitle:Boolean; |
| | 67 | private var initparoles:Boolean; |
| | 68 | [Bindable] |
| | 69 | private var parolenames:Array; |
| 54 | 70 | |
| 55 | 71 | private function onAppInit():void |
| … |
… |
|
| 61 | 77 | username="4dc84c9279d0fcaa793eecfbc544cdbe7ea5f6e4"; |
| 62 | 78 | password="f78b64c9e0f2ea24fddce2b0d809cb2855fed1a6"; |
| | 79 | usesubtitle = false; |
| | 80 | initparoles = true; |
| | 81 | parolenames=new Array('acune'); |
| | 82 | lyricsarray=new Array(); |
| | 83 | karaoketime=new Array(0, |
| | 84 | 67, 100, 141, 180, 265, 312, 347, 387, |
| | 85 | 437, 471, 510, 553, 590, |
| | 86 | 699, 733, 773, 813, 896, 947, 979, 1018, |
| | 87 | 1065, 1100, 1141, 1184, 1216, |
| | 88 | 1327, 1361, 1403, 1439, 1522, 1560, 1607, 1649, |
| | 89 | 1696, 1735, 1771, 1814, 1844, 1900, -1); |
| | 90 | |
| 63 | 91 | uploadName=null; |
| 64 | 92 | avallowed=false; |
| … |
… |
|
| 68 | 96 | bu.enabled=false; |
| 69 | 97 | cbNotify.enabled=false; |
| | 98 | lyrreq.send({mode:"list"}); |
| 70 | 99 | |
| 71 | 100 | // cam & mic |
| … |
… |
|
| 116 | 145 | ta.enabled=false; |
| 117 | 146 | te.enabled=false; |
| | 147 | st.enabled=false; |
| 118 | 148 | tt.enabled=false; |
| 119 | 149 | br.enabled=false; |
| … |
… |
|
| 154 | 184 | vutimer.stop(); |
| 155 | 185 | myVu.graphics.clear(); |
| | 186 | karaoke.text=''; |
| 156 | 187 | } |
| 157 | 188 | |
| … |
… |
|
| 231 | 262 | ta.enabled=false; |
| 232 | 263 | te.enabled=false; |
| | 264 | st.enabled=false; |
| 233 | 265 | br.enabled=true; |
| 234 | 266 | video.attachCamera(cam); |
| 235 | 267 | // TODO: check if cam access is accepted! |
| | 268 | |
| | 269 | usesubtitle=false; |
| | 270 | if (st.selectedIndex >0) { |
| | 271 | lyrreq.send({mode:"get", id:st.selectedIndex}); |
| | 272 | } |
| 236 | 273 | bc.label="arrêter la caméra"; |
| 237 | 274 | } else { |
| … |
… |
|
| 239 | 276 | ta.enabled=true; |
| 240 | 277 | te.enabled=true; |
| | 278 | st.enabled=true; |
| 241 | 279 | br.enabled=false; |
| 242 | 280 | video.attachCamera(null); |
| … |
… |
|
| 302 | 340 | ta.enabled=false; |
| 303 | 341 | te.enabled=false; |
| | 342 | st.enabled=false; |
| 304 | 343 | br.enabled=false; |
| 305 | 344 | |
| … |
… |
|
| 315 | 354 | } |
| 316 | 355 | |
| | 356 | private function onReqOK(event:ResultEvent):void { |
| | 357 | var rawData:String = String(event.result); |
| | 358 | //Alert.show('debug:\n'+rawData,'Debug.', mx.controls.Alert.OK); |
| | 359 | if (initparoles) { |
| | 360 | initparoles=false; |
| | 361 | if (rawData=="") return; |
| | 362 | parolenames = rawData.split("\n"); |
| | 363 | return; |
| | 364 | } |
| | 365 | if (rawData=="") { |
| | 366 | usesubtitle=false; |
| | 367 | Alert.show('Did not receive any lyrics for this title..','No Lyrics.', mx.controls.Alert.OK); |
| | 368 | return; |
| | 369 | } |
| | 370 | lyricsarray = rawData.split("\n"); |
| | 371 | usesubtitle=true; |
| | 372 | } |
| | 373 | |
| | 374 | private function onReqFault(event:FaultEvent):void { |
| | 375 | } |
| | 376 | |
| 317 | 377 | private function onPubOK(event:ResultEvent):void { |
| 318 | 378 | Alert.show('Votre vidéo sera publiée aprÚs modération.', |
| … |
… |
|
| 332 | 392 | var notify:int=cbNotify.selected?1:0; |
| 333 | 393 | if (eventObj.detail==Alert.YES) { |
| 334 | | service.send({notify:notify, file:uploadName}); |
| | 394 | pubreq.send({notify:notify, file:uploadName}); |
| 335 | 395 | } |
| 336 | 396 | } |
| … |
… |
|
| 345 | 405 | public function onPlaybackProgress(event:Event):void { |
| 346 | 406 | soundProgress.setProgress(soundChannel.position, sound.length); |
| | 407 | if (!usesubtitle || !br.selected) return; |
| | 408 | var sec:int=soundChannel.position * 1940 / sound.length; |
| | 409 | var i:int; var r:int; |
| | 410 | r=-1; |
| | 411 | sec+=5; // offset 500ms |
| | 412 | for (i=0;i<karaoketime.length;i++) { |
| | 413 | if (sec>=karaoketime[i] && sec <= karaoketime[i+1]) {r=i; break;} |
| | 414 | } |
| | 415 | if (r>=0) karaoke.text=lyricsarray[r]; |
| | 416 | else karaoke.text=''; |
| 347 | 417 | } |
| 348 | 418 | |
| … |
… |
|
| 395 | 465 | } |
| 396 | 466 | |
| | 467 | .karaoke { |
| | 468 | fontFamily: Arial; |
| | 469 | font-size: 18pt; |
| | 470 | textAlign: center; |
| | 471 | color: #EEEEEE; |
| | 472 | } |
| | 473 | |
| 397 | 474 | .title { |
| 398 | 475 | fontFamily: Bebas; |
| … |
… |
|
| 417 | 494 | font-size: 8; |
| 418 | 495 | textAlign: right; |
| 419 | | color: #808080; |
| | 496 | color: #AAAAAA; |
| 420 | 497 | padding-right: 20; |
| 421 | 498 | } |
| … |
… |
|
| 434 | 511 | --> |
| 435 | 512 | |
| 436 | | <mx:Box direction="horizontal" width="100%" height="100%"> |
| | 513 | <mx:Box direction="horizontal" width="100%" height="430" x="0" y="0"> |
| 437 | 514 | <mx:VBox width="340" height="100%"> |
| 438 | 515 | <mx:Text width="330"> |
| … |
… |
|
| 459 | 536 | </mx:Box> |
| 460 | 537 | <mx:Spacer height="100%"/> |
| | 538 | <mx:Text width="330"> |
| | 539 | <mx:htmlText> |
| | 540 | <![CDATA[<font face="Colaborate-Medium" size="12">Ãtape 1bis</font>: sous-titres]]> |
| | 541 | </mx:htmlText> |
| | 542 | </mx:Text> |
| | 543 | <mx:Box direction="horizontal" > |
| | 544 | <mx:Label width="80" text="Paroles:" /> |
| | 545 | <mx:ComboBox id="st" width="140" dataProvider="{parolenames}"/> |
| | 546 | </mx:Box> |
| | 547 | <mx:Spacer height="100%"/> |
| 461 | 548 | |
| 462 | 549 | <mx:Text width="330"> |
| … |
… |
|
| 482 | 569 | |
| 483 | 570 | <mx:VBox width="330" height="100%"> |
| | 571 | <mx:Spacer height="100%"/> |
| 484 | 572 | <mx:VideoDisplay id="video" width="280" height="210" /> |
| 485 | 573 | <mx:ProgressBar width="280" mode="manual" label="%3%%" labelPlacement="center" visible="false" id="soundProgress"/> |
| … |
… |
|
| 505 | 593 | </mx:VBox> |
| 506 | 594 | </mx:Box> |
| 507 | | <mx:Spacer height="100%"/> |
| 508 | | <mx:Text width="100%" styleName="footer"> |
| | 595 | |
| | 596 | <mx:Text styleName="footer" x="475" y="440"> |
| 509 | 597 | <mx:htmlText> |
| 510 | | <![CDATA[© 2011 CITU, robin@gareus.org]]> |
| | 598 | <![CDATA[© 2011 CITU.fr, robin@gareus.org]]> |
| 511 | 599 | </mx:htmlText> |
| 512 | 600 | </mx:Text> |
| | 601 | |
| | 602 | <mx:Label id="karaoke" width="280" x="340" y="180" styleName="karaoke" text="" |
| | 603 | filters="{[new DropShadowFilter(1, 30)]}" |
| | 604 | /> |
| 513 | 605 | </mx:Application> |
| 514 | 606 | <!-- vim:set ts=4 sw=4 et:!--> |