Web Site: http://jscamp.asia/ Twitter: http://twitter.com/jscamp_asia
Ping me @cheeaun on Twitter if you found some awesome stuff for #jscamp. This gist will be updated whenever there's new stuff.
| //Titanium.App.exit for Android | |
| //Use finish() method for current activity: | |
| var activity = Titanium.Android.currentActivity; | |
| activity.finish(); | |
| //Works for 1.5+: http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Android.Activity-object.html | |
| Ti.API.info(JSON.stringify(someObject)); |
| [ERROR][WindowManager( 1048)] Activity org.appcelerator.titanium.TiModalActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40cb3818 that was originally added here | |
| [ERROR][WindowManager( 1048)] android.view.WindowLeaked: Activity org.appcelerator.titanium.TiModalActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40cb3818 that was originally added here | |
| [ERROR][WindowManager( 1048)] at android.view.ViewRoot.<init>(ViewRoot.java:258) | |
| [ERROR][WindowManager( 1048)] at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148) | |
| [ERROR][WindowManager( 1048)] at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) | |
| [ERROR][WindowManager( 1048)] at android.view.Window$LocalWindowManager.addView(Window.java:424) | |
| [ERROR][WindowManager( 1048)] at android.app.Dialog.show(Dialog.java:241) | |
| [ERROR][WindowManager( 1048)] at ti.modules.titanium.ui.widget.TiUIActivityIndicator.handleShow(TiUIActivityIndicator.java:228) | |
| [ERROR][WindowManager( 1 |
| var win = Titanium.UI.createWindow({ | |
| title: 'Video Recording from Appcelerator Titanium', | |
| backgroundColor: '#fff' | |
| }); | |
| // const value grabbed from | |
| // http://developer.android.com/reference/android/provider/MediaStore.Audio.Media.html#RECORD_SOUND_ACTION | |
| var RECORD_SOUND_ACTION = "android.provider.MediaStore.RECORD_SOUND"; | |
| var soundUri = null; // Will be set as a result of recording action. | |
| //http://developer.appcelerator.com/question/49321/can-we-record-video-using-titanium | |
| var win = Titanium.UI.createWindow({ | |
| title: 'Video Recording from Appcelerator Titanium', | |
| backgroundColor: '#fff' | |
| }); | |
| var recordButton = Titanium.UI.createButton({ | |
| top: 10, left: 10, right: 10, height: 35, title: 'Record Video' | |
| }); | |
| win.add(recordButton); |
| iPhone 5 Assets and Splash Screens | |
| For best results, existing applications should be updated with assets to fit the new iPhone 5 screen (1136 x 640 pixels) as needed. | |
| Assets specific to the new screen should be named with the suffix -568h@2x. | |
| For example, the default splash screen image for the new screen is named Resources/iphone/[email protected]. |
| var casheBuster = new Date(); | |
| var view[i] = Titanium.UI.createImageView({ image:'image/'+image+'.jpg?casheBuster='+casheBuster.getTime() }); |
| $this->config->base_url(); |
Web Site: http://jscamp.asia/ Twitter: http://twitter.com/jscamp_asia
Ping me @cheeaun on Twitter if you found some awesome stuff for #jscamp. This gist will be updated whenever there's new stuff.
| private function getUniqueName () : String | |
| { | |
| var d : Date = new Date(); | |
| return d.getMonth() + 1 + '' + d.getDate() + '' + d.getHours() + '' + d.getMinutes() + '' + d.getMilliseconds(); | |
| } |
| 於AS3中呼叫JS函數並傳遞參數方法 ExternalInterface.call( ); | |
| 1、AS3部分,Code範例為按鈕事件觸發後呼叫JS函數jstest | |
| var $jsvalue="test"; //宣告變數$jsvalue,變數值為test | |
| this.addEventListener(MouseEvent.CLICK,clicktrue); //按鈕偵聽器 | |
| function clicktrue(me:MouseEvent){ | |
| ExternalInterface.call("jstest",$jsvalue); //jstest為欲呼叫之JS函數,$jsvalue為AS3欲傳遞到JS的參數值。 | |
| } |