Passing a variable to a newly created window

You must Login before you can answer or comment on any questions.

Ideally, I'd like this sequence of events to happen: 1. Window opens up camera, picture is taken 2. Confirmation window slides in and shows thumbnail of picture just snapped, and various text fields for the user to fill in, user clicks submit button. 3. Confirmation window slides in thanking them.

Right now, I can't pass the image from the camera into the confirmation window. I get the 'red screen of death' saying it can't find the variable. I attempted the solution suggested here with no success. Anyone have any advice?

Here is my camera code:

Titanium.Media.showCamera({
    success:function(event)
    {
        var image = event.media;
        win = Titanium.UI.createWindow({
            url:'upload_confirmation.js',
            title:'Confirmation',
            backgroundColor:'#fff',
            barColor:'#111'
        });
        win.image = image;
        Titanium.UI.currentTab.open(win,{animated:true});
    },
    saveToPhotoGallery:true,
    allowImageEditing:true
});

1 Answer

Hi!

Not sure if my answer will be of use but ill try! :)

You could set a global variable by using the following command, then on the new window retrieve this variable? I retreieve the variable with an onfoucs event so whenever the window is focused it gets the current number in the variable!

Titanium.App.Properties.setInt('globalselectedStation',selectedStation); Titanium.API.info('Selected Station ID:' + selectedStation);

window.addEventListener('focus',function() { var stationid = Titanium.App.Properties.getInt('globalselectedStation'); if (stationid > 0) {`

Your Answer

Think you can help? Login to answer this question!