Community Questions & Answers

Function Using Problem

Hi folks ,I m using Ti 3.0 and for ios6. My code is below. and I want to use my function multiple times.I want to reuse my function. when I add win1 no problem.but When I add win1 and win2 .this app crashed. ~~~ //tasarim.js function...

Use function in different .js

Hey there, I'm using the latest Titanium Studio(3.0.1) and developing with a default android SDK of 2.2. I was wondering if i could create a function in my app.js which can be used in different JS files aswell. Is this possible, and if so: How? For...

Property of object is not a function

I am pretty stumped on this, it seems like it should be dead simple. I have a function called toast() that I use all the time in my code without problem (Note, this is my own function, I am not trying to call for an android toast!) But when I call it from...

Namespaces explanation!

I am having this code which I found open source: ~~~ var abc = {}; // namespace abc.dosth = function(msg, enc) { //HERE I CALL ALL OTHER FUNCTIONS SO I JUST HAVE TO FIND A WAY TO CALL THIS FUNCTION FOR STARTERS return sth; } abc.dosth2 =...

Pull items from Database

Hey Guys, I'm stuck at a tricky part of the development of my app and I was hoping you guys could help me out. I managed to pull all of my content on the view from a sqlite database file, but I can't get some items to work. If you look at my code below,...

Array not returned properly

I am returning the array using a function in titanium.There are two entries in my array which are showing alert but when i access the returned value in another js file.It only show one value in alert Here is my code (it is in db.js): ~~~ function quizfun()...

function output

Hi there, i am curious about some issue, is there a way to put a function output to a variable? For example: ~~~ var get_url = function(video_id){ var xhr = Titanium.Network.createHTTPClient(); xhr.onload = function() { var...

pass value to function

Does anyone know how can I pass the custom message to sayhi function ? //win.js var btn = new ui.button(standandBtn('Button'), sayhi) function standandBtn(title){ var obj = {top:10, left:10, title:title}; return obj; } function...

diff two arrays of objects

I'm googeling and working for days on that problem, and I don't have any solution yet. I want to diff two arrays of 1-level objects. I want to compare each field of every object. On difference push it to a result array. Maybe the community has an answer...

Keycode.

Greetings, the Keycode works in Titanium ? for example a function to detect if a variable is number: ~~~ function isNumber(numero){ var charCode; charCode = numero.keyCode; if (charCode > 31 && (charCode 57)) { return...

Arrays / scope (a Yelp example)

I'm having trouble passing back data returned from using Yelp 1.0 API. The function accepts a latitude and longitude (static from a database, not from dynamic geolocation). I want to return variable data from the results (yelp results lat, lng, name, url,...

Add to an Array

I'm drawing a blank, how do I use a function to add to an array? ~~~ var cartItems=[]; function addItem(title, car, color, qty, price){ var item = [{title: title, car: car, color: color, qty: qty, price: price}]; cartItems.push(item); } addItem(Hub...

Android - Simple listener function problem

Hi guys, I'm having a bit of a problem. I've got 9 image views (img1, img2, img3, etc) and I want to add a click event listener to all of them. I've tried saving the function as a variable but somehow the `e` isn't associated with the imageview. example...

Exit from a function

~~~ // how to exit from funtion after errorDialog.show() ? function myfunction(e) { if (text1.value == '' || text1.value == null) { var errorDialog = Ti.UI.createAlertDialog({ title: 'Error!', message: 'You must provide a value...

Picker Strange problem

I am updating an older app I made and having a weird issue with the picker. I'm using the 1.3 SDK and the picker displays fine until I add this function. If I comment out the "var = HT" line, the picker comes up fine. My whole app is based on...

Question about calling an instance/object

titanium sdk 1.8.2 iphone sdk 4.3 Hi, If I call the function this way, via a click of a button: ~~~ addBtn.addEventListener('click', function(){ var addview = new AddView(); self.add(addview); }); ~~~ if I click the button again and again, does it...

how to hide a function/module?

titanium sdk 1.8.2 iphone sdk 4.3 Hi, I created two windows using two different functions/modules and its ocurence is controlled by a play and pause button. When I pressed the button, the function gets loaded overlapping the play view, which is ok. ...

Refresh Window

Hi, I have no problems refreshing the window by pointing the button to the ~~~ function ApplicationWindow() {} ~~~ However, the screen is not updated with the proper information. It remains the same. The ApplicationWindow ~~~ //Application Window...

Showing 1-50 of 115 1 2 3