Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

set Camera Picture as window background

$
0
0

Hey guys,

I want to be able to take a picture and set the image as the background for a wndow. The window is already created, so I have to set the background afterwards..

blackButton.addEventListener('click',function(e){
    Titanium.App.Properties.setString("color", "black");
    systemPrefWindow.backgroundColor = "black";
    billsInputWindow.backgroundColor = "black";
    billsWindow.backgroundColor = "black";
    budgetWindow.backgroundColor = "black";
    wagesWindow.backgroundColor = "black";
    });
if this button is pressed, all the background colors are changed to black and the properties for color is set to black, which means the next time i open the app, the background is still black:
var systemPrefWindow = Titanium.UI.createWindow({
    title: "System Preferences",
    backgroundImage: "",
    backgroundColor:  Titanium.App.Properties.getString("color")
});
I have now a camera input:
function cameraSuccess(mediaItem)
{
    systemPrefWindow.setBackgroundImage = mediaItem.media;
 
    // also tried: systemPrefWindow.backgroundImage = mediaItem.media;
 
    alert("Took photo successfully.");  
}
 
function cameraError(error)
{
    Ti.Media.hideCamera();
    if (error.code == Titanium.Media.NO_CAMERA)
    {
        alert("No camera on device");
    }
    else
    {
        alert("Unexpected error: " + error.code);
    }
}
 
cameraButton.addEventListener('click', function(e){
    Ti.Media.showCamera({
        success: cameraSuccess,
        error: cameraError
    });
});
any idea how i can set the background image to the camera input ?

Thanks!

Daniel

Application type: mobile

Titanium SDK: Titanium Command-Line Interface, CLI version 3.4.0, Titanium SDK version 3.4.0.GA

Platform & version: Android 4.2.2 Device: HTC One X Host Operating System: Windows 8.1 Titanium Studio: Titanium Studio, build: 3.3.0.201407100905


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>