Community Questions & Answers

How to close a function?

Hi how do you close a function while opening another one? Here is my code! ~~~ //Application Window Component Constructor function ApplicationWindow() { //load component dependencies var FirstView = require('ui/common/FirstView'); //create component...

Function location return <null>

Hi I create a function with a return value (object with latitude, longitude et date) . ~~~ var myInfo = { status : false, message : false, longitude : false, latitude : false, date : false }; function getCurrentPos() { if (Ti.Network.online)...

function return boolean

i wish that a function can return an boolean. But i get only " { } ". This function is in a file in the forlder "lib". Thanks :) code: ~~~ function searchDb(titleSearch){ var result = false; var db =...

garbage collection in functions

Hi everyone. I'm trying to get my head around how garbage collection works in functions. If I have code such as: (of course, this is just sort of pseudocode; please don't worry about any syntax issues) ~~~ function blahFunction(){ var...

Paramter onClick in XML FIle

Hi, I have a button as below - is it possible to pass a parameter through here so I could have say: ~~~ <Button id="buttonTop" backgroundImage="small.png onClick="loadData(abc)" /> ~~~ then my method would look...

Alert box firing multiple times inside function

Hi guys, Onto the last piece of my latest app, and i'm having a slight issue I can't seem to fix. Basically, I want the user to click the 'drop' button and for the app to pop an alert to confirm it has been dropped, after the SQL has run on the...

Call function in module using commonjs

Hi all, this is my file function_module.js ~~~ function myfunction(){ var one = 1; var two = 2; var tot = (one + two); alert(tot); } exports.myfunction = myfunction; ~~~ In my window1.js ~~~ var function1 = require('ui/function_module'); var...

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...

Using callback in eventHandler

Hello all, Can't seem to figure this out. I want to use a callback function when the user presses a button. When I do: ~~~ currentButton.addEventListener('click', this.onClose); ~~~ everything works as advertised. But when I try to do an animation...

Looping array items

I have a code like this. ~~~ for (var i = 0; i < 2 i ++){ var userAlert = Titanium.UI.createAlertDialog({ title : 'Alert', message : 'Would you like to go in position ' + i + '?', buttonNames : ['YES',...

How to use Alloy.js

I am trying to understand how I can use Alloy.js file I tried a very simple example like alloy.js Alloy.Globals.getName=function(name) { return name; } Now I want to display then name that I pass to the getName function in alert box like ...

iOS 7 detection - docs supply incorrect method?

Hi i need to detect whether the iOS version is 7 or greater and change the top value of a window if it is however the example shown in the docs gives me an errors message: "Can't find variable: isIOS7Plus at iOS.js (line 82)" I got the code from...

connection management

I want to manage the person who connects to my application for this fact I must create a class I think to put a variable to false when the user is not connected to true and when it is connected once the person connected has a disconnect button to...

How have function available everywhere

Hello, I am developing an application for Android and iPhone that connects to the Internet, communicates json, Stock images and text and still something else. I wonder what is the best method to have functions available anywhere in my code. On any page...

Call function in app.js from inside window

Hey I kinda had a similar question earlier and it was answered, but for some reason it wont let me call a regular function. I have app.js with a window linked to login.js I want to call a function in app.js from login.js In login.js: ~~~ var win =...

Run functions in parent controller

Hi Appcelerators, Let's say we're using the controller "list". I from there create a new controller by using `var win = Alloy.createController('common')` and calling it as a modal, using `win.open({modal: true;})`. Now, this modal needs to run...

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...

Showing 1-50 of 155 1 2 3 4