diff --git a/README.md b/README.md index 7b181bc0..34230840 100644 --- a/README.md +++ b/README.md @@ -13,20 +13,21 @@ SaffronCode is a collection of codes & libraries for producing powerful and flex ## You can be an app developer by using Adobe Animate & SaffronCode SDK -• You do not need programming knowledge to be a software developer, you can build a variety of software and brochures without having to write a line of code. You can easily prepare graphical and animated pages in Adobe Animate’s graphic environment for the production of mobile software. -• To use the extensive and diverse libraries in this set, you should only be familiar with Ecma Script 6 or Action Script so you can add calendars, lists, dynamic images and ... to your software. With a higher level of software knowledge, you can easily create a variety of software that connects to a lot of different web services without any hassle of managing Internet access and cache storage. +• You do not need programming knowledge to be a software developer, you can build a variety of software and brochures without having to write a line of code. You can easily prepare graphical and animated pages in Adobe Animate’s graphic environment for the production of mobile software.
+• To use the extensive and diverse libraries in this set, you should only be familiar with Ecma Script 6 or Action Script so you can add calendars, lists, dynamic images and ... to your software. With a higher level of software knowledge, you can easily create a variety of software that connects to a lot of different web services without any hassle of managing Internet access and cache storage.
• Do not worry about managing hardware resources. SaffronCode will optimize your software code to run on mobile devices by using GPU resources. ## How To Start? SaffronCode is adding to the Adobe Animate environment to build mobile applications output. To get ready the environment, follow these steps: -• Install the appropriate version of Adobe Animate -• Download SaffronCode SDK -• Download our ASPack libraries to. you need these libraries to be able to use all features on SaffronCode. -• ASPack (Collection of key libraries) -• Flex and other general swc libraries (if you need soap web services) -• Download the latest version of the Air SDK -• JDK +• Install the appropriate version of Adobe Animate
+• Download SaffronCode SDK
+• Download our ASPack libraries to. you need these libraries to be able to use all features on SaffronCode.
+• Download ASPack
+• Flex and other general swc libraries (if you need soap web services)
+• Download the latest version of the Air SDK
+• JDK
+• Download the sample project here
## Contact Us diff --git a/SaffronLogger.as b/SaffronLogger.as index 02ece41d..7a326dc1 100644 --- a/SaffronLogger.as +++ b/SaffronLogger.as @@ -120,7 +120,7 @@ package trace("Log file located on "+todayFile.nativePath); todayFileStream = new FileStream(); todayFileStream.openAsync(todayFile,FileMode.WRITE); - todayFileStream.writeShort(-2); + // todayFileStream.writeShort(-2); } } diff --git a/animation/Anim_alpha_shine.as b/animation/Anim_alpha_shine.as index 7d49a6e6..81efa638 100644 --- a/animation/Anim_alpha_shine.as +++ b/animation/Anim_alpha_shine.as @@ -10,9 +10,11 @@ import flash.events.EventDispatcher; public class Anim_alpha_shine extends Sprite{ - var object:Object ; + private var object:Object ; - var I:Number ; + private var I:Number ; + + private var _paused:Boolean = false ; public function Anim_alpha_shine(displayObject:Object) { this.addEventListener(Event.ENTER_FRAME,animate); @@ -37,8 +39,19 @@ public class Anim_alpha_shine extends Sprite{ object.alpha = 1 ; } + public function pauseShine():void + { + _paused = true ; + } + + public function playShine():void + { + _paused = false ; + } + private function animate(e:Event):void { + if(_paused)return; object.alpha = 1-(Math.cos(I)+1)/4 ; I+=0.1; } diff --git a/appManager/animatedPages/pageManager/TitleManager.as b/appManager/animatedPages/pageManager/TitleManager.as index 8fd115c3..2ee6d46d 100644 --- a/appManager/animatedPages/pageManager/TitleManager.as +++ b/appManager/animatedPages/pageManager/TitleManager.as @@ -113,6 +113,7 @@ /**Set the title both for parags and titletexts*/ public function setTitle(text:String):void { + this.visible = text!=''; if(myTitle!=null) { if(myTitle.text != text) diff --git a/appManager/displayObjects/SwitchButtonAnimated.as b/appManager/displayObjects/SwitchButtonAnimated.as index 1984c8d0..808100c4 100644 --- a/appManager/displayObjects/SwitchButtonAnimated.as +++ b/appManager/displayObjects/SwitchButtonAnimated.as @@ -11,6 +11,8 @@ { private var _status:Boolean = false ; + private var onChangeFunction:Function ; + public function SwitchButtonAnimated(status:Boolean = false) { _status = status ; @@ -23,6 +25,11 @@ this.addEventListener(Event.REMOVED_FROM_STAGE,unLoad); } + public function onChanged(func:Function):void + { + onChangeFunction = func ; + } + private function unLoad(e:Event):void { this.removeEventListener(MouseEvent.MOUSE_DOWN,switchMe); @@ -35,6 +42,7 @@ _status = !_status ; this.dispatchEvent(new Event(Event.CHANGE)); SaffronLogger.log(_status); + if(onChangeFunction!=null)onChangeFunction(); } public function get status():Boolean @@ -50,6 +58,13 @@ } } + public function setInstantStaut(status:Boolean):void + { + _status = status; + if(status)this.gotoAndStop(this.totalFrames); + else this.gotoAndStop(1); + } + private function anim(event:Event):void { if(_status) diff --git a/appManager/event/PageControllEvent.as b/appManager/event/PageControllEvent.as index c6b3d296..1bb4af59 100644 --- a/appManager/event/PageControllEvent.as +++ b/appManager/event/PageControllEvent.as @@ -23,14 +23,17 @@ package appManager.event public var preventerPage:DisplayObject ; public var let_cashed_requested_page_activate:Boolean = true ; + + public var ignorelastCalledPage:Boolean = false ; /**Feel the getPermition and preventerDisplayObject on PREVENT_PAGE_CHANGING event*/ - public function PageControllEvent(type:String,getPermition:Function=null,preventerDisplayObject:DisplayObject=null,let_requested_page_to_open:Boolean=true) + public function PageControllEvent(type:String,getPermition:Function=null,preventerDisplayObject:DisplayObject=null,let_requested_page_to_open:Boolean=true,ignorelastCalledPage:Boolean=false) { super(type,true); let_cashed_requested_page_activate = let_requested_page_to_open; permitionReceiver = getPermition ; preventerPage = preventerDisplayObject ; + this.ignorelastCalledPage = ignorelastCalledPage ; } } } \ No newline at end of file diff --git a/appManager/mains/App.as b/appManager/mains/App.as index ff90718b..b26a0089 100644 --- a/appManager/mains/App.as +++ b/appManager/mains/App.as @@ -381,6 +381,10 @@ { ContentSoundManager.changeMainMusic((event as AppEventContent).pageData.musicURL,(event as AppEventContent).pageData.musicVolume); } + else + { + ContentSoundManager.changeVolume((event as AppEventContent).pageData.musicVolume); + } if(mainAnim == null) diff --git a/appManager/mains/AppWithContent.as b/appManager/mains/AppWithContent.as index 4064b30a..d4211407 100644 --- a/appManager/mains/AppWithContent.as +++ b/appManager/mains/AppWithContent.as @@ -372,7 +372,7 @@ } prventedPageWasLastPage = false ; - if(preventedEventCash!=null) + if(preventedEventCash!=null && !event.ignorelastCalledPage) { SaffronLogger.log("Prevented page event is released"); managePages(preventedEventCash); @@ -486,19 +486,20 @@ /**Save teh page ID to Analytic server */ private function logPageChange(pageId:String):void { - if(pageLoggerRequest==null) - { - pageLoggerRequest = new URLRequest(Contents.config.version_controll_url); - pageLoggerRequest.contentType = 'application/json'; - pageLoggerRequest.method = URLRequestMethod.POST ; - } - pageLoggerRequest.data = JSON.stringify({AppId:DevicePrefrence.appID,PageName:pageId,Enter:true}) ; - if(pageLoggerLoader==null) - { - pageLoggerLoader = new URLLoader(); - pageLoggerLoader.addEventListener(IOErrorEvent.IO_ERROR,function():void{}) - } - pageLoggerLoader.load(pageLoggerRequest); + //GOODBY Saffron Logger... we will miss you + // if(pageLoggerRequest==null) + // { + // pageLoggerRequest = new URLRequest(Contents.config.version_controll_url); + // pageLoggerRequest.contentType = 'application/json'; + // pageLoggerRequest.method = URLRequestMethod.POST ; + // } + // pageLoggerRequest.data = JSON.stringify({AppId:DevicePrefrence.appID,PageName:pageId,Enter:true}) ; + // if(pageLoggerLoader==null) + // { + // pageLoggerLoader = new URLLoader(); + // pageLoggerLoader.addEventListener(IOErrorEvent.IO_ERROR,function():void{}) + // } + // pageLoggerLoader.load(pageLoggerRequest); } @@ -521,14 +522,15 @@ private function controlCurrentVersion(useOfflineVersion:Boolean=false):void { - var versionContrllURL:String = Contents.config.version_controll_url ; - SaffronLogger.log("Version controll : "+versionContrllURL); - var versionRequest:URLRequest = new URLRequest(versionContrllURL); - versionRequest.contentType = 'application/json'; - versionRequest.method = URLRequestMethod.POST ; - versionRequest.data = JSON.stringify({AppId:DevicePrefrence.appID}) ; + //GOODBY Saffron analytics, we will miss you + // var versionContrllURL:String = Contents.config.version_controll_url ; + // SaffronLogger.log("Version controll : "+versionContrllURL); + // var versionRequest:URLRequest = new URLRequest(versionContrllURL); + // versionRequest.contentType = 'application/json'; + // versionRequest.method = URLRequestMethod.POST ; + // versionRequest.data = JSON.stringify({AppId:DevicePrefrence.appID}) ; - VersionController.controllVersion(currentVersionIsOk,stopThisVersion,versionRequest,DevicePrefrence.appVersion,true,useOfflineVersion); + // VersionController.controllVersion(currentVersionIsOk,stopThisVersion,versionRequest,DevicePrefrence.appVersion,true,useOfflineVersion); } /**The application version is ok*/ diff --git a/contents/soundControll/ContentSoundManager.as b/contents/soundControll/ContentSoundManager.as index 15d6ae84..75b9f97a 100644 --- a/contents/soundControll/ContentSoundManager.as +++ b/contents/soundControll/ContentSoundManager.as @@ -21,6 +21,8 @@ package contents.soundControll private static var lastPlayingMusic:String ; private static var lastMusicVolume:Number ; + + private static var muted:Boolean = false ; /**2 sound id to swap musics smoothly*/ private static var currentSoundId:uint, @@ -59,7 +61,7 @@ package contents.soundControll var soundPose:Number = SoundPlayer.getPlayedPrecent(currentSoundId); pauseMusic(); SoundMixer.stopAll(); - SoundPlayer.addSound(lastPlayingMusic,currentSoundId,true,lastMusicVolume); + SoundPlayer.addSound(lastPlayingMusic,currentSoundId,true,muted?0:lastMusicVolume); if(firstSoundPlaying) { startMusic(soundPose); @@ -75,10 +77,11 @@ package contents.soundControll else { SaffronLogger.log("soundPose : "+soundPlayingFrom); - SoundPlayer.play(currentSoundId,true,true,soundPlayingFrom); } + SoundPlayer.play(currentSoundId,true,true,soundPlayingFrom); lastMusicState.data.state = true ; lastMusicState.flush(); + if(muted)SoundPlayer.volumeContril(currentSoundId,0); } public static function pauseMusic():void @@ -90,13 +93,20 @@ package contents.soundControll public static function muteMusic():void { + muted = true ; SoundPlayer.volumeContril(currentSoundId,0); } public static function unMuteMusit():void { + muted = false SoundPlayer.volumeContril(currentSoundId,1); } + + public static function changeVolume(volume:Number):void + { + SoundPlayer.volumeContril(currentSoundId,muted?0:volume); + } /**This will change the current playing music ( not tested yet )*/ public static function changeMainMusic(musicURL:String='',volume:Number=1):void @@ -110,7 +120,7 @@ package contents.soundControll volume = Contents.homePage.musicVolume ; } lastMusicVolume = volume ; - if(musicURL=='' || lastPlayingMusic == musicURL) + if(muted==false && (musicURL=='' || lastPlayingMusic == musicURL)) { SaffronLogger.log("Music is duplicated on ContentSoundManager.changeMainMusic : "+musicURL); SoundPlayer.volumeContril(currentSoundId,volume); @@ -123,13 +133,15 @@ package contents.soundControll SaffronLogger.log("Pause the sound : "+currentSoundId); SoundPlayer.pause(currentSoundId); SaffronLogger.log("Add the sound : "+otherSoundId); - SoundPlayer.addSound(musicURL,otherSoundId,true,volume); + SoundPlayer.addSound(musicURL,otherSoundId,true,muted?0:volume); if(lastPlayingMusic==null || musicWasPlaying) { SaffronLogger.log("lastPlayingMusic : "+lastPlayingMusic); SaffronLogger.log("musicWasPlaying : "+musicWasPlaying); SoundPlayer.play(otherSoundId); + } + if(muted)SoundPlayer.volumeContril(currentSoundId,0); lastPlayingMusic = musicURL ; diff --git a/dataManager/SavedDatas2.as b/dataManager/SavedDatas2.as index eb79afac..3823db59 100644 --- a/dataManager/SavedDatas2.as +++ b/dataManager/SavedDatas2.as @@ -67,7 +67,7 @@ } /**Change the table name for this special user*/ - public static function setTableName(tableNameTitle:String='') + public static function setTableName(tableNameTitle:String=''):void { tableName = tableBaseName+tableNameTitle; SaffronLogger.log("new table name is : "+tableName); @@ -78,7 +78,7 @@ - public static function setUp(checkTable:Boolean = false) + public static function setUp(checkTable:Boolean = false):void { var needToUpdate:Boolean = false ; if(sql == null) @@ -256,7 +256,7 @@ asyncQuery.execute(); } - private static function continueSaving(e:*=null) + private static function continueSaving(e:*=null):void { var id:String = asyncQue[0].id ; var data:* = asyncQue[0].data ; @@ -283,7 +283,7 @@ } /**load the value if the value is new on data base*/ - public static function loadIfNewer(id,lastDate:Date=null):* + public static function loadIfNewer(id:*,lastDate:Date=null):* { return load(id,lastDate); } @@ -298,7 +298,7 @@ var l:uint = asyncQue.length ; var l2:uint = asyncSaved.length ; - for(var i = l-1 ; i>=0 ; i--) + for(var i:* = l-1 ; i>=0 ; i--) { if(asyncQue[i].id == id) { diff --git a/drawPad/Paper.as b/drawPad/Paper.as index 5bd84d42..1041336d 100644 --- a/drawPad/Paper.as +++ b/drawPad/Paper.as @@ -130,7 +130,7 @@ this.addEventListener(Event.REMOVED_FROM_STAGE,unLoad); } - private function unLoad(event:Event) + private function unLoad(event:Event):void { this.removeEventListener(Event.ENTER_FRAME,drawLines); this.removeEventListener(Event.REMOVED_FROM_STAGE,unLoad); @@ -163,11 +163,11 @@ } - private function drawLines(ev:Event=null) + private function drawLines(ev:Event=null):void { if(draw) { - for(var i = 0 ; i0) + onReceiveFunction(message) + } + + public static function getMessageOnPort(onRespond:Function,myPort:uint):void + { + trace("myUDP.connected : "+myUDP.connected); + trace("myUDP.localPort : " +myUDP.localPort); + onReceiveFunction = onRespond ; + if(myUDP.localPort==0 || ( myUDP.localPort!=myPort)) + { + if(myUDP.connected) + myUDP.close(); + + myUDP.bind(myPort); + myUDP.receive(); + } + } + + public static function isConnected():Boolean + { + return myUDP.connected && myUDP.localPort !=0; + } + + public static function sendMessageTo(message:String,onRespond:Function,targetIp:String,targetPort:uint,localPort:uint=2000):void + { + setUp(); + trace("Message sent:"+message); + getMessageOnPort(onRespond,localPort); + var data:ByteArray = new ByteArray(); + data.writeUTFBytes(message); + myUDP.send(data,0,0,targetIp,targetPort); + myUDP.receive(); + } + + /**Returns the last time that connection accured */ + public function getLastConnectionTimeout():int + { + return getTimer()-lastMassageDeliveryTime; + } + } +} \ No newline at end of file diff --git a/notification/NotificationEvent.as b/notification/NotificationEvent.as index 2b14cbd5..1b4bf925 100644 --- a/notification/NotificationEvent.as +++ b/notification/NotificationEvent.as @@ -4,8 +4,8 @@ package notification public class NotificationEvent extends Event { - public static const TOKEN_REGISTER_COMPELETED="TOKEN_REGISTER_COMPELETED" - public static const TOKEN_REGISTER_START = "TOKEN_REGISTER_START" + public static const TOKEN_REGISTER_COMPELETED:String="TOKEN_REGISTER_COMPELETED" + public static const TOKEN_REGISTER_START:String = "TOKEN_REGISTER_START" public static const NOTIFICATION:String = "NOTIFICATION"; public static const FOREGROUND_NOTIFICATION:String = "FOREGROUND_NOTIFICATION"; diff --git a/notification/NotificationManager.as b/notification/NotificationManager.as index dd240358..519f8e78 100644 --- a/notification/NotificationManager.as +++ b/notification/NotificationManager.as @@ -69,7 +69,7 @@ return Notification_Event ; } - private function EasyPushExample() + private function EasyPushExample() :void { //Controll permissions↓ diff --git a/photoEditor/EditorPencil.as b/photoEditor/EditorPencil.as index ca491f3d..b70aa312 100644 --- a/photoEditor/EditorPencil.as +++ b/photoEditor/EditorPencil.as @@ -194,7 +194,7 @@ package photoEditor var tool:MovieClip = event.currentTarget as MovieClip ; var toolSize:Number = uint(tool.name.split(toolsSizeName).join('')); - for(var i = 0 ; i = imageHistory.splice(imageIndex+1,imageHistory.length-imageIndex); - for(var i = 0 ; i