Permalink
Browse files

commit to avoid losing it all! this is a mess!

  • Loading branch information...
0 parents commit 5b1fc61e9a98e1969126ae1517c4c899bdfad650 @swook committed Nov 7, 2011
Showing with 8,630 additions and 0 deletions.
  1. +11 −0 LICENSE
  2. +13 −0 Plasma.as
  3. +13 −0 Scripts/Anim.as
  4. +45 −0 Scripts/Anim/BasicTween.as
  5. +20 −0 Scripts/Anim/Common.as
  6. +63 −0 Scripts/Anim/Loop.as
  7. +53 −0 Scripts/Anim/TextField.as
  8. +60 −0 Scripts/Anim/Tween.as
  9. +22 −0 Scripts/Core.as
  10. +186 −0 Scripts/Core/Data.as
  11. +93 −0 Scripts/Core/Display.as
  12. +80 −0 Scripts/Core/Init.as
  13. +123 −0 Scripts/Core/JetEffect.as
  14. +123 −0 Scripts/Core/Key.as
  15. +193 −0 Scripts/Core/Mode.as
  16. +98 −0 Scripts/Core/Music.as
  17. +56 −0 Scripts/Core/System.as
  18. +56 −0 Scripts/Core/Time.as
  19. +81 −0 Scripts/Core/Utility.as
  20. +107 −0 Scripts/Core/Volume.as
  21. +14 −0 Scripts/Cowon.as
  22. +1,411 −0 Scripts/Cowon/C2.as
  23. +8 −0 Scripts/Cowon/Common.as
  24. +1,573 −0 Scripts/Cowon/J3.as
  25. +1,409 −0 Scripts/Cowon/S9.as
  26. +1,392 −0 Scripts/Cowon/X7.as
  27. +950 −0 Scripts/Cowon/i9.as
  28. +12 −0 Scripts/Launcher.as
  29. +8 −0 Scripts/Launcher/Loader.as
  30. +25 −0 Scripts/Launcher/Plasmoid.as
  31. +8 −0 Scripts/Launcher/Switcher.as
  32. +20 −0 Scripts/Music.as
  33. +58 −0 Scripts/Music/A-B.as
  34. +15 −0 Scripts/Music/Bookmark.as
  35. +14 −0 Scripts/Music/Favorite.as
  36. +180 −0 Scripts/Music/Playback.as
  37. +37 −0 Scripts/Music/Settings.as
  38. BIN launcher_240x320/240x320.jpg
  39. BIN launcher_240x320/240x320.png
  40. BIN launcher_240x320/launcher.fla
  41. BIN launcher_272x480/272x480.jpg
  42. BIN launcher_272x480/272x480.png
  43. BIN launcher_272x480/launcher.fla
  44. BIN launcher_272x480/launcher.swf
  45. BIN launcher_272x480/launcher_Scene 1.swf
  46. BIN launcher_320x240/320x240.jpg
  47. BIN launcher_320x240/320x240.png
  48. BIN launcher_320x240/launcher.fla
