titanium

Appcelerator and CommonJS modules (caching and circular references)

北城以北 提交于 2019-12-01 18:38:50
Here's the thing: I'm using the CommonJS way of making my mobile (iPhone/Android) application modular. No surprise there. But there's one thing that I just can't get my head around. CommonJS lets me create STATIC private variables, which lets me create singletons at ease. This, I think at least, is because the contents of a file that gets require() d is read only once and then the exports object (which is initialized only once) is returned every time. But when I create a circular reference as seen below, the code inside the included module is executed every time. Wait... Funny thing is, while

How to query the child views of a parent view using Titanium?

只谈情不闲聊 提交于 2019-12-01 17:18:44
问题 I am looking to create a general purpose routine that will operate over a view's children. Within the routine I need to be able to iterate over the child views. I don't see anything in the API that would suggest that there is any way to get the child views. There is an "add()" and a "remove()" method but nothing like "get()" nor does there appear to be any properties like "views". What am I missing? 回答1: this is the basic structure for removing child objects from a view if (view.children) {

Difference between self and this in javascript and when to use either of them [duplicate]

早过忘川 提交于 2019-12-01 15:25:13
Possible Duplicate: What underlies this JavaScript idiom: var self = this? I am confused that when to use self and this in javascript. I know that this refers to current context and self refers to current window. As I am developing an application in Titanium. I want to know when to use self or this OR does is there is any concept of self in titanium development. here is the sample code that i am doing in my titanium commonJS module var auth = require('/SDKTest/auth'); var nodeAPI = require('/SDKTest/nodeAPI'); function myAPI() { this.auth = auth; this.nodeAPI = nodeAPI; return this; } module

Titanium - animation is v. v. choppy

╄→гoц情女王★ 提交于 2019-12-01 13:09:37
So i have an image that i want to drop down the page. Should the user click a button, the image will stop said dropping down the page. I've used the eventListener 'complete' style to execute this... and it works, in a fashion. The problem is that the dropping down is choppy ~ irritatingly so. Is there a more efficient way for titanium to do some form of simple animation? Here is a code slice: ballAnimation = Ti.UI.createAnimation({ top: ballDown.top + 0.01*heightOfScreen, duration: someSpeedHere }, function(){ if (hasBeenPressed){ return; } else if (!hasBeenPressed && ballAnimation.top >

Titanium HTTPClient returns too 'fast'

好久不见. 提交于 2019-12-01 09:07:35
I have the following function: getTasks: function() { var taskRequest = Titanium.Network.createHTTPClient(); var api_url = 'http://myawesomeapi.heroku.com/users/' + Ti.App.Properties.getString("userID") + '/tasks'; var tasks = []; taskRequest.onload = function() { var response = JSON.parse(this.responseText), len = response.length, i = 0, t; for(; i < len; i++) { task = response[i]; var newTask = {}; newTask.rowID = i; newTask.title = task.title; newTask.description = task.description; newTask.id = task.id; newTask.hasChild = true; tasks.push(newTask); } alert(tasks); } taskRequest.open('GET',

What are some of the best ways to optimize a Titanium app?

匆匆过客 提交于 2019-12-01 08:22:22
I have a titanium based iOS app that basically is following my own MVC structure. It has around 30 views and a lot of network connections to do API calls. So, it seems that the application is performing assumably sluggish on an actual device except iPhone4S. Specifically, the app would hang for about 10s after re-launching it from the multi-tasking menu. Any tips? You mostly have to care about memory leaks. You have a VERY important webcast on the subject. In short; be very careful to : avoid big global objects : they have references to the world, so these references won't be cleared eliminate

How to select multiple images from gallery in titanium?

两盒软妹~` 提交于 2019-12-01 06:26:27
Here I have the code to select image from gallery, but how can I select multiple images from gallery? Ti.Media.openPhotoGallery({ // allowEditing:true, mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO], success : function(e) { alert(e); ImageView.image = e.media; //alert('height:'+e.media.height+'width:'+e.media.height); lblWidth.text = 'W :'+e.media.width; lblHeight.text ='H :' +e.media.height; }, cancel : function() { }, error : function(err) { } }); Here I found the module for android Link for marketplace (Multi Image Picker) and Link for the source code on github (TiMultiImagePicker). and here is

Titanium HTTPClient returns too 'fast'

心不动则不痛 提交于 2019-12-01 05:56:16
问题 I have the following function: getTasks: function() { var taskRequest = Titanium.Network.createHTTPClient(); var api_url = 'http://myawesomeapi.heroku.com/users/' + Ti.App.Properties.getString("userID") + '/tasks'; var tasks = []; taskRequest.onload = function() { var response = JSON.parse(this.responseText), len = response.length, i = 0, t; for(; i < len; i++) { task = response[i]; var newTask = {}; newTask.rowID = i; newTask.title = task.title; newTask.description = task.description;

CoffeeScript IDE for Windows - tried Titanium Studio and RubyMine

无人久伴 提交于 2019-12-01 00:12:55
I'm trying to find a good way to work on CoffeeScript on Windows and be able to process these files quickly to JavaScript in the IDE. RubyMine - if I just open a .coffee file in RubyMine this seems to work. But I see no button or menu option to convert to JavaScript. Titanium Studio - in this IDE there is a Menu option to do the conversion - but when used it seems to call out to gitbash on my machine. At least that is what shows up in the console in the IDE. So I'd like to get one or both of these to work on Windows... or get an alternate suggestion for a good CoffeeScript IDE with the

Output from AVAssetWriter (UIImages written to video) distorted

巧了我就是萌 提交于 2019-11-30 23:45:18
I am using an AVAssetWriter to encode a series of images to a movie file, following Zoul's answer here: How do I export UIImage array as a movie? . In short my process is: create UIImage from .png file Get CGImage from UIImage convert the CGImage to CVPixelBuffer (using zoul's function pixelBufferFromCGImage exactly) write the frames to .mov using a AVAssetWriterInputPixelBufferAdaptor and AVAssetWriter This is working fine in most cases, however sometimes the .mov file that is encoded is distorted (see picture below). I was wondering if this type of distorted image output is familiar to to