Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Quick Start



This guide provides basic instructions on installing the Alloy command-line interface (CLI) and creating a quick project.

Command-Line Interface Installation

The following procedure needs to be only performed once.

Prerequisite: Titanium Studio 2.1.x or greater needs to be installed and configured before installing the Alloy CLI. Refer to the Titanium Studio Quick Start Guide for instructions.

  1. Download and install Node.js, which includes the npm package manager needed to install Alloy.
  2. From a terminal, run the following command to install Alloy:

Project Setup

The following procedure needs to be performed for each project.

  1. Create a new project in Titanium Studio.
  2. Open a terminal inside Titanium Studio. From the menu, navigate to Window > Show View > Terminal.
  3. Run the following command from the terminal:

After these steps, the Alloy project will run in Titanium Studio. Be aware when working with an Alloy project that all files in the Resources directory will be overwritten. All work should be done in the app folder.

Simple Example

The following example converts the image_view_file.js file from the KitchenSink project to an Alloy project.

To see the example in the KitchenSink application, click on the Base UI tab, then navigate to Views > Images Views > Image File.


Replace the contents of app/views/index.xml with the following:

Alternatively, instead of using the onClick attribute, the addEventListener method can be used with the controller component.

Titanium Style Sheet

Replace the contents of app/styles/index.tss with the following:


Replace the contents of app/controllers/index.js with the following:


Create a folder called app/asset/images and copy the apple_logo.jpg file from the KitchenSink project. This file will be copied to Resources/images/apple_logo.jpg by Alloy during the build process.

Compile and Run

Click the Run button and select the device to launch the application. Alloy will generate the Titanium Mobile files from the Alloy project files, which will then be compiled by Titanium Studio and launched on the device simulator.

  • No labels