11 LICENSE
@@ -0,0 +1,11 @@
+This work is licensed under the Creative
+Commons Attribution-ShareAlike 3.0 Unported
+License. To view a copy of this license, visit
+http://creativecommons.org/licenses/by-sa/3.0/
+or send a letter to
+
+Creative Commons,
+444 Castro Street,
+Suite 900, Mountain View,
+California, 94041,
+USA.
13 Plasma.as
@@ -0,0 +1,13 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Plasma.as - File to #include on stage
+ */
+
+#include "./Scripts/Core.as"
+#include "./Scripts/Music.as"
+#include "./Scripts/Anim.as"
+#include "./Scripts/Launcher.as"
+#include "./Scripts/Cowon.as"
13 Scripts/Anim.as
@@ -0,0 +1,13 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Anim.as - All Animations
+ */
+
+#include "./Anim/Common.as"
+#include "./Anim/Tween.as"
+#include "./Anim/BasicTween.as"
+#include "./Anim/Loop.as"
+#include "./Anim/TextField.as"
45 Scripts/Anim/BasicTween.as
@@ -0,0 +1,45 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Anim/BasicTween.as - Basic Tween Management
+ */
+
+Anim.addProperty( "Speed",
+ function ():Number {
+ var setting:Number = Data.Get( "AnimSpeed" );
+ if ( isNaN( setting ) ) {
+ Data.Set( "AnimSpeed", 1 );
+ setting = 1;
+ }
+ return setting;
+ },
+ function ():Void {} );
+
+Anim.TweenTo = function ( mc:MovieClip, property:String, target:Number,
+ speed:Number, ease:Function ):Void {
+ speed = ( isNaN( speed ) ) ? 1.0 : speed;
+ var dur:Number = speed * Anim.Speed;
+ Anim.Tween( mc, property, ease, mc[ property ], target, dur );
+}
+
+Anim.FadeTo = function ( mc:MovieClip, targetalpha:Number, speed:Number ) {
+ if ( isNaN( targetalpha ) || targetalpha < 0 || targetalpha > 100 )
+ targetalpha = 0;
+ speed = ( isNaN( speed ) ) ? 1.0 : speed;
+ Anim.TweenTo( mc, "_alpha", targetalpha );
+}
+
+Anim.FadeIn = function ( mc:MovieClip, speed:Number ) {
+ speed = ( isNaN( speed ) ) ? 1.0 : speed;
+ mc._alpha = 0;
+ Anim.TweenTo( mc, "_alpha", 100, speed );
+}
+
+Anim.FadeOut = function ( mc:MovieClip, speed:Number ) {
+ speed = ( isNaN( speed ) ) ? 1.0 : speed;
+ mc._alpha = 100;
+ Anim.TweenTo( mc, "_alpha", 0, speed );
+}
+
20 Scripts/Anim/Common.as
@@ -0,0 +1,20 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Anim/Common.as - Common Methods and Other Methods
+ */
+
+
+import mx.transitions.easing.*;
+
+var Anim:Object = {};
+
+Anim.Stop = function ( mc:MovieClip ):Void {
+ Anim.StopTween( mc );
+ Anim.StopLoop( mc );
+}
+
+
+
63 Scripts/Anim/Loop.as
@@ -0,0 +1,63 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Anim/Loop.as - Looping Functionality
+ */
+
+Anim.BeingLooped = {};
+
+Anim.Loop = function ( mc:MovieClip, prop:String, easing:Function,
+ startval:Number, endval:Number, duration:Number ):Void {
+ var idx:String = mc._name +"."+ prop;
+ if ( Anim.BeingLooped[ idx ] != undefined )
+ delete Anim.BeingLooped[ idx ];
+
+ mc[ prop ] = startval;
+ mc._visible = true;
+ var change:Number = endval - startval;
+ Anim.BeingLooped[ idx ] = {
+ idx: idx,
+ t: 0,
+ last_t: Time.Ticks,
+ mc: mc,
+ prop: prop,
+ begin: startval,
+ change: change,
+ end: endval,
+ easing: ( easing ) ? easing : None.easeInOut,
+ duration: duration * 1000,
+ direction: 1
+ };
+}
+
+Anim.ProcessLoop = function ( loop:Object ):Void {
+ if ( !loop.mc || !loop.mc._visible ) return;
+
+ loop.t += Time.Ticks - loop.last_t;
+ loop.last_t = Time.Ticks;
+ if ( loop.t >= loop.duration ) {
+ loop.direction = -loop.direction;
+ loop.t = 0;
+ }
+ loop.mc[ loop.prop ] = loop.easing( loop.t, ( loop.direction > 0 ) ? loop.begin : loop.end,
+ loop.direction * loop.change, loop.duration );
+}
+
+Anim.StopLoop = function ( mc:MovieClip ):Void {
+ var match:String;
+ for ( var idx:String in Anim.BeingLooped ) {
+ match = idx.substr( 0, idx.lastIndexOf( "." ) );
+ if ( match == mc._name )
+ delete Anim.BeingLooped[ idx ];
+ }
+}
+
+Do_Periodic( 1, function ():Void {
+ var loop:Object;
+ for ( var idx:String in Anim.BeingLooped ) {
+ loop = Anim.BeingLooped[ idx ];
+ Anim.ProcessLoop( loop );
+ }
+} );
53 Scripts/Anim/TextField.as
@@ -0,0 +1,53 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Anim/TextField.as - TextField Animations
+ */
+
+Anim.TextScrollList = {};
+
+Anim.TextScroll = function ( tf:TextField ):Void {
+ var idx:String = tf._name;
+ var max:Number = tf.maxhscroll;
+ Anim.StopTextScroll( tf );
+
+ Anim.TextScrollList[ idx ] = {
+ idx: tf._name,
+ t: 0,
+ last_t: Time.Ticks,
+ tf: tf,
+ duration: max * 100,
+ direction: 1
+ };
+}
+
+Anim.ProcessTextScroll = function ( loop:Object ):Void {
+ if ( !loop.tf ) delete Anim.TextScrollList[ loop.idx ];
+ if ( !loop.tf._visible ) return;
+ var max:Number = loop.tf.maxhscroll;
+ if ( max == 0 ) return;
+ loop.end = max;
+
+ loop.t += Time.Ticks - loop.last_t;
+ loop.last_t = Time.Ticks;
+ if ( loop.t >= loop.duration ) {
+ loop.direction = -loop.direction;
+ loop.t = 0;
+ }
+ loop.tf.hscroll = None.easeInOut( loop.t, ( loop.direction > 0 ) ? 0 : max,
+ loop.direction * max, loop.duration );
+}
+
+Anim.StopTextScroll = function ( tf:TextField ):Void {
+ delete Anim.TextScrollList[ tf._name ];
+}
+
+Do_Periodic( 1, function ():Void {
+ var loop:Object;
+ for ( var idx:String in Anim.TextScrollList ) {
+ loop = Anim.TextScrollList[ idx ];
+ Anim.ProcessTextScroll( loop );
+ }
+} );
60 Scripts/Anim/Tween.as
@@ -0,0 +1,60 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Anim/Tween.as - Tweening Functionality
+ */
+
+Anim.BeingTweened = {};
+
+Anim.Tween = function ( mc:MovieClip, prop:String, easing:Function,
+ startval:Number, endval:Number, duration:Number ):Void {
+ var idx:String = mc._name +"."+ prop;
+ if ( Anim.BeingTweened[ idx ] != undefined )
+ delete Anim.BeingTweened[ idx ];
+
+ mc[ prop ] = startval;
+ mc._visible = true;
+ var change:Number = endval - startval;
+ Anim.BeingTweened[ idx ] = {
+ idx: idx,
+ start_t: Time.Ticks,
+ mc: mc,
+ prop: prop,
+ begin: startval,
+ change: change,
+ end: endval,
+ easing: ( easing ) ? easing : None.easeInOut,
+ duration: duration * 1000
+ };
+}
+
+Anim.ProcessTween = function ( tween:Object ):Void {
+ if ( !tween.mc || !tween.mc._visible ) Anim.StopTween( tween.mc );
+
+ var t:Number = Time.Ticks - tween.start_t;
+ if ( t >= tween.duration ) {
+ tween.mc[ tween.prop ] = tween.end;
+ delete Anim.BeingTweened[ tween.idx ];
+ return;
+ }
+ tween.mc[ tween.prop ] = tween.easing( t, tween.begin, tween.change, tween.duration );
+}
+
+Anim.StopTween = function ( mc:MovieClip ):Void {
+ var match:String;
+ for ( var idx:String in Anim.BeingTweened ) {
+ match = idx.substr( 0, idx.lastIndexOf( "." ) );
+ if ( match == mc._name )
+ delete Anim.BeingTweened[ idx ];
+ }
+}
+
+Do_Periodic( 1, function ():Void {
+ var tween:Object;
+ for ( var idx:String in Anim.BeingTweened ) {
+ tween = Anim.BeingTweened[ idx ];
+ Anim.ProcessTween( tween );
+ }
+} );
22 Scripts/Core.as
@@ -0,0 +1,22 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core.as - Core Functionality
+ */
+
+if ( _global.Plasma == undefined )
+ _global.Plasma = new Object();
+
+#include "./Core/Data.as"
+#include "./Core/Utility.as"
+#include "./Core/Mode.as"
+#include "./Core/System.as"
+#include "./Core/Display.as"
+#include "./Core/Volume.as"
+#include "./Core/Time.as"
+#include "./Core/Music.as"
+#include "./Core/Key.as"
+#include "./Core/JetEffect.as"
+#include "./Core/Init.as"
186 Scripts/Core/Data.as
@@ -0,0 +1,186 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/Data.as - Data/Settings Management
+ */
+
+var Data:Object = {};
+Data.Loaded = {};
+
+// Public method
+// USE THIS ONE NOT Data._Set!
+Data.Set = function ( setting:String, data, filen:String ) {
+ return Data.CheckLoaded( filen ).Set( setting, data );
+}
+
+// Public method
+// USE THIS ONE NOT Data._Unset!
+Data.Unset = function ( setting:String, filen:String ):Boolean {
+ return Data.CheckLoaded( filen ).Unset( setting );
+}
+
+// Public method
+// USE THIS ONE NOT Data._Get!
+Data.Get = function ( setting:String, filen:String ) {
+ return Data.CheckLoaded( filen ).Get( setting );
+}
+
+
+/**********************************************************
+ * Do not use the functions below, they are for processing
+ * the public functions Data.Set, Data.Unset and Data.Get
+ ***********************************************************/
+
+Data.MaxUnsavedChanges = 8; // 8 changes
+Data.MaxDelayTillSave = 15000; // 15 seconds
+Data.MaxDelayTillUnload = 120000; // 2 minutes
+
+Data.CheckLoaded = function ( filen:String ):Object {
+ if ( filen ) {
+ if ( filen != UCI_NAME ) // If name provided and not UCI name
+ filen = UCI_NAME + "_" + filen; // Use UCI's name + _name
+ } // Eg. "data" for a UCI called "ABC"
+ else // would produce "ABC_data.so"
+ filen = UCI_NAME; // Use UCI name for SO file
+
+ if ( Data.Loaded[ filen ] == undefined ) {
+ Data.Loaded[ filen ] = {};
+ var obj:Object = Data.Loaded[ filen ];
+ obj.sobj = SharedObject.getLocal( filen );
+ obj.name = filen;
+ obj.changed = 0;
+ obj.lastSaved = getTimer();
+
+ obj.Set = Data._Set;
+ obj.Get = Data._Get;
+ obj.Unset = Data._Unset;
+ }
+ return Data.Loaded[ filen ];
+}
+
+Data._Set = function ( setting:String, data ) {
+ if ( this.sobj.data[ setting ] != data ) {
+ this.sobj.data[ setting ] = data;
+ this.changed++;
+ }
+ return data;
+}
+
+Data._Unset = function ( setting:String ):Boolean {
+ if ( this.sobj.data[ setting ] ) {
+ delete this.sobj.data[ setting ];
+ return this.sobj.flush();
+ }
+ else return false;
+}
+
+Data._Get = function ( setting:String ) {
+ return this.sobj.data[ setting ];
+}
+
+Data.Sync = function ():Void {
+ var chksync:Function = function ( obj:Object ):Number {
+ var tdiff:Number = getTimer() - obj.lastSaved;
+ if ( obj.changed == 0 ) return tdiff;
+ if ( obj.changed > Data.MaxUnsavedChanges || tdiff > Data.MaxDelayTillSave ) {
+ if ( obj.sobj.flush() ) {
+ obj.changed = 0;
+ obj.lastSaved = getTimer();
+ }
+ }
+ return tdiff;
+ }
+
+ var sync:Function = function ( obj:Object ):Void {
+ var dobj:Object;
+ var tdiff:Number;
+ for ( var n:String in obj.Loaded ) {
+ dobj = obj.Loaded[ n ];
+ tdiff = chksync( dobj );
+ if ( tdiff > Data.MaxDelayTillUnload && dobj.changed == 0 ) {
+ dobj.sobj.clear();
+ delete obj.Loaded[ n ];
+ }
+ }
+ }
+ sync( Data );
+ sync( Plasma.Data );
+ chksync( Plasma.Data );
+}
+
+Data.Unload = function ():Void {
+ var unload:Function = function ( obj:Object ):Void {
+ var dobj:Object;
+ for ( var n:String in obj.Loaded ) {
+ dobj = obj.Loaded[ n ];
+ if ( dobj.changed > 0 )
+ dobj.sobj.flush();
+ dobj.sobj.clear();
+ delete obj.Loaded[ n ];
+ }
+ }
+ unload( Data );
+ unload( Plasma.Data );
+
+ if ( Plasma.Data.changed > 0 )
+ Plasma.Data.sobj.flush(); // Save Plasma.Data to disk
+} // but don't close for future
+
+
+/* Plasma only. Not for UCIs */
+
+Plasma.Data = {};
+
+Plasma.Data.name = "Plasma";
+Plasma.Data.sobj = SharedObject.getLocal( Plasma.Data.name ); // Load shared obj. This stays
+Plasma.Data.changed = 0;
+Plasma.Data.lastSaved = getTimer();
+Plasma.Data.Loaded = {};
+
+Plasma.Data.CheckLoaded = function ( filen:String ):Object {
+ filen = "Plasma_"+ filen;
+ if ( Plasma.Data.Loaded[ filen ] == undefined ) {
+ Plasma.Data.Loaded[ filen ] = {};
+ var obj:Object = Plasma.Data.Loaded[ filen ];
+ obj.sobj = SharedObject.getLocal( filen );
+ obj.name = filen;
+ obj.changed = 0;
+ obj.lastSaved = getTimer();
+
+ obj.Set = Data._Set;
+ obj.Get = Data._Get;
+ obj.Unset = Data._Unset;
+ }
+ return Plasma.Data.Loaded[ filen ];
+}
+
+Plasma.Data.Set = function ( setting:String, data, filen:String ) {
+ if ( filen )
+ return Plasma.Data.CheckLoaded( filen ).Set( setting, data );
+
+ if ( Plasma.Data.sobj.data[ setting ] != data ) {
+ Plasma.Data.sobj.data[ setting ] = data;
+ Plasma.Data.changed++;
+ }
+ return data;
+}
+
+Plasma.Data.Unset = function ( setting:String ) {
+ if ( filen )
+ return Plasma.Data.CheckLoaded( filen ).Set( setting, data );
+
+ if ( Plasma.Data.sobj.data[ setting ] == undefined )
+ return true;
+
+ delete Plasma.Data.sobj.data[ setting ];
+}
+
+Plasma.Data.Get = function ( setting:String ) {
+ if ( filen )
+ return Plasma.Data.CheckLoaded( filen ).Get( setting );
+
+ return this.sobj.data[ setting ];
+}
+
93 Scripts/Core/Display.as
@@ -0,0 +1,93 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/Display.as - UCI Display Manipulation and Properties
+ */
+
+Sys.Display = {};
+
+Sys.Display.addProperty( "Brightness",
+ function ():Number {
+ var trans:Object = Sys.Display.Color;
+ trans.rb += 255;
+ trans.gb += 255;
+ trans.bb += 255;
+ var max:Number = Misc.Math.highest( [ trans.rb, trans.gb, trans.bb ] );
+ return int( max / 2.55 );
+ },
+ function ( num:Number ):Void {
+ if ( isNaN( num ) ) return;
+ if ( num < 0 ) num = 0;
+ else if ( num > 100 ) num = 100;
+ var trans:Object = Sys.Display.Color;
+ trans.rb += 255;
+ trans.gb += 255;
+ trans.bb += 255;
+ var scale:Number = 2.55 / Misc.Math.highest( [ trans.rb, trans.gb, trans.bb ] ) * num;
+ trans.rb = trans.rb * max - 255;
+ trans.gb = trans.gb * max - 255;
+ trans.bb = trans.bb * max - 255;
+ Sys.Display.Color = trans;
+ } );
+
+Sys.Display.addProperty( "Color",
+ function ():Object {
+ if ( Sys.Display.Color_ == undefined ) {
+ Sys.Display.Color_ = new Color( UI );
+ var trans:Object = {
+ ra: 100,
+ rb: 0,
+ ga: 100,
+ gb: 0,
+ ba: 100,
+ bb: 0,
+ aa: 100,
+ ab: 0
+ };
+ Sys.Display.Color_.setTransform( trans );
+ return trans;
+ }
+ return Sys.Display.Color_.getTransform();
+ },
+ function ( trans:Object ):Void {
+ Sys.Display.Color_.setTransform( trans );
+ } );
+
+Sys.Display.addProperty( "RGB",
+ function ():Number {
+ var trans:Object = Sys.Display.Color;
+ return ( trans.rb + 255 ) << 16 | ( trans.gb + 255 ) << 8 | ( trans.bb + 255 );
+ },
+ function ( num:Number ):Void {
+ var trans:Object = Sys.Display.Color;
+ trans.rb = ( num >> 16 ) - 255;
+ trans.gb = ( ( num >> 8 ) & 0xff ) - 255;
+ trans.bb = ( num & 0xff ) - 255;
+ Sys.Display.Color = trans;
+ } );
+
+Sys.Display.addProperty( "Red",
+ function ():Number { return Sys.Display.Color.rb + 255; },
+ function ( num:Number ):Void {
+ var trans:Object = Sys.Display.Color;
+ trans.rb = num - 255;
+ Sys.Display.Color = trans;
+ } );
+
+Sys.Display.addProperty( "Green",
+ function ():Number { return Sys.Display.Color.gb + 255; },
+ function ( num:Number ):Void {
+ var trans:Object = Sys.Display.Color;
+ trans.gb = num - 255;
+ Sys.Display.Color = trans;
+ } );
+
+Sys.Display.addProperty( "Blue",
+ function ():Number { return Sys.Display.Color.bb + 255; },
+ function ( num:Number ):Void {
+ var trans:Object = Sys.Display.Color;
+ trans.bb = num - 255;
+ Sys.Display.Color = trans;
+ } );
80 Scripts/Core/Init.as
@@ -0,0 +1,80 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/Init.as - Core Initialisation Methods
+ */
+
+
+if ( !UCI_NAME )
+ var UCI_NAME:String = "Plasma_" + new Date().getTime(); // Set some UCI name
+
+
+// For: Mode.as
+// Mode Init
+{
+ switch ( Sys.State ) {
+ case 0: // No state
+ case 1: // Music/Video Playing
+ case 2: // Music/Video Paused
+ case 3: // Music/Video Stopped
+ case 6: // Reserved state
+ Mode.Music = true;
+ break;
+ case 4: // Radio
+ case 5: // Radio Recording
+ Mode.Radio = true;
+ break;
+ case 7: // Recording
+ case 8: // Recording Paused
+ case 9: // Recording Stopped
+ case 10: // Recording Playing
+ case 11: // Recording 'Play_Pause'
+ Mode.Record = true;
+ break;
+ case 12: // Mobile TV
+ case 13: // Mobile TV Recording
+ Mode.MobileTV = true;
+ break;
+ default:
+ Mode.Music = true;
+ break;
+ }
+}
+
+// For: Data.as
+Do_Periodic( 5000, Data.Sync );
+
+// For: System.as
+Do_onDisplayUpdate( function ():Void {
+ Sys.State = ext_fscommand2( "GetEtcState" );
+});
+
+// For: Volume.as
+Do_onDisplayUpdate( Volume.CheckDevice );
+
+
+
+// For: Time.as
+Do_onUnload( function ():Void {
+ delete onEnterFrame;
+});
+
+
+// For: Key.as
+{
+ switch ( Sys.Device ) {
+ case "J3":
+ case "C2":
+ case "X7":
+ _global.RegisterKeyListener( onKey.Handler ); // J3, C2
+ break;
+ case "S9":
+ case "i9":
+ _global.gfn_Key_CreateKeyListner( onKey.Handler ); // S9, i9
+ break;
+ }
+}
+
+tDevice = "Your Device: "+ Sys.Device;
123 Scripts/Core/JetEffect.as
@@ -0,0 +1,123 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/JetEffect.as - JetEffect EQ Management
+ */
+
+var JetEffect:Object = {};
+JetEffect.EQNames = [ "User 1", "User 2", "User 3", "User 4", "Normal", "BBE", "BBE ViVA", "BBE ViVA 2",
+ "BBE Mach3Bass", "BBE MP", "BBE Headphone", "BBE Headphone 2", "BBE Headphone 3",
+ "Rock", "Jazz", "Classic", "Ballad", "Pop", "Club", "Funk", "Hip Hop", "Techno",
+ "Blues", "Metal", "Dance", "Rap", "Wide", "X-Bass", "Hall", "Vocal", "Maestro",
+ "Feel the Wind", "Mild Shore", "Crystal Clear", "Reverb Room", "Reverb Club",
+ "Reverb Stage", "Reverb Hall", "Reverb Stadium" ];
+
+JetEffect.addProperty( "Current",
+ function ():Number {
+ if ( JetEffect.Current_ == undefined ) { // All Players
+ JetEffect.Current_ = ext_fscommand2( "GetJetEffectIndex" );
+ }
+ return JetEffect.Current_;
+ },
+ function ( num:Number ):Void {
+
+ } );
+
+JetEffect.addProperty( "CurrentName",
+ function ():String {
+ return JetEffect.EQNames[ JetEffect.Current ];
+ },
+ function ( setting:String ):Void {
+ setting = setting.toLowerCase();
+ for ( var i:Number = 0; i < 39; i++ ) {
+ if ( setting == JetEffect.EQNames[ i ].toLowerCase() ) {
+ JetEffect.Current = i;
+ return;
+ }
+ }
+ } );
+
+// Deal with user EQs
+// Namely "User 1", "User 2", "User 3", "User 4"
+JetEffect.User = {};
+JetEffect.User.addProperty( "Current",
+ function ():Number {
+ if ( JetEffect.User.Current_ == undefined ) { // All Players
+ ext_fscommand2( "SetJetUserIndex", 1 );
+ JetEffect.User.Current_ = ext_fscommand2( "GetJetUserIndex" );
+ }
+ return JetEffect.User.Current_;
+ },
+ function ( num:Number ):Void {
+
+ } );
+
+JetEffect.User.addProperty( "CurrentName",
+ function ():String {
+ return JetEffect.EQNames[ JetEffect.User.Current ];
+ },
+ function ( setting:String ):Void {
+ setting = setting.toLowerCase();
+ for ( var i:Number = 0; i < 4; i++ ) {
+ if ( setting == JetEffect.EQNames[ i ].toLowerCase() ) {
+ JetEffect.User.Current = i;
+ return;
+ }
+ }
+ } );
+
+JetEffect.User.Update = function ():Void {
+ var list:String = ext_fscommand2( "GetJetUserData", "list" );
+ var settings:Array = list.split( "|" );
+ JetEffect.User.BBE_ = int( settings[ 0 ] );
+ JetEffect.User.M3B_ = int( settings[ 0 ] );
+ JetEffect.User._3DS_ = int( settings[ 0 ] );
+ JetEffect.User.MPE_ = ( settings[ 0 ] == "1" ) ? true : false;
+}
+
+JetEffect.User.addProperty( "BBE",
+ function ():Number {
+ if ( !JetEffect.User.BBE_ ) {
+ JetEffect.User.BBE_ = ext_fscommand2( "GetJetUserBBE" );
+ }
+ return JetEffect.User.BBE_;
+ },
+ function ( num:Number ):Void {
+ } );
+
+JetEffect.User.addProperty( "M3B",
+ function ():Number {
+ if ( !JetEffect.User.M3B_ ) {
+ JetEffect.User.M3B_ = ext_fscommand2( "GetJetUserM3B" );
+ }
+ return JetEffect.User.M3B_;
+ },
+ function ( num:Number ):Void {
+ } );
+
+JetEffect.User.addProperty( "_3DS",
+ function ():Number {
+ if ( !JetEffect.User._3DS_ ) {
+ JetEffect.User._3DS_ = ext_fscommand2( "GetJetUser3DS" );
+ }
+ return JetEffect.User._3DS_;
+ },
+ function ( num:Number ):Void {
+ } );
+
+JetEffect.User.addProperty( "MPE",
+ function ():Boolean {
+ if ( !JetEffect.User.MPE_ ) {
+ JetEffect.User.MPE_ = ext_fscommand2( "GetJetUserMPE" );
+ }
+ return JetEffect.User.MPE_;
+ },
+ function ( setting:Boolean ):Void {
+ } );
+
+
+
+
+
123 Scripts/Core/Key.as
@@ -0,0 +1,123 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/Key.as - Key Input Handling
+ */
+
+
+var onKey:Object = {};
+onKey.HoldState = ( ext_fscommand2("GetSysHoldKey") == 1 ) ? true : false;
+
+onKey.Handler = function ( KeyCode:Number ):Void {
+ switch ( KeyCode ) {
+ // Play (Short)
+ case _global.KEY_PLAY_SHORT: // Key 32 (Space)
+ if ( onKey.PlayShort )
+ onKey.PlayShort();
+ else
+ Music.PlayPause(); // Play/Pause by default
+ break;
+
+ // FF (Short)
+ case _global.KEY_FF_SHORT: // Key 37 (Left)
+ if ( onKey.FFShort )
+ onKey.FFShort();
+ else
+ Music.Next(); // Prev by default
+ break;
+
+ // Rew (Short)
+ case _global.KEY_REW_SHORT: // Key 39 (Right)
+ if ( onKey.RewShort )
+ onKey.RewShort();
+ else
+ Music.Prev(); // Next by default
+ break;
+
+ // Volume Up (Short)
+ case _global.KEY_PLUS_SHORT: // Key 38 (Up)
+ if ( onKey.PlusShort )
+ onKey.PlusShort();
+ else
+ Volume.Value++; // Inc Vol by default
+ break;
+
+ // Volume Down (Short)
+ case _global.KEY_MINUS_SHORT: // Key 40 (Down)
+ if ( onKey.MinusShort )
+ onKey.MinusShort();
+ else
+ Volume.Value--; // Dec Vol by default
+ break;
+
+ // Play (Long)
+ case _global.KEY_PLAY_LONG: // Key 32 (Space)
+ if ( onKey.PlayLong )
+ onKey.PlayLong();
+ else
+ _global.LoadSWF( _global.MODE_MAIN ); // Return to main by default
+ break;
+
+ // FF (Long)
+ case _global.KEY_FF_LONG: // Key 37 (Left)
+ if ( onKey.FFLong )
+ onKey.FFLong();
+ else
+ Music.FF(); // Rew by default
+ break;
+
+ // Volume Up (Long)
+ case _global.KEY_PLUS_LONG: // Key 38 (Up)
+ if ( onKey.PlusLong )
+ onKey.PlusLong();
+ else
+ Volume.Value++; // Inc Vol by default
+ break;
+
+ // Rew (Long)
+ case _global.KEY_REW_LONG: // Key 39 (Right)
+ if ( onKey.RewLong )
+ onKey.RewLong();
+ else
+ Music.Rew(); // FF by default
+ break;
+
+ // Volume Down (Long)
+ case _global.KEY_MINUS_LONG: // Key 40 (Down)
+ if ( onKey.MinusLong )
+ onKey.MinusLong();
+ else
+ Volume.Value--; // Dec Vol by default
+ break;
+
+ // Rotation to 0, 90, 180, 270 degrees
+ case _global.KEY_DISPLAY_ROTATE: // 122 Key (F11)
+ break;
+
+ // Display Update (Speaker, Track, Screen, Bluetooth etc change)
+ case _global.KEY_DISPLAY_UPDATE: // 123 Key (F12)
+ for ( var idx in onDisplayUpdateQueue )
+ onDisplayUpdateQueue[ idx ]();
+ break;
+
+ // Hold Key
+ case _global.KEY_HOLD: // 145 Key (Scroll Lock)
+ onKey.HoldState = !onKey.HoldState;
+ if ( onKey.HoldState ) {
+ if ( onKey.Hold )
+ onKey.Hold();
+ }
+ else if ( onKey.Unhold ) {
+ onKey.Unhold();
+ }
+ break;
+ }
+}
+
+
+var onDisplayUpdateQueue:Array = new Array();
+function Do_onDisplayUpdate ( func:Function ):Void {
+ onDisplayUpdateQueue.push( func );
+}
193 Scripts/Core/Mode.as
@@ -0,0 +1,193 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/Mode.as - Low-Level Mode Handling
+ */
+
+
+/*
+ * All mode setting must be done via:
+ * Mode.Current = "Music";
+ * Mode.Current = "Video";
+ * for example.
+ *
+ * This is so that Plasma can keep track of modes and
+ * enable/disable functionality when needed.
+ */
+var Mode:Object = {};
+
+/*
+ * Mode.Current can be used to set modes
+ * Use in the following manner:
+ * Mode.Current = "Music";
+ * Note: Modes are case-sensitive. (ie. "Music" works but "music" does not)
+ */
+Mode.addProperty( "Current",
+ function ():String {
+ return Mode.CurrentData;
+ },
+ function ( mode:String ):Void {
+ mode = Mode.CheckModeName( mode ); // Check if valid mode specified
+ if ( mode == "" || mode == Mode.Previous )
+ return; // Invalid mode name or already set
+
+ var result:Number = ext_fscommand2( "EtcModChangeMode", mode );
+ var init:Boolean = ( Mode.CurrentData == null ); // Check if first time setting mode
+ if ( init || result == 1 ) { // If first time or successful and different mode
+ if ( !init ) Mode.Previous = Mode.CurrentData;
+ Mode.CurrentData = mode;
+ if ( !init ) Mode.PostProcessing();
+ }
+ });
+
+Mode.CheckModeName = function ( name ):String {
+ switch ( name ) {
+ case "Music":
+ case "Video":
+ case "Radio":
+ case "Record":
+ case "MobileTV":
+ case "Flash":
+ case "Text":
+ case "Picture":
+ case "Dictionary":
+ return name;
+ default:
+ return "";
+ }
+}
+
+// This function changes some cached information based on mode change
+Mode.PostProcessing = function ():Void {
+ var prev:String = Mode.Previous;
+ var now:String = Mode.CurrentData;
+
+ switch ( now ) {
+ case "Music":
+ break;
+ case "Video":
+ switch ( prev ) {
+ case "Music":
+ Music.PlayState = false;
+ }
+ break;
+ case "Radio":
+ switch ( prev ) {
+ case "Music":
+ Music.PlayState = false;
+ }
+ break;
+ case "Record":
+ switch ( prev ) {
+ case "Music":
+ Music.PlayState = false;
+ }
+ break;
+ case "MobileTV":
+ switch ( prev ) {
+ case "Music":
+ Music.PlayState = false;
+ }
+ break;
+ case "Flash":
+ break;
+ }
+}
+
+
+
+/*
+ * The following properties are shortcuts for Mode.Current
+ *
+ * To check whether a certain mode is enabled, check in the following way:
+ * if ( Mode.Music )
+ *
+ * To set a certain mode, do the following:
+ * Mode.Music = true;
+ *
+ * Note: Disabling modes is not possible as a replacement mode needs to be set.
+ */
+
+Mode.addProperty( "Music",
+ function ():Boolean {
+ return ( Mode.Current == "Music" );
+ },
+ function ( trig:Boolean ):Void {
+ if ( trig )
+ Mode.Current = "Music";
+ });
+
+Mode.addProperty( "Video",
+ function ():Boolean {
+ return ( Mode.Current == "Video" );
+ },
+ function ( trig:Boolean ):Void {
+ if ( trig )
+ Mode.Current = "Video";
+ });
+
+Mode.addProperty( "Radio",
+ function ():Boolean {
+ return ( Mode.Current == "Radio" );
+ },
+ function ( trig:Boolean ):Void {
+ if ( trig )
+ Mode.Current = "Radio";
+ });
+
+Mode.addProperty( "Record",
+ function ():Boolean {
+ return ( Mode.Current == "Record" );
+ },
+ function ( trig:Boolean ):Void {
+ if ( trig )
+ Mode.Current = "Record";
+ });
+
+Mode.addProperty( "MobileTV",
+ function ():Boolean {
+ return ( Mode.Current == "MobileTV" );
+ },
+ function ( trig:Boolean ):Void {
+ if ( trig )
+ Mode.Current = "MobileTV";
+ });
+
+Mode.addProperty( "Flash",
+ function ():Boolean {
+ return ( Mode.Current == "Flash" );
+ },
+ function ( trig:Boolean ):Void {
+ if ( trig )
+ Mode.Current = "Flash";
+ });
+
+Mode.addProperty( "Text",
+ function ():Boolean {
+ return ( Mode.Current == "Text" );
+ },
+ function ( trig:Boolean ):Void {
+ if ( trig )
+ Mode.Current = "Text";
+ });
+
+Mode.addProperty( "Picture",
+ function ():Boolean {
+ return ( Mode.Current == "Picture" );
+ },
+ function ( trig:Boolean ):Void {
+ if ( trig )
+ Mode.Current = "Picture";
+ });
+
+Mode.addProperty( "Dictionary",
+ function ():Boolean {
+ return ( Mode.Current == "Dictionary" );
+ },
+ function ( trig:Boolean ):Void {
+ if ( trig )
+ Mode.Current = "Dictionary";
+ });
+
98 Scripts/Core/Music.as
@@ -0,0 +1,98 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/Music.as - Core Music Functionality
+ */
+
+var Music:Object = {};
+
+Music.addProperty( "PlayState",
+ function ():Boolean {
+ return ( Sys.State == 1 ) ? true : false;
+ },
+ function ( state:Boolean ):Void {
+ if ( Mode.Music ) Sys.State = ( state ) ? 1 : 2;
+ } );
+
+Music.PlayPause = function ():Boolean {
+ if ( Music.PlayState )
+ return Music.Pause();
+ else
+ return Music.Play();
+}
+
+Music.Play = function ():Boolean {
+ if ( !Music.PlayState ) { // All Players | J3, X7, C2
+ var music:Boolean = Mode.Music;
+ var setoffset:Boolean, updateoffset:Boolean;
+ if ( music ) {
+ if ( Music.PosOffset == undefined ) setoffset = true;
+ else updateoffset = true;
+ }
+ if ( setoffset ) Music.Pos = Music.Pos;
+
+ var cmd:String = ( music ) ? "KeyAudPlay" : "KeyComShortPlay";
+ if ( ext_fscommand2( cmd ) == 1 ) {
+ Music.PlayState = true;
+ if ( setoffset ) Music.PosOffset = ( getTimer() % 1000 );
+ if ( updateoffset ) Music.PosOffset
+ return true;
+ }
+ }
+ return false;
+}
+
+Music.Pause = function ():Boolean {
+ if ( Music.PlayState ) { // All Players | J3, X7, C2
+ var cmd:String = ( Mode.Music ) ? "KeyAudPause" : "KeyComShortPlay";
+ if ( ext_fscommand2( cmd ) == 1 ) {
+ Music.PlayState = false;
+ return true;
+ }
+ }
+ return false;
+}
+
+Music.Prev = function ():Boolean { // All Players | J3, X7, C2
+ var cmd:String = ( Mode.Music ) ? "KeyAudShortREW" : "KeyComShortREW";
+ if ( ext_fscommand2( cmd ) == 1 ) {
+ if ( Mode.Music ) {
+ if ( !Music.PlayState )
+ Music.Update();
+ Music.Pos_ = 0;
+ Music.PosOffset = ( getTimer() % 1000 );
+ }
+ return true;
+ }
+ return false;
+}
+
+Music.Next = function ():Boolean { // All Players | J3, X7, C2
+ var cmd:String = ( Mode.Music ) ? "KeyAudShortFF" : "KeyComShortFF";
+ if ( ext_fscommand2( cmd ) == 1 ) {
+ if ( Mode.Music ) {
+ if ( !Music.PlayState )
+ Music.Update();
+ Music.Pos_ = 0;
+ Music.PosOffset = ( getTimer() % 1000 );
+ }
+ return true;
+ }
+ return false;
+}
+
+Music.Rew = function ():Boolean { // All Players | J3, X7, C2
+ var cmd:String = ( Mode.Music ) ? "KeyAudLongREW" : "KeyComLongREW";
+ if ( ext_fscommand2( cmd ) == 1 )
+ return true;
+ return false;
+}
+
+Music.FF = function ():Boolean { // All Players | J3, X7, C2
+ var cmd:String = ( Mode.Music ) ? "KeyAudLongFF" : "KeyComLongFF";
+ if ( ext_fscommand2( cmd ) == 1 )
+ return true;
+ return false;
+}
56 Scripts/Core/System.as
@@ -0,0 +1,56 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/System.as - System Settings Control
+ */
+
+// System.capabilities.os: OEM
+// System.capabilities.manufacturer: neomtel
+// System.capabilities.version: 7
+
+var Sys:Object = {};
+Sys.State = ext_fscommand2( "GetEtcState" );
+Sys.addProperty( "Device",
+ function ():String {
+ var device = Plasma.Data.Get( "Device" ); // Has device been detected?
+ if ( !device )
+ device = Sys.CheckDevice(); // If not detect device
+ return device;
+ },
+ function ():Void {} ); // Do nothing on set
+
+// Manually re-check device
+Sys.CheckDevice = function ():String {
+ var device:String;
+ if ( ext_fscommand2( "GetEtcSpeakerOn" ) == -1 )
+ device = "S9";
+ else if ( ext_fscommand2( "GetEtcVolumeBoost" ) != -1 )
+ device = "J3";
+ else if ( ext_fscommand2( "GetEtcHorUIRotation" ) != -1 )
+ device = "X7";
+ else if ( ext_fscommand2( "GetSysDisplayRotation" ) != -1 )
+ device = "C2";
+ else
+ device = "i9";
+ Plasma.Data.Set( "Device", device );
+ return device;
+}
+
+Sys.addProperty( "S9",
+ function ():Boolean { return Sys.Device == "S9"; },
+ function ():Void {} );
+Sys.addProperty( "i9",
+ function ():Boolean { return Sys.Device == "i9"; },
+ function ():Void {} );
+Sys.addProperty( "J3",
+ function ():Boolean { return Sys.Device == "J3"; },
+ function ():Void {} );
+Sys.addProperty( "X7",
+ function ():Boolean { return Sys.Device == "X7"; },
+ function ():Void {} );
+Sys.addProperty( "C2",
+ function ():Boolean { return Sys.Device == "C2"; },
+ function ():Void {} );
+
56 Scripts/Core/Time.as
@@ -0,0 +1,56 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/Time.as - Time and Periodic Script Management
+ */
+
+/* TIME MANAGEMENT */
+var Time:Object = {};
+Time.Ticks = getTimer();
+
+Time.Conv = {};
+Time.Conv.Text_mmss = function ( secs ):String {
+ secs = secs >> 0;
+ return ( ( ( secs >> 2 ) / 15 ) >> 0 ) // minutes = secs / 60
+ + ":"
+ + Time.Conv.Num_2Dig( Misc.Math.mod( secs, 60 ) );
+}
+Time.Conv.Text_hhmmss = function ( secs ):String {
+ var hr:Number = ( ( ( secs >> 4 ) / 225 ) >> 0 );
+ secs = secs >> 0;
+ return Time.Conv.Num_2Dig( hr ) + ":" // hour = secs / 3600
+ + Time.Conv.Num_2Dig( ( ( ( secs - ( hr << 4 ) * 225 ) >> 2 ) / 15 ) >> 0 )
+ + ":"
+ + Time.Conv.Num_2Dig( secs % 60 );
+}
+Time.Conv.Num_2Dig = function ( num ):String { return ( num < 10 ) ? "0" + num : num; }
+
+
+// The following runs every 1 / FRAMERATE seconds. For the default loader, fps is 24fps.
+// This gives you an onEnterFrame trigger interval of 42ms (This runs every 42ms)
+// This also means that you cannot set intervals shorter than 42ms. You should not need to.
+onEnterFrame = function ():Void
+{
+ Time.Ticks = getTimer();
+
+ var pobj:Object;
+ for ( var idx in Time.PeriodicQueue ) {
+ pobj = Time.PeriodicQueue[ idx ];
+ if ( pobj.Prev && ( Time.Ticks - pobj.Prev ) < pobj.Interval )
+ continue;
+ pobj.Prev = Time.Ticks
+ pobj.Function();
+ }
+}
+
+// Interval in milliseconds
+Time.PeriodicQueue = new Array();
+Do_Periodic = function ( dur:Number, func:Function ):Void {
+ var obj:Object = new Object();
+ dur = ( dur ) ? dur : 1000; // If duration not set, set to 1000ms = 1s
+ obj.Interval = dur;
+ obj.Function = func;
+ Time.PeriodicQueue.push( obj );
+}
81 Scripts/Core/Utility.as
@@ -0,0 +1,81 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/Utility.as - Core Utility Functions
+ */
+
+var Misc:Object = {};
+
+Misc.Math = {};
+Misc.Math.highest = function ( arr:Array ) {
+ var len:Number = arr.length;
+ if ( len == 0 ) return;
+ var num:Number = arr[ 0 ];
+ if ( len == 1 ) return num;
+ for ( var idx:Number = 1; idx < len; idx++ ) {
+ if ( arr[ idx ] > num ) num = arr[ idx ];
+ }
+ return num;
+}
+
+Misc.Math.absInt = function ( x:Number ):Number {
+ return ( x ^ ( x >> 31 ) ) - ( x >> 31 );
+}
+
+Misc.Math.equalSign = function ( x1:Number, x2:Number ):Number {
+ return x1 ^ x2 >= 0;
+}
+
+Misc.Math.mod = function ( x:Number, m:Number ):Number {
+ x = x >> 0;
+ m = m >> 0;
+ if ( ( m & ( m - 1 ) ) == 0 )
+ return x & ( m - 1 );
+ else
+ return x % m;
+}
+
+
+/* CACHE ext_fscommand2 CALL RESULTS */
+var fscache:Array = new Array();
+function fscmd_cache ( cmd:String, dur:Number ) {
+ dur = dur ? dur : 150;
+ if ( fscache[ cmd ] && ( Time.Ticks - fscache[ cmd ].LastChecked ) < 150 ) {
+ return fscache[ cmd ].Data;
+ }
+ if ( !fscache[ cmd ] ) {
+ var cache:Object = new Object()
+ fscache[ cmd ] = cache;
+ }
+ var newdata = ext_fscommand2( cmd );
+ if ( cmd == "GetAudPlayTime" ) {
+ if ( !fscache[ cmd ].Data || fscache[ cmd ].Data != newdata ) {
+ fscache[ cmd ].Data = newdata;
+ fscache[ cmd ].LastChecked = Time.Ticks;
+ }
+ }
+ else {
+ fscache[ cmd ].Data = newdata;
+ fscache[ cmd ].LastChecked = Time.Ticks;
+ }
+ return fscache[ cmd ].Data;
+}
+
+/*
+ * Unloading Handling
+ * - Queue funcs in array
+ */
+
+var onUnloadQueue:Array = [];
+onUnload = function ():Void {
+ for ( var i = 0; i < onUnloadQueue.length; i++ )
+ onUnloadQueue[ i ]();
+ Data.Unload();
+}
+
+// Usage: call as function but put a functioin as parameter.
+function Do_onUnload ( func:Function ):Void {
+ onUnloadQueue.push( func );
+}
107 Scripts/Core/Volume.as
@@ -0,0 +1,107 @@
+
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Core/Music.as - Core Volume Control Functionality
+ */
+
+var Volume:Object = {};
+Volume.addProperty( "Value",
+ function ():Number {
+ return Volume.Value_;
+ },
+ function ( num:Number ):Void {
+ if ( !isNaN( Volume.Value_ ) ) Volume.Update();
+ var diff:Number = num - Volume.Value_;
+ var cmd:String;
+ if ( diff > 0 ) cmd = "KeyComPlus"; // S9, J3, X7, i9, C2
+ else if ( diff < 0 ) {
+ cmd = "KeyComMinus"; // S9, J3, X7, i9, C2
+ diff = -diff;
+ }
+
+ var result:Number;
+ for ( ; diff > 0; diff-- ) {
+ result = ext_fscommand2( cmd );
+ if ( result == -1 ) break;
+ }
+
+ if ( result == -1 )
+ Volume.Update();
+ else {
+ Volume.Value_ = result;
+ Volume.DisplayUpdate();
+ }
+ });
+
+Volume.Mute = function ():Void {
+ if ( Volume.Value == 0 && Volume.MuteValue ) {
+ Volume.Value = Volume.MuteValue;
+ Volume.MuteValue = 0;
+ }
+ else if ( Volume.Value > 0 ) {
+ Volume.MuteValue = Volume.Value;
+ Volume.Value = 0;
+ }
+}
+
+Volume.Update = function ():Boolean {
+ var result:Number = ext_fscommand2( "GetEtcVolume" ); // S9, J3
+ if ( result != -1 ) {
+ Volume.Value_ = result;
+ Volume.DisplayUpdate();
+ return true;
+ }
+ return false;
+}
+
+Volume.DisplayUpdate = function ():Void {
+ Main.tVolume = Volume.Value;
+ if ( Volume.Value == 0 ) {
+ Main.Volume._visible = false;
+ GMain.Muted._visible = true;
+ }
+ else {
+ Main.Volume._visible = true;
+ GMain.Muted._visible = false;
+ }
+ GMain.gVolumeSize._xscale = 1.6 * Volume.Value;
+ GMain.gVolumeSize._yscale = 50 + 0.5 * Volume.Value;
+}
+
+
+// 0: Headphones
+// 1: Speaker
+// 2: Bluetooth
+
+Volume.CheckDevice = function ():Void {
+ var init:Boolean = ( Volume.Device == null );
+ var result:Number = ext_fscommand2( "GetEtcAudioOutDevice" ); // J3, X7
+
+ if ( result == -1 && !init ) return;
+
+ if ( !init ) Volume.PrevDevice = Volume.Device;
+ Volume.Device = ( result == -1 ) ? 0 : result;
+
+ if ( Volume.Device != Volume.PrevDevice ) {
+ Volume.Headphone = false;
+ Volume.Speaker = false;
+ Volume.Bluetooth = false;
+
+ switch ( Volume.Device ) {
+ case 0:
+ Volume.Headphone = true;
+ break;
+ case 1:
+ Volume.Speaker = true;
+ break;
+ case 2:
+ Volume.Bluetooth = true;
+ break;
+ }
+ }
+ Volume.Update();
+}
+Volume.CheckDevice();
14 Scripts/Cowon.as
@@ -0,0 +1,14 @@
+/*
+ * _____ _______ _______ _______ _______
+ * |_____] | |_____| |______ | | | |_____|
+ * | |_____ | | ______| | | | | |
+ *
+ * Cowon.as - Cowon Code Compatibility
+ */
+
+//#include "./Cowon/S9.as"
+//#include "./Cowon/i9.as"
+#include "./Cowon/J3.as"
+//#include "./Cowon/X7.as"
+//#include "./Cowon/C2.as"
+#include "./Cowon/Common.as"
1,411 Scripts/Cowon/C2.as
@@ -0,0 +1,1411 @@
+function RegisterPopupMC(targetMC)
+{
+ var scale;
+ if (popupMCName != targetMC)
+ {
+ if (popupMCName != null)
+ {
+ clearTimeout(__id);
+ var tempMC = popupMCName;
+ tempMC.onEnterFrame = function (Void)
+ {
+ scale = tempMC._xscale / 2;
+ tempMC._xscale = scale;
+ tempMC._yscale = scale;
+ tempMC._alpha = scale;
+ if (tempMC._xscale <= 10)
+ {
+ delete tempMC.onEnterFrame;
+ tempMC._xscale = 100;
+ tempMC._yscale = 100;
+ tempMC._visible = false;
+ tempMC = null;
+ } // end if
+ };
+ } // end if
+ if (targetMC != null)
+ {
+ var scaleIndex = 0;
+ var scaleArray;
+ if (targetMC._height > 250 || targetMC._width > 250)
+ {
+ scaleArray = new Array(85, 95, 101, 99);
+ }
+ else
+ {
+ scaleArray = new Array(85, 95, 103, 98);
+ } // end else if
+ targetMC._visible = true;
+ targetMC._xscale = targetMC._yscale = 60;
+ targetMC._alpha = 100;
+ targetMC.onEnterFrame = function (Void)
+ {
+ scale = scaleArray[scaleIndex];
+ targetMC._xscale = scale;
+ targetMC._yscale = scale;
+ if (++scaleIndex > scaleArray.length)
+ {
+ targetMC._xscale = 100;
+ targetMC._yscale = 100;
+ delete this.onEnterFrame;
+ delete scaleArray;
+ } // end if
+ };
+ if (targetMC._parent != undefined)
+ {
+ targetMC.swapDepths(targetMC._parent.getNextHighestDepth());
+ } // end if
+ } // end if
+ popupMCName = targetMC;
+ } // end if
+} // End of the function
+function LoadSwfFile(itemNumber, fileName)
+{
+ var tempStr = "System\\Flash UI\\";
+ if (itemNumber == _global.MODE_ETC && fileName == undefined || itemNumber >= modeArray.length && itemNumber != initializeCountry)
+ {
+ return;
+ } // end if
+ _global.g_PrevLauncherMode = _global.g_CurrLauncherMode;
+ _global.g_CurrLauncherMode = itemNumber;
+ _global.gfn_Common_ResetTimer();
+ prevLauncherMode = currentLauncherMode;
+ currentLauncherMode = itemNumber;
+ if (currentMode == -1)
+ {
+ currentMode = itemNumber;
+ } // end if
+ _global.RemoveKeyListener();
+ _global.RemoveTouchListener();
+ _global.CommonResetStringScroll();
+ userWallpaper = ext_fscommand2("GetDisWallpaper");
+ LoadWallpaper();
+ ext_fscommand2("SetEtcFlashUpdate", 0);
+ smartUpdate = 3;
+ unloadMovieNum(1);
+ if (itemNumber == _global.MODE_ETC)
+ {
+ tempStr = tempStr + fileName;
+ var _loc4 = new LoadVars();
+ _loc4._parent = this;
+ _loc4.onLoad = function (success)
+ {
+ if (success == true)
+ {
+ loadMovieNum(tempStr, 1);
+ }
+ else
+ {
+ _global.LoadPrevSWF();
+ } // end else if
+ };
+ _loc4.load(tempStr);
+ }
+ else if (itemNumber == initializeCountry)
+ {
+ loadMovieNum(String(tempStr + "init_country.swf"), 1);
+ }
+ else
+ {
+ if (itemNumber == _global.MODE_MAIN)
+ {
+ var _loc5 = ext_fscommand2("EtcUsrGetMainmenu");
+ if (_loc5 < MAX_MAINMENU_NUMBER)
+ {
+ tempStr = tempStr + ("mainmenu" + String(_loc5 + 1) + ".swf");
+ }
+ else
+ {
+ tempStr = tempStr + "mainmenu1.swf";
+ } // end else if
+ }
+ else
+ {
+ tempStr = tempStr + String(modeArray[itemNumber] + ".swf");
+ } // end else if
+ loadMovieNum(tempStr, 1);
+ } // end else if
+} // End of the function
+function RegisterSystemTickTimer(Void)
+{
+ var tempMC;
+ var previousSecond = -1;
+ var prevMinute = -1;
+ var prevHour = -1;
+ var currentTickCount;
+ var idx;
+ this.onEnterFrame = function (Void)
+ {
+ currentTickCount = getTimer();
+ currentTime = new Date();
+ _global.g_curSec = currentTime.getSeconds();
+ if (_global.g_curSec != previousSecond)
+ {
+ _global.g_curMin = currentTime.getMinutes();
+ if (prevMinute != _global.g_curMin)
+ {
+ _global.g_curHour = currentTime.getHours();
+ _global.DisplayTime();
+ prevMinute = _global.g_curMin;
+ if (prevHour != _global.g_curHour)
+ {
+ prevHour = _global.g_curHour;
+ _global.g_curYear = currentTime.getFullYear();
+ _global.g_curMonth = currentTime.getMonth();
+ _global.g_curDate = currentTime.getDate();
+ } // end if
+ } // end if
+ _global.DisplayBattery(0);
+ previousSecond = _global.g_curSec;
+ } // end if
+ delete currentTime;
+ for (idx = 0; idx < 3; idx++)
+ {
+ if (cTimer.tick[idx] != null)
+ {
+ if (currentTickCount - cTimer.StartTick[idx] >= cTimer.tick[idx])
+ {
+ cTimer.func[idx]();
+ cTimer.StartTick[idx] = null;
+ cTimer.tick[idx] = null;
+ cTimer.func[idx] = null;
+ } // end if
+ } // end if
+ } // end of for
+ if (enableTextScrolling == true)
+ {
+ for (idx = 0; idx < NUMOFSCROLLFIELD; idx++)
+ {
+ if (scrollFlagArray[idx] != null)
+ {
+ tempMC = scrollFlagArray[idx];
+ if (scrollDirection[idx] == 0)
+ {
+ ++tempMC.hscroll;
+ if (tempMC.hscroll >= tempMC.maxhscroll)
+ {
+ scrollDirection[idx] = 1;
+ } // end if
+ continue;
+ } // end if
+ --tempMC.hscroll;
+ if (tempMC.hscroll <= 0)
+ {
+ scrollDirection[idx] = 0;
+ } // end if
+ } // end if
+ } // end of for
+ } // end if
+ if (smartUpdate > 0)
+ {
+ --smartUpdate;
+ if (smartUpdate == 0)
+ {
+ this._visible = false;
+ ext_fscommand2("SetEtcFlashUpdate", 1);
+ this._visible = true;
+ } // end if
+ } // end if
+ };
+} // End of the function
+function InitializeLauncher(Void)
+{
+ RegisterWallpaperListener();
+ RegisterSystemTickTimer();
+ LoadConfiguration();
+ if (_global.GetFirmwareVersion() != C2_DOMESTIC_DMB && ext_fscommand2("GetSysRegion") == -1)
+ {
+ LoadSwfFile(initializeCountry);
+ }
+ else
+ {
+ var _loc2 = ext_fscommand2("GetTimAlarmState");
+ display24Hour = ext_fscommand2("GetTim24HDisplay");
+ ext_fscommand2("EtcModGetResumeMode", "tempString");
+ if (tempString == "Music")
+ {
+ _global.LoadSWF(_global.MODE_MUSIC);
+ }
+ else if (tempString == "Video")
+ {
+ _global.LoadSWF(_global.MODE_VIDEO);
+ }
+ else if (tempString == "Radio")
+ {
+ _global.LoadSWF(_global.MODE_RADIO);
+ }
+ else if (tempString == "Record")
+ {
+ _global.LoadSWF(_global.MODE_RECORD);
+ }
+ else if (tempString == "MobileTV")
+ {
+ _global.LoadSWF(_global.MODE_DMB);
+ }
+ else if (tempString == "Flash")
+ {
+ _global.LoadSWF(_global.MODE_FLASHBROWSER);
+ }
+ else if (tempString == "Text")
+ {
+ _global.LoadSWF(_global.MODE_TEXT);
+ }
+ else if (tempString == "Picture")
+ {
+ _global.LoadSWF(_global.MODE_PICTURE);
+ }
+ else if (tempString == "Dictionary")
+ {
+ _global.LoadSWF(_global.MODE_DICTIONARY);
+ }
+ else
+ {
+ _global.LoadSWF(_global.MODE_MAIN);
+ } // end else if
+ } // end else if
+} // End of the function
+_global.LCD_WIDTH = 320;
+_global.LCD_HEIGHT = 240;
+_global.SCROLL_VERTICAL = 1;
+_global.SCROLL_HORIZONTAL = 2;
+_global.SCROLL_FREE = 3;
+_global.C2_DOMESTIC = 1;
+_global.C2_OVERSEAS = 2;
+_global.C2_DOMESTIC_DMB = 3;
+_global.C2_DOMESTIC_VOKHAN = 4;
+_global.STATE_UNDEFINED = 0;
+_global.STATE_MUSIC_PLAY = 1;
+_global.STATE_MUSIC_PAUSE = 2;
+_global.STATE_MUSIC_STOP = 3;
+_global.STATE_RADIO = 4;
+_global.STATE_RADIO_RECORD = 5;
+_global.STATE_RECORD = 7;
+_global.STATE_RECORD_PAUSE = 8;
+_global.STATE_RECORD_STOP = 9;
+_global.STATE_RECORD_PLAY = 10;
+_global.STATE_RECORD_PLAYPAUSE = 11;
+_global.STATE_MTV = 12;
+_global.STATE_MTV_RECORD = 13;
+_global.MODE_MUSIC = 0;
+_global.MODE_VIDEO = 1;
+_global.MODE_RADIO = 2;
+_global.MODE_RECORD = 3;
+_global.MODE_DMB = 4;
+_global.MODE_FLASH = 5;
+_global.MODE_TEXT = 6;
+_global.MODE_PICTURE = 7;
+_global.MODE_DICTIONARY = 8;
+_global.MODE_UTIL = 9;
+_global.MODE_ETC = 10;
+_global.MODE_MAIN = 11;
+_global.MODE_MAIN2 = 12;
+_global.MODE_MAIN3 = 13;
+_global.MODE_SETTING = 14;
+_global.MODE_BROWSER = 15;
+_global.MODE_LAUNCHER = 16;
+_global.MODE_FLASHBROWSER = 17;
+_global.MODE_TEXTBROWSER = 18;
+_global.MODE_VOKHAN = 19;
+_global.MODE_WORDUP = 20;
+_global.TEXT_ALIGN_UNDEFIEND = 0;
+_global.TEXT_ALIGN_CENTER = 1;
+_global.seekRatio = 0;
+_global.g_curYear = 0;
+_global.g_curMonth = 0;
+_global.g_curDate = 0;
+_global.g_curHour = 0;
+_global.g_curMin = 0;
+_global.g_curSec = 0;
+var NUMOFSCROLLFIELD = 6;
+var scrollDirection = new Array(0, 0, 0, 0, 0, 0);
+var scrollFlagArray = new Array(null, null, null, null, null, null);
+var scrollAlign = new Array(null, null, null, null, null, null);
+var isFlipping = false;
+var popupMCName = null;
+var __id = -1;
+var restoreAlign = new TextFormat();
+_global.S9_NODMB_DIC = 1;
+_global.S9_NODMB = 2;
+_global.S9_DMB = 3;
+_global.S9_NORWAY_DMB = 4;
+_global.g_FirmwareVersion = 0;
+_global.g_PrevLauncherMode = -1;
+_global.g_CurrLauncherMode = -1;
+_global.g_PrevBrowser = "unknown";
+_global.g_Browser_CurrScale = 16;
+_global.g_Browser_InitScale = 16;
+_global.g_TextCurrScale;
+_global.g_TextinitScale;
+_global.g_Rec_CurMode = STATE_RECORD_STOP;
+cTimer = new Object();
+cTimer.startTick = new Array(null, null, null);
+cTimer.tick = new Array(null, null, null);
+cTimer.func = new Array(null, null, null);
+_global.gfn_flipFooter = _global.FlipFooter = function (mcSideA, mcSideB, flipMode, fastMode)
+{
+ var step = 1;
+ var chMenu = 0;
+ var bgHalfHeight;
+ var bgHeight;
+ var _loc3 = mcSideA._parent;
+ if (isFlipping == true)
+ {
+ return;
+ } // end if
+ switch (flipMode)
+ {
+ case _global.SCROLL_VERTICAL:
+ {
+ bgHeight = _loc3._width;
+ if (fastMode)
+ {
+ bgHalfHeight = bgHeight * 8.000000E-001;
+ }
+ else
+ {
+ bgHalfHeight = bgHeight / 2;
+ } // end else if
+ isFlipping = true;
+ _loc3.onEnterFrame = function (Void)
+ {
+ if (this._width < 1)
+ {
+ step = 2;
+ } // end if
+ if (step == 1)
+ {
+ if (this._width > bgHalfHeight)
+ {
+ this._width = this._width - bgHalfHeight;
+ }
+ else
+ {
+ this._width = 0;
+ } // end else if
+ }
+ else if (step == 2)
+ {
+ if (bgHeight < bgHalfHeight + this._width)
+ {
+ this._width = bgHeight;
+ isFlipping = false;
+ delete this.onEnterFrame;
+ }
+ else
+ {
+ this._width = this._width + bgHalfHeight;
+ } // end else if
+ if (this._width > bgHalfHeight - 2 && chMenu == 0)
+ {
+ if (mcSideA._visible != mcSideB._visible)
+ {
+ mcSideA._visible = !mcSideA._visible;
+ mcSideB._visible = !mcSideB._visible;
+ }
+ else
+ {
+ mcSideA._visible = true;
+ mcSideB._visible = false;
+ } // end else if
+ chMenu = 1;
+ } // end if
+ } // end else if
+ };
+ break;
+ }
+ default:
+ {
+ bgHeight = _loc3._height;
+ if (fastMode)
+ {
+ bgHalfHeight = bgHeight * 8.000000E-001;
+ }
+ else
+ {
+ bgHalfHeight = bgHeight / 2;
+ } // end else if
+ isFlipping = true;
+ _loc3.onEnterFrame = function (Void)
+ {
+ if (this._height < 1)
+ {
+ step = 2;
+ } // end if
+ if (step == 1)
+ {
+ if (this._height > bgHalfHeight)
+ {
+ this._height = this._height - bgHalfHeight;
+ }
+ else
+ {
+ this._height = 0;
+ } // end else if
+ }
+ else if (step == 2)
+ {
+ if (this._height > bgHeight)
+ {
+ this._height = bgHalfHeight;
+ }
+ else if (bgHeight < bgHalfHeight + this._height)
+ {
+ this._height = bgHeight;
+ isFlipping = false;
+ delete this.onEnterFrame;
+ }
+ else
+ {
+ this._height = this._height + bgHalfHeight;
+ } // end else if
+ if (this._height > bgHalfHeight - 2 && chMenu == 0)
+ {
+ if (mcSideA._visible != mcSideB._visible)
+ {
+ mcSideA._visible = !mcSideA._visible;
+ mcSideB._visible = !mcSideB._visible;
+ }
+ else
+ {
+ mcSideA._visible = true;
+ mcSideB._visible = false;
+ } // end else if
+ chMenu = 1;
+ } // end if
+ } // end else if
+ };
+ break;
+ }
+ } // End of switch
+};
+_global.gfn_SetPopupMCName = function (targetMC, timeOut)
+{
+ if (timeOut == undefined)
+ {
+ timeOut = 0;
+ }
+ else if (timeOut == 1)
+ {
+ timeOut = 5000;
+ } // end else if
+ _global.DisplayPopupMC(targetMC, timeOut);
+};
+_global.DisplayPopupMC = function (targetMC, timeOut)
+{
+ RegisterPopupMC(targetMC);
+ if (timeOut == undefined)
+ {
+ timeOut = 0;
+ } // end if
+ if (timeOut > 0)
+ {
+ clearTimeout(__id);
+ __id = setTimeout(_global.RemovePopupMC, timeOut);
+ } // end if
+};
+_global.gfn_GetPopupMCName = _global.GetPopupMCName = function (Void)
+{
+ return (popupMCName._name);
+};
+_global.RemovePopupMC = function (Void)
+{
+ clearTimeout(__id);
+ RegisterPopupMC(null);
+};
+_global.gfn_Common_DrawSeekBar = _global.CommonDrawSeekBar = function (bgMC, targetMC, maskMC, position, scrollMode)
+{
+ var _loc2;
+ if (position < 0)
+ {
+ position = 0;
+ }
+ else if (position > 100)
+ {
+ position = 100;
+ } // end else if
+ switch (scrollMode)
+ {
+ case SCROLL_VERTICAL:
+ {
+ _loc2 = bgMC._height - targetMC._height;
+ if (maskMC != null)
+ {
+ _loc2 = _loc2 + 24;
+ } // end if
+ targetMC._y = position * _loc2 / 100;
+ maskMC._width = int(targetMC._y);
+ maskMC._height = bgMC._width;
+ bgMC.setMask(maskMC);
+ break;
+ }
+ default:
+ {
+ _loc2 = bgMC._width - targetMC._width;
+ if (maskMC != null)
+ {
+ _loc2 = _loc2 + 24;
+ } // end if
+ targetMC._x = position * _loc2 / 100;
+ maskMC._width = int(targetMC._x);
+ maskMC._height = bgMC._height;
+ bgMC.setMask(maskMC);
+ break;
+ }
+ } // End of switch
+};
+_global.gfn_Common_GetRatio = _global.CommonGetRatio = function (total, currentValue)
+{
+ if (currentValue == 0)
+ {
+ return (0);
+ } // end if
+ if (total == 0)
+ {
+ return (Infinity);
+ } // end if
+ return (int(currentValue * 100 / total));
+};
+_global.gfn_Common_GetSeekBarRatio = _global.CommonGetSeekBarRatio = function (totalWidth, targetWidth, currentPosition)
+{
+ _global.seekRatio = int(currentPosition * 100 / (totalWidth - targetWidth));
+ if (_global.seekRatio < 0)
+ {
+ _global.seekRatio = 0;
+ }
+ else if (_global.seekRatio > 100)
+ {
+ _global.seekRatio = 100;
+ } // end else if
+ return (_global.seekRatio);
+};
+_global.gfn_Common_GetSeekRatio = _global.CommonGetSeekRatio = function (Void)
+{
+ return (_global.seekRatio);
+};
+_global.gfn_Common_Get2ChiperNum = _global.CommonGetTwoDigitNumber = function (currentValue)
+{
+ if (currentValue < 10)
+ {
+ return (String("0" + String(currentValue)));
+ }
+ else
+ {
+ return (String(currentValue));
+ } // end else if
+};
+_global.gfn_Common_GetTime2Text = _global.CommonGetTime2Text = function (time)
+{
+ var _loc5 = int(time / 3600);
+ var _loc4 = int(time % 3600 / 60);
+ var _loc2 = int(time % 3600 % 60);
+ return (String(_global.CommonGetTwoDigitNumber(_loc5) + ":" + _global.CommonGetTwoDigitNumber(_loc4) + ":" + _global.CommonGetTwoDigitNumber(_loc2)));
+};
+_global.gfn_Common_SetStringScroll = _global.CommonSetStringScroll = function (textFieldName, textAlign)
+{
+ var _loc5 = textFieldName.getTextFormat();
+ if (textFieldName.maxhscroll >= 5)
+ {
+ var _loc3 = NUMOFSCROLLFIELD;
+ for (var _loc2 = 0; _loc2 < NUMOFSCROLLFIELD; ++_loc2)
+ {
+ if (scrollFlagArray[_loc2] == textFieldName)
+ {
+ _loc3 = _loc2;
+ break;
+ continue;
+ } // end if
+ if (scrollFlagArray[_loc2] == null && _loc3 == NUMOFSCROLLFIELD)
+ {
+ _loc3 = _loc2;
+ } // end if
+ } // end of for
+ if (_loc3 != NUMOFSCROLLFIELD)
+ {
+ scrollFlagArray[_loc3] = textFieldName;
+ scrollDirection[_loc3] = 0;
+ scrollAlign[_loc3] = _loc5.align;
+ _loc5.align = "left";
+ textFieldName.setTextFormat(_loc5);
+ return (_loc3);
+ } // end if
+ }
+ else
+ {
+ for (var _loc2 = 0; _loc2 < NUMOFSCROLLFIELD; ++_loc2)
+ {
+ if (scrollFlagArray[_loc2] == textFieldName)
+ {
+ scrollFlagArray[_loc2] = null;
+ scrollDirection[_loc2] = 0;
+ scrollAlign[_loc2] = 0;
+ break;
+ } // end if
+ } // end of for
+ if (textAlign == _global.TEXT_ALIGN_CENTER)
+ {
+ _loc5.align = "center";
+ textFieldName.setTextFormat(_loc5);
+ } // end if
+ return (-1);
+ } // end else if
+ false;
+ return (1);
+};
+_global.gfn_Common_StringScroll = _global.CommonStringScroll = function (Void)
+{
+ for (var _loc1 = 0; _loc1 < NUMOFSCROLLFIELD; ++_loc1)
+ {
+ if (scrollFlagArray[_loc1] != null)
+ {
+ if (scrollDirection[_loc1] == 0)
+ {
+ ++scrollFlagArray[_loc1].hscroll;
+ if (scrollFlagArray[_loc1].hscroll >= scrollFlagArray[_loc1].maxhscroll)
+ {
+ scrollDirection[_loc1] = 1;
+ } // end if
+ continue;
+ } // end if
+ --scrollFlagArray[_loc1].hscroll;
+ if (scrollFlagArray[_loc1].hscroll <= 0)
+ {
+ scrollDirection[_loc1] = 0;
+ } // end if
+ } // end if
+ } // end of for
+};
+_global.gfn_Common_ResetStringScroll = _global.CommonResetStringScroll = function (targetIdx)
+{
+ var _loc3;
+ var _loc2;
+ if (targetIdx == undefined)
+ {
+ _loc3 = 0;
+ _loc2 = NUMOFSCROLLFIELD;
+ }
+ else
+ {
+ _loc3 = targetIdx;
+ _loc2 = targetIdx + 1;
+ } // end else if
+ for (var _loc1 = _loc3; _loc1 < _loc2; ++_loc1)
+ {
+ if (scrollFlagArray[_loc1] != null)
+ {
+ restoreAlign.align = scrollAlign[_loc1];
+ scrollFlagArray[_loc1].setTextFormat(restoreAlign);
+ restoreAlign.align = null;
+ } // end if
+ scrollFlagArray[_loc1].hscroll = 0;
+ scrollFlagArray[_loc1] = null;
+ scrollDirection[_loc1] = null;
+ scrollAlign[_loc1] = null;
+ } // end of for
+};
+_global.CommonSetDigitMC = function (mc, number)
+{
+ mc.MCDigit1.gotoAndStop(int(number / 10) + 1);
+ mc.MCDigit0.gotoAndStop(int(number % 10) + 1);
+};
+_global.gfn_Common_SetMask = function (maskWidth, maskHeight, bgMC, maskMC)
+{
+ maskMC._width = maskWidth;
+ maskMC._height = maskHeight;
+ bgMC.setMask(maskMC);
+};
+_global.gfn_ToggleVisibleState = function (targetMC)
+{
+ if (targetMC._visible == true)
+ {
+ targetMC._visible = false;
+ }
+ else
+ {
+ targetMC._visible = true;
+ } // end else if
+};
+_global.gfn_Common_SetTimer = function (tick, exFunc)