-
Notifications
You must be signed in to change notification settings - Fork 9
/
basic_config.as
executable file
·5027 lines (4464 loc) · 225 KB
/
basic_config.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package {
import flash.display.MovieClip;
import flash.net.*;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Sprite;
import flash.display.DisplayObject;
import fl.controls.TextArea;
import fl.controls.Button;
import fl.controls.RadioButton;
import fl.controls.RadioButtonGroup;
import fl.controls.ComboBox;
import fl.controls.CheckBox;
import net.eriksjodin.arduino.Arduino;
import net.eriksjodin.arduino.events.ArduinoEvent;
import flash.display.Sprite;
import flash.display.Loader;
import fl.video.FLVPlayback;
import fl.video.MetadataEvent;
import fl.video.CuePointType;
import fl.video.IVPEvent;
import fl.video.VideoEvent;
import flash.display.*;
import flash.events.TimerEvent;
import flash.utils.*;
import flash.system.fscommand;
import flash.ui.Mouse;
import flash.media.Sound;
import flash.text.Font;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.TextFormat;
import flash.text.*;
import flash.errors.*;
import flash.events.ErrorEvent;
import flash.errors.IOError;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.net.Socket;
import flash.utils.ByteArray;
import flash.filesystem.*;
import flash.filesystem.File;
import flash.filesystem.FileStream;
import flash.filesystem.FileMode;
import flash.events.InvokeEvent;
import flash.desktop.NativeApplication;
import flash.system.Capabilities;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.events.NetStatusEvent;
import flash.events.HTTPStatusEvent;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.NetStatusEvent;
import flash.events.HTTPStatusEvent;
import flash.net.*;
import com.yahoo.astra.fl.managers.AlertManager;
import com.swfjunkie.tweetr.Tweetr;
import com.swfjunkie.tweetr.oauth.OAuth;
import com.swfjunkie.tweetr.oauth.events.OAuthEvent;
import flash.display.Sprite;
import flash.geom.Rectangle;
import flash.html.HTMLLoader;
import fl.controls.Slider;
import fl.events.SliderEvent;
import fl.controls.Label;
import flash.display.NativeMenu;
import flash.display.NativeMenuItem;
import flash.display.NativeWindow;
public class basic_config extends MovieClip {
private var xmlLoader:URLLoader;
private var foundArduino:int=0;
private var SerproxyRunning:int=0;
private var com_port;
private var aa:Arduino;
private var bb:Arduino;
private var cc:Arduino;
private var dd:Arduino;
private var ee:Arduino;
private var ff:Arduino;
private var gg:Arduino;
private var hh:Arduino;
private var ii:Arduino;
private var noArduinoFoundTimer:Timer;
private var myTimer:Timer = new Timer(3000, 1);
private var myTimer2:Timer = new Timer(3000, 1);
private var SerproxyCheckTimer:Timer;
private var myFont:Font = new MyriadFont(); //used for stock text
private var admin_flag:int = 0;
private var index_selected:int;
private var stock_counter:int=0; //the total number of stocks
private var first_stock:int=0;
private var temp_stock_array:Array = new Array(); //used as a temp holder for the stocks
private var weather_code;
private var weather_high:int;
private var good_weather_threshold:int;
private var myXML:XML = new XML();
private var myXMLold:XML = new XML();
private var file:File = new File();
private var file2:File = new File();
private var file3:File = new File();
private var PhotoSaveDir:File = new File();
private var photoboothOverlayImagePath:File = new File();
private var photoboothLogoPath:File = new File();
//private var serproxyCFGv4:File = new File();
//private var serproxyCFGv5:File = new File();
private var filestream:FileStream = new FileStream();
private var AlertTextFormat:TextFormat = new TextFormat();
private var StartupTextFormat:TextFormat = new TextFormat(); //this is the formatter for the startup text field
private var StartupText:TextField = new TextField;
private var ArduinoFound:TextArea = new TextArea;
private var tweetr:Tweetr;
private var oauth:OAuth;
private var htmlLoader:HTMLLoader;
private var radiotext:TextFormat = new TextFormat();
private var radiotext2:TextFormat = new TextFormat();
private var switch5_radio_on:RadioButton = new RadioButton;
private var switch5_radio_off:RadioButton = new RadioButton;
private var switch5_rgb:RadioButtonGroup = new RadioButtonGroup("switch5_rgb");
private var switch4_radio_on:RadioButton = new RadioButton;
private var switch4_radio_off:RadioButton = new RadioButton;
private var switch4_rgb:RadioButtonGroup = new RadioButtonGroup("switch4_rgb");
private var analog1_radio_on:RadioButton = new RadioButton;
private var analog1_radio_off:RadioButton = new RadioButton;
private var analog1_rgb:RadioButtonGroup = new RadioButtonGroup("analog1_rgb");
private var analog2_radio_on:RadioButton = new RadioButton;
private var analog2_radio_off:RadioButton = new RadioButton;
private var analog2_rgb:RadioButtonGroup = new RadioButtonGroup("analog2_rgb");
private var analog3_radio_on:RadioButton = new RadioButton;
private var analog3_radio_off:RadioButton = new RadioButton;
private var analog3_rgb:RadioButtonGroup = new RadioButtonGroup("analog3_rgb");
private var twitter_rbg:RadioButtonGroup = new RadioButtonGroup("twitter_rbg");
private var twitter_mode_rbg:RadioButtonGroup = new RadioButtonGroup("twitter_mode_rbg");
private var TTS_rbg:RadioButtonGroup = new RadioButtonGroup("TTS_rbg");
private var TTS_languages_dropdown:ComboBox = new ComboBox(); //dropdown
private var tts_feature_radio_on:RadioButton = new RadioButton;
private var tts_feature_radio_off:RadioButton = new RadioButton;
private var photobooth_printing_radio_on:RadioButton = new RadioButton;
private var photobooth_printing_radio_off:RadioButton = new RadioButton;
private var twitter_mode_radio_user:RadioButton = new RadioButton;
private var twitter_mode_radio_search:RadioButton = new RadioButton;
private var twitter_mode_radio_mentions:RadioButton = new RadioButton;
private var tts_url:TextField = new TextField();
//private var TTS_languages_dropdown:ComboBox = new ComboBox(); //dropdown
private var proximity1_tts:TextField = new TextField();
private var proximity2_tts:TextField = new TextField();
private var proximity3_tts:TextField = new TextField();
private var weather_good_tts:TextField = new TextField();
private var weather_ok_tts:TextField = new TextField();
private var weather_rain_tts:TextField = new TextField();
private var no_internet_tts:TextField = new TextField();
private var stock_up_tts:TextField = new TextField();
private var stock_no_change_tts:TextField = new TextField();
private var stock_down_tts:TextField = new TextField();
private var doorbell_tts:TextField = new TextField();
private var x10_on_tts:TextField = new TextField();
private var x10_off_tts:TextField = new TextField();
private var drink1_tts:TextField = new TextField();
private var drink2_tts:TextField = new TextField();
private var drink3_tts:TextField = new TextField();
private var drink4_tts:TextField = new TextField();
private var blow_tts:TextField = new TextField();
private var wait_tts:TextField = new TextField();
private var warning_tts:TextField = new TextField();
private var TTSTextFormat:TextFormat = new TextFormat;
private var photoboothTextLabelFormat:TextFormat = new TextFormat;
private var photobooth_Screen_Label:TextField = new TextField();
private var photobooth_Screen_LabelFormat:TextFormat = new TextFormat;
private var tts_feature_label:TextField = new TextField(); //radio button
private var tts_url_label:TextField = new TextField();
private var tts_language_label:TextField = new TextField(); //drop down
//private var tts_engine_label:TextField = new TextField();
private var proximity1_tts_label:TextField = new TextField();
private var proximity2_tts_label:TextField = new TextField();
private var proximity3_tts_label:TextField = new TextField();
private var weather_good_tts_label:TextField = new TextField();
private var weather_ok_tts_label:TextField = new TextField();
private var weather_rain_tts_label:TextField = new TextField();
private var no_internet_tts_label:TextField = new TextField();
private var stock_up_tts_label:TextField = new TextField();
private var stock_no_change_tts_label:TextField = new TextField();
private var stock_down_tts_label:TextField = new TextField();
private var doorbell_tts_label:TextField = new TextField();
private var x10_on_tts_label:TextField = new TextField();
private var x10_off_tts_label:TextField = new TextField();
private var drink1_tts_label:TextField = new TextField();
private var drink2_tts_label:TextField = new TextField();
private var drink3_tts_label:TextField = new TextField();
private var drink4_tts_label:TextField = new TextField();
private var tts_instructions:TextField = new TextField;
private var blow_tts_label:TextField = new TextField();
private var wait_tts_label:TextField = new TextField();
private var warning_tts_label:TextField = new TextField();
private var TTSTextLabelFormat:TextFormat = new TextFormat;
private var tts_api_key:TextField = new TextField();
private var tts_api_key_label:TextField = new TextField();
private var tts_api_keyYakitome:TextField = new TextField();
private var tts_api_key_labelYakitome:TextField = new TextField();
private var only_my_tweets_checkbox:CheckBox = new CheckBox();
private var do_not_speak_twitter_search_term_checkbox:CheckBox = new CheckBox();
private var tweetBreathalyzer_checkbox:CheckBox = new CheckBox();
private var StandAloneCheck:CheckBox = new CheckBox();
private var TTS_Screen_Label:TextField = new TextField();
private var TTS_Screen_LabelFormat:TextFormat = new TextFormat;
private var black_square:Sprite = new Sprite();
private var onoff_house_code_input:ComboBox = new ComboBox();
private var onoff_unit_code_input:ComboBox = new ComboBox();
private var photobooth_printing_check:CheckBox = new CheckBox();
private var photobooth_promptprint_check:CheckBox = new CheckBox();
private var photobooth_save_check:CheckBox = new CheckBox();
private var photobooth_x10_check:CheckBox = new CheckBox();
private var photobooth_leds_check:CheckBox = new CheckBox();
private var photobooth_kinect_check:CheckBox = new CheckBox();
private var photoboothProofPreview_check:CheckBox = new CheckBox();
private var photoboothFacialRecognitionTrigger_check:CheckBox = new CheckBox();
private var photobooth_PaperSize_dropdown:ComboBox = new ComboBox();
private var photobooth_PrintCopies_label:Label = new Label();
private var photobooth_PrintCopiesValue_label:Label = new Label();
private var photobooth_SaveFolder_label:Label = new Label();
private var photobooth_SaveFolderPath_label:Label = new Label();
private var photobooth_x10HouseCode_label:Label = new Label();
private var photobooth_x10UnitCode_label:Label = new Label();
private var photobooth_WebcamResolution_label:Label = new Label();
private var photobooth_WebcamResolution_dropdown:ComboBox = new ComboBox(); //webcam resolution dropdown
private var photobooth_WebcamFPS_label:Label = new Label();
private var photobooth_CountDownFrom_label:Label = new Label();
private var photobooth_ShotDelay_label:Label = new Label();
private var photobooth_PhotoPreviewDuration_label:Label = new Label();
private var photobooth_ProofPreviewDuration_label:Label = new Label();
private var photobooth_WebcamFPSValue_label:Label = new Label();
private var photobooth_CountDownFromValue_label:Label = new Label();
private var photobooth_ShotDelayValue_label:Label = new Label();
private var photobooth_PhotoPreviewDurationValue_label:Label = new Label();
private var photobooth_ProofPreviewDurationValue_label:Label = new Label();
private var photobooth_PrintingInfo_label:Label = new Label();
private var photobooth_BackgroundImage_label:Label = new Label();
private var photobooth_BackgroundImagePath_label:Label = new Label();
private var photobooth_BackgroundImage_check:CheckBox = new CheckBox();
private var photobooth_StartupText_label:Label = new Label();
private var photobooth_PaperSize_label:Label = new Label();
private var photobooth_StartupText_textarea:TextField = new TextField();
private var photobooth_LogoImage_label:Label = new Label();
private var photobooth_LogoImagePath_label:Label = new Label();
private var photobooth_LogoImage_check:CheckBox = new CheckBox();
private var photobooth_PrintCopies_slider:Slider = new Slider();
private var photobooth_WebcamFPS_slider:Slider = new Slider();
private var photobooth_CountDownFrom_slider:Slider = new Slider();
private var photobooth_ShotDelay_slider:Slider = new Slider();
private var photobooth_PhotoPreviewDuration_slider:Slider = new Slider();
private var photobooth_ProofPreviewDuration_slider:Slider = new Slider();
private var photobooth_videoQuality:Slider = new Slider();
private var photobooth_videoQuality_sliderlabel:Label = new Label();
private var photobooth_videoWidth:TextField = new TextField();
private var photobooth_videoHeight:TextField = new TextField();
private var photobooth_fps:TextField = new TextField();
private var photobooth_countdown:TextField = new TextField();
private var photobooth_print_copies:TextField = new TextField();
private var photoboothShotDelay:TextField = new TextField();
private var photoboothGalleryTimer:TextField = new TextField();
private var photoboothProofDisplayTime:TextField = new TextField();
private var photobooth_videoQuality_label:TextField = new TextField();
private var photobooth_videoWidth_label:TextField = new TextField();
private var photobooth_videoHeight_label:TextField = new TextField();
private var photobooth_fps_label:TextField = new TextField();
private var photobooth_countdown_label:TextField = new TextField();
private var photobooth_print_copies_label:TextField = new TextField();
private var photoboothShotDelay_label:TextField = new TextField();
private var photoboothGalleryTimer_label:TextField = new TextField();
private var photoboothProofDisplayTime_label:TextField = new TextField();
private var photobooth_printing_rbg:RadioButtonGroup = new RadioButtonGroup("photobooth_printing_rbg");
private var SaveButton:Button = new Button();
private var goBackMain:Button = new Button();
private var twitterAuthButton:Button = new Button();
private var tts_engine_voicerss:RadioButton = new RadioButton;
private var tts_engine_yakitome:RadioButton = new RadioButton;
private var flashPlayerVersion:String = Capabilities.version;
private var osArray:Array = flashPlayerVersion.split(' ');
private var osType:String = osArray[0]; //The operating system: WIN, MAC, LNX
private var versionArray:Array = osArray[1].split(',');//The player versions. 9,0,115,0
private var majorVersion:Number = parseInt(versionArray[0]);
private var majorRevision:Number = parseInt(versionArray[1]);
private var minorVersion:Number = parseInt(versionArray[2]);
private var fileMenu:NativeMenuItem;
private var TTS_rbg_engine:RadioButtonGroup = new RadioButtonGroup("TTS_rbg_engine");
private var stock_good_threshold:Number;
private var stock_bad_threshold:Number;
private var bitcoin_good_threshold:Number;
private var bitcoin_bad_threshold:Number;
private var DIYMagicMirrorRoot:File = new File();
private var serproxyCFG:File = new File();
private var Windows64Bit:Boolean;
public function basic_config():void {
//stage.align = StageAlign.TOP_LEFT;
//stage.scaleMode = StageScaleMode.NO_BORDER;
//var window:NativeWindow = stage.nativeWindow;
//window.maximize();
AlertTextFormat.color = 0x000000; //black
AlertTextFormat.font = myFont.fontName;
AlertTextFormat.size = 30; //70 default
AlertManager.overlayAlpha = .8;
AlertManager.maxWidth = 800;
AlertManager.hasDropShadow = true;
AlertManager.setMessageBoxStyle("textFormat", AlertTextFormat);
//output.visible = false;
file = File.documentsDirectory;
file = file.resolvePath("diymagicmirror-settings/mirrorconfig.xml"); //now see if the config file is there
if (file.exists == false) { //config file not there so create it
CreateConfig();
}
switch (osType) {
case "MAC":
file2 = File.desktopDirectory;
file2 = file2.resolvePath("../../../Applications/DIY Magic Mirror/mirror.app/Contents/Resources/");
break;
case "WIN":
file3 = file3 = File.desktopDirectory;
file3 = file3.resolvePath("../../../Program Files/DIY Magic Mirror/mirror/mirror.exe");
file2 = File.desktopDirectory;
file2 = file2.resolvePath("../../../Program Files/DIY Magic Mirror/mirror/");
if (file3.exists == false) { //if still false, then must be 64-bit
file2 = File.desktopDirectory;
file2 = file2.resolvePath("../../../Program Files (x86)/DIY Magic Mirror/mirror/");
Windows64Bit = true;
DIYMagicMirrorRoot = File.desktopDirectory;
DIYMagicMirrorRoot = DIYMagicMirrorRoot.resolvePath("../../../Program Files (x86)/DIY Magic Mirror/");
trace ("we have 64 bit Windows");
}
else {
Windows64Bit = false;
DIYMagicMirrorRoot = File.desktopDirectory;
DIYMagicMirrorRoot = DIYMagicMirrorRoot.resolvePath("../../../Program Files/DIY Magic Mirror/");
trace ("we don't have 64 bit Windows");
}
break;
case "LNX":
file2 = File.desktopDirectory;
file2 = file2.resolvePath("../../../opt/DIY Magic Mirror/mirror/share");
break;
default:
output.text = "Unable to detect OS";
trace ("Unable to detect OS");
file3 = file3 = File.desktopDirectory;
file3 = file3.resolvePath("../../../Program Files/DIY Magic Mirror/mirror/mirror.exe");
file2 = File.desktopDirectory;
file2 = file2.resolvePath("../../../Program Files/DIY Magic Mirror/mirror/");
if (file3.exists == false) { //if still false, then must be 64-bit
file2 = File.desktopDirectory;
file2 = file2.resolvePath("../../../Program Files (x86)/DIY Magic Mirror/mirror/");
}
break;
} //end switch
saveButton.addEventListener(MouseEvent.CLICK, saveValue);
updates_button.addEventListener(MouseEvent.CLICK,updates);
add_stock_button.addEventListener(MouseEvent.CLICK, add_stock);
clear_stock_button.addEventListener(MouseEvent.CLICK, clear_stock);
twitterAuthButton.addEventListener(MouseEvent.CLICK,twitterOauthEvent);
TTSButton.addEventListener(MouseEvent.CLICK, TTSButtonEvent);
LanguageButton.addEventListener(MouseEvent.CLICK, TTSButtonEvent);
photoboothButton.addEventListener(MouseEvent.CLICK, photoboothButtonEvent);
goBackMain.addEventListener(MouseEvent.CLICK, goBackMainScreen);
RunMirror(); //configure the Arduino port and then can do the rest of the config
} // end mirror function *************************************
public function RunMirror():void { //triggered after config file loaded
PhotoSaveDir = File.documentsDirectory; //this is used later for the photobooth path
PhotoSaveDir = PhotoSaveDir.resolvePath("diymagicmirror-settings/Photobooth/Photos");
arduino_detected.text = "Searching...";
radiotext.color = 0x333333;
radiotext.font = "Arial";
radiotext.size = 15;
radiotext2.color = 0xFFFFFF;
radiotext2.font = "Arial";
radiotext2.size = 12;
switch5_radio_on.group = switch5_rgb;
switch5_radio_off.group = switch5_rgb;
switch4_radio_on.group = switch4_rgb;
switch4_radio_off.group = switch4_rgb;
analog1_radio_on.group = analog1_rgb;
analog1_radio_off.group = analog1_rgb;
analog2_radio_on.group = analog2_rgb;
analog2_radio_off.group = analog2_rgb;
analog3_radio_on.group = analog3_rgb;
analog3_radio_off.group = analog3_rgb;
tts_feature_radio_on.group = TTS_rbg;
tts_feature_radio_off.group = TTS_rbg;
photobooth_printing_radio_on.group = photobooth_printing_rbg;
photobooth_printing_radio_off.group = photobooth_printing_rbg;
StartupTextFormat.font = myFont.fontName;
StartupTextFormat.size = 40;
StartupText.autoSize = TextFieldAutoSize.CENTER;
StartupText.embedFonts = true;
StartupText.selectable = false;
StartupTextFormat.color = 0x00CC33; //green
StartupText.antiAliasType = AntiAliasType.ADVANCED;
StartupText.x = 400; //500 default for landscape
StartupText.y = 250; //120 default for landscape
StartupText.defaultTextFormat = StartupTextFormat;
addChild(StartupText);
//StartupText.text = "Looking for the Magic Mirror Sensor Hub...";
//StartupText.visible = true;
//output.text = "Looking for the Magic Mirror Sensor Hub...";
filestream.open(file, FileMode.READ);
myXML = XML(filestream.readUTFBytes(filestream.bytesAvailable));
filestream.close();
CheckConfigVersion();
//trace(myXML);
PopulateValues();
BuildUI();
switch (osType) {
case "WIN":
//copy didn't work due to lack of permissions
if (Windows64Bit == true) {
//serproxyCFGv4 = File.desktopDirectory;
//serproxyCFGv4 = serproxyCFGv4.resolvePath("../../../Program Files (x86)/DIY Magic Mirror/serproxyv4.cfg");
//serproxyCFGv5 = File.desktopDirectory;
//serproxyCFGv5 = serproxyCFGv5.resolvePath("../../../Program Files (x86)/DIY Magic Mirror/serproxyv5.cfg");
serproxyCFG = File.desktopDirectory;
serproxyCFG = serproxyCFG.resolvePath("../../../Program Files (x86)/DIY Magic Mirror/serproxy.cfg");
}
else {
//serproxyCFGv4 = File.desktopDirectory;
//serproxyCFGv4 = serproxyCFGv4.resolvePath("../../../Program Files/DIY Magic Mirror/serproxyv4.cfg");
//serproxyCFGv5 = File.desktopDirectory;
//serproxyCFGv5 = serproxyCFGv5.resolvePath("../../../Program Files/DIY Magic Mirror/serproxyv5.cfg");
serproxyCFG = File.desktopDirectory;
serproxyCFG = serproxyCFG.resolvePath("../../../Program Files/DIY Magic Mirror/serproxy.cfg");
}
/*if (myXML.board_version != "5") {
//serproxyCFGv5.copyTo(serproxyCFG, true);
trace ("we copoied serproxyv4");
}
if (myXML.board_version == "5") {
//serproxyCFGv5.copyTo(serproxyCFG, true); //unfortunately this didn't work due to permissions issue
trace ("we copoied serproxyv5");
trace(serproxyCFGv5.nativePath);
}*/
var serproxyTextLoader:URLLoader = new URLLoader();
serproxyTextLoader.addEventListener(Event.COMPLETE, serproxyTextonLoaded);
serproxyTextLoader.load(new URLRequest(serproxyCFG.nativePath));
break;
} //end switch
twitter_mode_rbg.addEventListener(Event.CHANGE, TwitterModeChanged);
photoboothProofPreview_check.addEventListener(Event.CHANGE, photoboothProofPreview_checkChanged);
photobooth_printing_check.addEventListener(Event.CHANGE, photobooth_printing_checkChanged);
aa = new Arduino("127.0.0.1", 5331); //connect to serial proxy server
aa.addEventListener(Event.CONNECT,onSocketConnect);
aa.addEventListener(Event.CLOSE,onSocketClose);
aa.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFirmwareVersion);
bb = new Arduino("127.0.0.1", 5332); //connect to serial proxy server
bb.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFirmwareVersion);
cc = new Arduino("127.0.0.1", 5333); //connect to serial proxy server
cc.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFirmwareVersion);
dd = new Arduino("127.0.0.1", 5334); //connect to serial proxy server
dd.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFirmwareVersion);
ee = new Arduino("127.0.0.1", 5335); //connect to serial proxy server
ee.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFirmwareVersion);
ff = new Arduino("127.0.0.1", 5336); //connect to serial proxy server
ff.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFirmwareVersion);
gg = new Arduino("127.0.0.1", 5337); //connect to serial proxy server
gg.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFirmwareVersion);
hh = new Arduino("127.0.0.1", 5338); //connect to serial proxy server
hh.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFirmwareVersion);
ii = new Arduino("127.0.0.1", 5339); //connect to serial proxy server
ii.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFirmwareVersion);
SerproxyCheckTimer = new Timer(3000,1);
SerproxyCheckTimer.addEventListener(TimerEvent.TIMER_COMPLETE, noSerproxyEvent);
SerproxyCheckTimer.start();
noArduinoFoundTimer = new Timer(10000,1);
noArduinoFoundTimer.addEventListener(TimerEvent.TIMER_COMPLETE, noArduinoFoundTimerEvent);
noArduinoFoundTimer.start();
TTS_rbg_engine.addEventListener(Event.CHANGE, TTSEngineChanged);
} // ********end RunMirror initMediaPlayer function ***********
private function serproxyTextonLoaded(e:Event):void {
var serproxyArrayOfLines:Array = e.target.data.split(/\n/);
//trace(serproxyArrayOfLines);
/*trace("match is " + serproxyArrayOfLines.indexOf("comm_baud=57600")); //traces the index: 2
trace(serproxyArrayOfLines[serproxyArrayOfLines.indexOf("comm_baud=57600")]);
if ( serproxyArrayOfLines.indexOf("comm_baud=57600") == -1 ) {
trace ("we don't have a match");
}
else {
trace ("we have a match");
}*/
if (myXML.board_version == "5") { //so if we have an Arduino Uno based board, let's check if we have the right baud right in serproxy.cfg
if ( serproxyArrayOfLines.indexOf("comm_baud=57600") == -1 ) { //-1 means no match so we have a problem and need to tell the user
trace ("We have an Arduino Uno board but baud rate in serproxy is not 57600");
AlertManager.createAlert(this, "IMPORTANT!!! Your selected Magic Mirror board / kit version does not match the settings in serproxy.cfg which means the DIY Magic Mirror will not be detected. To resolve, just copy serproxyv5.cfg to serproxy.cfg (overwriting this file) from " + String(DIYMagicMirrorRoot.nativePath) + " and then close serproxy.exe and restart");
//serproxyCFGv5.copyTo(serproxyCFG, true);
}
else {
trace ("We have an Arduino Uno board and serproxy baud is 57600 so we're good");
}
}
if (myXML.board_version != "5") { //so if we have an Arduino Uno based board, let's check if we have the right baud right in serproxy.cfg
if ( serproxyArrayOfLines.indexOf("comm_baud=115200") == -1 ) { //-1 means no match so we have a problem and need to tell the user
trace ("We have an original sensor hub, seeeduino 3.0, older arduino and baud rate in serproxy is not 115200");
AlertManager.createAlert(this, "IMPORTANT!!! Your selected Magic Mirror board / kit version does not match the settings in serproxy.cfg which means the DIY Magic Mirror will not be detected. To resolve, just copy serproxyv4.cfg to serproxy.cfg (overwriting this file) from " + String(DIYMagicMirrorRoot.nativePath) + " and then close serproxy.exe and restart");
//serproxyCFGv4.copyTo(serproxyCFG, true);
}
else {
trace ("We have an original sensor hub, seeeduino 3.0, older arduino and baud rate in serproxy 115200 so we're good");
}
}
}
private function setupComboBox():void { //setup the combo boxes
onoff_house_code_input.addItem( { label: "A", data:1 } );
onoff_house_code_input.addItem( { label: "B", data:2 } );
onoff_house_code_input.addItem( { label: "C", data:3 } );
onoff_house_code_input.addItem( { label: "D", data:4 } );
onoff_house_code_input.addItem( { label: "E", data:5 } );
onoff_house_code_input.addItem( { label: "F", data:6 } );
onoff_house_code_input.addItem( { label: "G", data:7 } );
onoff_house_code_input.addItem( { label: "H", data:8 } );
onoff_house_code_input.addItem( { label: "I", data:9 } );
onoff_house_code_input.addItem( { label: "J", data:10 } );
onoff_house_code_input.addItem( { label: "K", data:11 } );
onoff_house_code_input.addItem( { label: "L", data:12 } );
onoff_house_code_input.addItem( { label: "M", data:13 } );
onoff_house_code_input.addItem( { label: "N", data:14 } );
onoff_house_code_input.addItem( { label: "O", data:15 } );
onoff_house_code_input.addItem( { label: "P", data:16 } );
onoff_unit_code_input.addItem( { label: "1", data:1 } );
onoff_unit_code_input.addItem( { label: "2", data:2 } );
onoff_unit_code_input.addItem( { label: "3", data:3 } );
onoff_unit_code_input.addItem( { label: "4", data:4 } );
onoff_unit_code_input.addItem( { label: "5", data:5 } );
onoff_unit_code_input.addItem( { label: "6", data:6 } );
onoff_unit_code_input.addItem( { label: "7", data:7 } );
onoff_unit_code_input.addItem( { label: "8", data:8 } );
onoff_unit_code_input.addItem( { label: "9", data:9 } );
onoff_unit_code_input.addItem( { label: "10", data:10 } );
onoff_unit_code_input.addItem( { label: "11", data:11 } );
onoff_unit_code_input.addItem( { label: "12", data:12 } );
onoff_unit_code_input.addItem( { label: "13", data:13 } );
onoff_unit_code_input.addItem( { label: "14", data:14 } );
onoff_unit_code_input.addItem( { label: "15", data:15 } );
onoff_unit_code_input.addItem( { label: "16", data:16 } );
photobooth_WebcamResolution_dropdown.addItem( { label: "160", data:0 } );
photobooth_WebcamResolution_dropdown.addItem( { label: "320", data:1 } );
photobooth_WebcamResolution_dropdown.addItem( { label: "480", data:2 } );
photobooth_WebcamResolution_dropdown.addItem( { label: "640", data:3 } );
photobooth_WebcamResolution_dropdown.addItem( { label: "720 HD", data:4 } );
photobooth_WebcamResolution_dropdown.addItem( { label: "1080 HD", data:5 } );
photobooth_PaperSize_dropdown.addItem( { label: "Photo Size 4 x 6", data:0 } );
photobooth_PaperSize_dropdown.addItem( { label: "Letter 8.5 x 11", data:1 } );
/* old Google TTS languages
TTS_languages_dropdown.addItem( { label: "English", data:"en" } );
TTS_languages_dropdown.addItem( { label: "Spanish", data:"es" } );
TTS_languages_dropdown.addItem( { label: "German", data:"de" } );
TTS_languages_dropdown.addItem( { label: "French", data:"fr" } );
TTS_languages_dropdown.addItem( { label: "Italian", data:"it" } );
TTS_languages_dropdown.addItem( { label: "Hindi", data:"hi" } );
TTS_languages_dropdown.addItem( { label: "Afrikaans", data:"af" } );
TTS_languages_dropdown.addItem( { label: "Czech", data:"cs" } );
TTS_languages_dropdown.addItem( { label: "Croatian", data:"hr" } );
TTS_languages_dropdown.addItem( { label: "Dutch", data:"nl" } );
TTS_languages_dropdown.addItem( { label: "Dannish", data:"da" } );
TTS_languages_dropdown.addItem( { label: "Finnish", data:"fi" } );
TTS_languages_dropdown.addItem( { label: "Greek", data:"el" } );
TTS_languages_dropdown.addItem( { label: "Hatian Creole", data:"ht" } );
TTS_languages_dropdown.addItem( { label: "Hungarian", data:"hu" } );
TTS_languages_dropdown.addItem( { label: "Indonesian", data:"id" } );
TTS_languages_dropdown.addItem( { label: "Islandic", data:"is" } );
TTS_languages_dropdown.addItem( { label: "Latvian", data:"lv" } );
TTS_languages_dropdown.addItem( { label: "Macedonian", data:"mk" } );
TTS_languages_dropdown.addItem( { label: "Norweigen", data:"no" } );
TTS_languages_dropdown.addItem( { label: "Polish", data:"pl" } );
TTS_languages_dropdown.addItem( { label: "Portugese", data:"pt" } );
TTS_languages_dropdown.addItem( { label: "Romanian", data:"ro" } );
TTS_languages_dropdown.addItem( { label: "Serbian", data:"sr" } );
TTS_languages_dropdown.addItem( { label: "Slovak", data:"sk" } );
TTS_languages_dropdown.addItem( { label: "Russian", data:"ru" } );
TTS_languages_dropdown.addItem( { label: "Swahili", data:"sw" } );
TTS_languages_dropdown.addItem( { label: "Swedish", data:"sv" } );
TTS_languages_dropdown.addItem( { label: "Turkish", data:"tr" } );
TTS_languages_dropdown.addItem( { label: "Vietnamese", data:"vi" } );*/
var ttsEngine:String = myXML.tts_engine;
if (ttsEngine == "voicerss") {
populateVoiceRSSLanguageDropdown(); //put these into a function as we need to call from other places too so it will make maintenance easier if these ever change
trace("went to initial xml population for voicerss");
}
else if (ttsEngine == "yakitome") {
populateYakitomeLanguageDropdown();
trace("went to initial xml population for Y");
}
else {
trace("oops, we couldn't find the default TTS engine to use, let's use voice RSS by default");
populateVoiceRSSLanguageDropdown();
}
}
private function BuildUI():void {
//setting the tab order
woeid_input.tabIndex = 1;
stock_good_threshold_input.tabIndex = 2;
stock_bad_threshold_input.tabIndex = 3;
bitcoin_amount_input.tabIndex = 4;
bitcoin_good_threshold_input.tabIndex = 5;
bitcoin_bad_threshold_input.tabIndex = 6;
enter_stock_input.tabIndex = 7;
TTSTextFormat.font = myFont.fontName;
TTSTextFormat.size = 14;
TTSTextFormat.color = 0x000000; //black
TTSTextLabelFormat.font = myFont.fontName;
TTSTextLabelFormat.size = 14;
TTSTextLabelFormat.color = 0xFFFFFF; //white
photoboothTextLabelFormat.font = myFont.fontName;
photoboothTextLabelFormat.size = 14;
photoboothTextLabelFormat.color = 0xFFFFFF; //white
photobooth_Screen_LabelFormat.font = myFont.fontName;
photobooth_Screen_LabelFormat.size = 36;
photobooth_Screen_LabelFormat.color = 0xFFFFFF; //white
TTS_Screen_LabelFormat.font = myFont.fontName;
TTS_Screen_LabelFormat.size = 20;
TTS_Screen_LabelFormat.color = 0xFFFFFF; //white
SaveButton.x = 470.45;
//SaveButton.y = 610;
SaveButton.y = 610;
SaveButton.width = 133.95;
SaveButton.height = 36.10;
SaveButton.label = "Save";
addChild(SaveButton);
SaveButton.visible = false;
only_my_tweets_checkbox.x = 566.35;
only_my_tweets_checkbox.y = 178.35;
only_my_tweets_checkbox.width = 204.15;
only_my_tweets_checkbox.height = 22;
only_my_tweets_checkbox.label = "Just My Tweets";
addChild(only_my_tweets_checkbox);
//only_my_tweets_checkbox.visible = true;
only_my_tweets_checkbox.visible = false;
do_not_speak_twitter_search_term_checkbox.x = 647.40;
do_not_speak_twitter_search_term_checkbox.y = 201.91;
do_not_speak_twitter_search_term_checkbox.width = 179.15;
do_not_speak_twitter_search_term_checkbox.height = 22;
do_not_speak_twitter_search_term_checkbox.label = "Don't Speak Search Term";
addChild(do_not_speak_twitter_search_term_checkbox);
do_not_speak_twitter_search_term_checkbox.visible = true;
//do_not_speak_twitter_search_term_checkbox.visible = false;
tweetBreathalyzer_checkbox.x = 439.90;
tweetBreathalyzer_checkbox.y = 258.35;
tweetBreathalyzer_checkbox.width = 186.85;
tweetBreathalyzer_checkbox.height = 22;
tweetBreathalyzer_checkbox.label = "Tweet My Breathalyzer Results";
addChild(tweetBreathalyzer_checkbox);
tweetBreathalyzer_checkbox.visible = true;
//tweetBreathalyzer_checkbox.visible = false;
StandAloneCheck.x = 428.90;
StandAloneCheck.y = 303;
StandAloneCheck.width = 590.05;
StandAloneCheck.height = 22;
StandAloneCheck.label = "Stand Alone Mode (For using Twitter feature without Magic Mirror hardware)";
//StandAloneCheck.label = "Stand Alone Mode (For using without Sensor Hub/Arduino Hardware)";
addChild(StandAloneCheck);
StandAloneCheck.visible = true;
SaveButton.addEventListener(MouseEvent.CLICK, saveValue); //this is the save button in the TTS screen
goBackMain.x = 680;
goBackMain.y = 4.85;
goBackMain.width = 99.90;
goBackMain.height = 22;
goBackMain.label = "Go Back";
addChild(goBackMain);
goBackMain.visible = false;
twitterAuthButton.x = 439.65;
twitterAuthButton.y = 148.85;
twitterAuthButton.width = 139.80;
twitterAuthButton.height = 22;
twitterAuthButton.label = "Link Twitter Account";
addChild(twitterAuthButton);
twitterAuthButton.visible = true;
//twitterAuthButton.visible = false;
twitter_mode_radio_user.group = twitter_mode_rbg;
twitter_mode_radio_search.group = twitter_mode_rbg;
twitter_mode_radio_mentions.group = twitter_mode_rbg;
twitter_mode_radio_user.x = 439.90;
twitter_mode_radio_user.y = 179.35;
twitter_mode_radio_user.label = "";
twitter_mode_radio_search.x = 439.90;
twitter_mode_radio_search.y = 203;
twitter_mode_radio_search.label = "";
twitter_mode_radio_mentions.x = 439.90;
twitter_mode_radio_mentions.y = 230.25;
twitter_mode_radio_mentions.label = "";
addChild (twitter_mode_radio_user);
addChild (twitter_mode_radio_search);
addChild (twitter_mode_radio_mentions);
twitter_mode_radio_user.visible = true;
twitter_mode_radio_search.visible = true;
twitter_mode_radio_mentions.visible = true;
tts_feature_radio_on.group = TTS_rbg;
tts_feature_radio_off.group = TTS_rbg;
tts_engine_voicerss.group = TTS_rbg_engine;
tts_engine_yakitome.group = TTS_rbg_engine;
tts_feature_radio_on.x = 250;
tts_feature_radio_on.y = 234.65;
tts_feature_radio_on.setStyle("textFormat", radiotext);
tts_feature_radio_on.textField.autoSize = TextFieldAutoSize.LEFT;
tts_feature_radio_on.label = "ON";
tts_feature_radio_off.x = 330;
tts_feature_radio_off.y = 234.65;
tts_feature_radio_off.setStyle("textFormat", radiotext);
tts_feature_radio_off.textField.autoSize = TextFieldAutoSize.LEFT;
tts_feature_radio_off.label = "OFF";
tts_engine_voicerss.x = 240;
tts_engine_voicerss.y = 35;
tts_engine_voicerss.setStyle("textFormat", radiotext2);
tts_engine_voicerss.textField.autoSize = TextFieldAutoSize.LEFT;
tts_engine_voicerss.label = "VoiceRSS";
tts_engine_yakitome.x = 360;
tts_engine_yakitome.y = 35;
tts_engine_yakitome.setStyle("textFormat", radiotext2);
tts_engine_yakitome.textField.autoSize = TextFieldAutoSize.LEFT;
tts_engine_yakitome.label = "Yakitome (has delay)";
addChild (tts_feature_radio_on);
addChild (tts_feature_radio_off);
tts_feature_radio_on.visible = true;
tts_feature_radio_off.visible = true;
addChild (tts_engine_voicerss);
addChild (tts_engine_yakitome);
tts_engine_voicerss.visible = false;
tts_engine_yakitome.visible = false;
setupComboBox();
TTS_Screen_Label.embedFonts = true;
TTS_Screen_Label.antiAliasType = AntiAliasType.ADVANCED;
TTS_Screen_Label.defaultTextFormat = TTS_Screen_LabelFormat;
TTS_Screen_Label.x = 10;
TTS_Screen_Label.y = 10;
TTS_Screen_Label.width = 400;
TTS_Screen_Label.height = 22;
TTS_Screen_Label.text = "Text to Speech Settings";
addChild(TTS_Screen_Label);
TTS_Screen_Label.visible = false;
tts_feature_label.embedFonts = true;
tts_feature_label.antiAliasType = AntiAliasType.ADVANCED;
tts_feature_label.defaultTextFormat = TTSTextLabelFormat;
tts_feature_label.x = 10;
tts_feature_label.y = 35;
tts_feature_label.width = 180;
tts_feature_label.height = 18;
tts_feature_label.text = "Text to Speech Engine";
addChild(tts_feature_label);
tts_feature_label.visible = false;
tts_url_label.embedFonts = true;
tts_url_label.antiAliasType = AntiAliasType.ADVANCED;
tts_url_label.defaultTextFormat = TTSTextLabelFormat;
tts_url_label.x = 10;
tts_url_label.y = 70;
tts_url_label.width = 200;
tts_url_label.height = 18;
tts_url_label.text = "TTS Web Service URL";
addChild(tts_url_label);
tts_url_label.visible = false;
tts_url.embedFonts = true;
tts_url.selectable = true;
tts_url.type = TextFieldType.INPUT;
tts_url.background = true;
tts_url.backgroundColor = 0xFFFFFF; //white
tts_url.antiAliasType = AntiAliasType.ADVANCED;
tts_url.defaultTextFormat = TTSTextFormat;
tts_url.x = 200;
tts_url.y = 70;
tts_url.width = 600;
tts_url.height = 18;
tts_url.text = myXML.tts_url;
addChild(tts_url);
tts_url.visible = false;
tts_language_label.embedFonts = true;
tts_language_label.antiAliasType = AntiAliasType.ADVANCED;
tts_language_label.defaultTextFormat = TTSTextLabelFormat;
tts_language_label.x = 10;
tts_language_label.y = 60;
tts_language_label.width = 200;
tts_language_label.height = 18;
tts_language_label.text = "TTS/Twitter Language";
addChild(tts_language_label);
tts_language_label.visible = false;
/*tts_engine_label.embedFonts = true;
tts_engine_label.antiAliasType = AntiAliasType.ADVANCED;
tts_engine_label.defaultTextFormat = TTSTextLabelFormat;
tts_engine_label.x = 10;
tts_engine_label.y = 120;
tts_engine_label.width = 100;
tts_engine_label.height = 18;
tts_engine_label.text = "TTS Engine";
addChild(tts_engine_label);
tts_engine_label.visible = false;*/
TTS_languages_dropdown.dropdownWidth = 210;
TTS_languages_dropdown.width = 200;
TTS_languages_dropdown.x = 200;
TTS_languages_dropdown.y = 60;
//TTS_languages_dropdown.prompt = "Select Language";
//TTS_languages_dropdown.addEventListener(Event.CHANGE, changeHandler);
addChild(TTS_languages_dropdown);
TTS_languages_dropdown.visible = false;
tts_api_key_label.embedFonts = true; //to do
tts_api_key_label.antiAliasType = AntiAliasType.ADVANCED;
tts_api_key_label.defaultTextFormat = TTSTextLabelFormat;
tts_api_key_label.x = 10;
tts_api_key_label.y = 100;
tts_api_key_label.width = 200;
tts_api_key_label.height = 18;
tts_api_key_label.text = "Voice RSS API Key";
addChild(tts_api_key_label);
tts_api_key_label.visible = false;
tts_api_key.embedFonts = true;
tts_api_key.selectable = true;
tts_api_key.type = TextFieldType.INPUT;
tts_api_key.background = true;
tts_api_key.backgroundColor = 0xFFFFFF; //white
tts_api_key.maxChars = 100;
tts_api_key.antiAliasType = AntiAliasType.ADVANCED;
tts_api_key.defaultTextFormat = TTSTextFormat;
tts_api_key.x = 200;
tts_api_key.y = 100;
tts_api_key.width = 250;
tts_api_key.height = 18;
tts_api_key.text = myXML.ttsrss_apikey;
addChild(tts_api_key);
tts_api_key.visible = false;
tts_api_key_labelYakitome.embedFonts = true; //to do
tts_api_key_labelYakitome.antiAliasType = AntiAliasType.ADVANCED;
tts_api_key_labelYakitome.defaultTextFormat = TTSTextLabelFormat;
tts_api_key_labelYakitome.x = 480;
tts_api_key_labelYakitome.y = 100;
tts_api_key_labelYakitome.width = 170;
tts_api_key_labelYakitome.height = 18;
tts_api_key_labelYakitome.text = "Yakitome API Key";
addChild(tts_api_key_labelYakitome);
tts_api_key_labelYakitome.visible = false;
tts_api_keyYakitome.embedFonts = true;
tts_api_keyYakitome.selectable = true;
tts_api_keyYakitome.type = TextFieldType.INPUT;
tts_api_keyYakitome.background = true;
tts_api_keyYakitome.backgroundColor = 0xFFFFFF; //white
tts_api_keyYakitome.maxChars = 100;
tts_api_keyYakitome.antiAliasType = AntiAliasType.ADVANCED;
tts_api_keyYakitome.defaultTextFormat = TTSTextFormat;