Change backgroundImage of right Nav button in Titanium - iPhone - iphone

I am developing an iPhone app using Titanium Alloy.
My problem is that I would like to change the backgroundImage of rightNav button.
I am using the rightNav button as a Filter button. My Filter button is placed in a window which also has a table. Once the filter button is clicked a new window is opened where the user can make some selections. Once the selection is made, the table on the previous page is refreshed based on the selections made and I would like to change the backgroundImage of the rightNav button to show that some selections have been applied. But I am unable to do so.
My code :
if ((screenType === "parentWindow") {
$.rightNav.visible = true;
$.rightNav.backgroundImage = "/images/buttons/filterOff.png";
} else if ((screenType === "childWindow")) {
$.rightNav.visible = true;
$.rightNav.backgroundImage = "/images/buttons/filterOn.png";
}
The backgroundImage of the rightNav button is set first time and then it is not changed. I have tried to make it null and then set it again but it does not work.
Please help.
Other details :
Titanium Command-Line Interface, CLI version 4.0.0, Titanium SDK version 4.0.0.RC, Mac OS X 10.10
Thanks

Try using the image property .

Related

Restarting carousel event paused on iPad and iPhones

I recently worked out a solution to another problem involving carousels on another post, but I found one issue when it comes to restarting the auto transitions from panel to the next on iPhones and iPads. (They won't restart.)
Here's a link to my original post and solution: Vanilla JS carousel next/prev button killing mouseover event pause
Here's a link to a JSFiddle containing my solution: https://jsfiddle.net/npzu90do/
After posting that solution I found that everything worked as it should accept the auto transition from one panel to the next stopped if you ever clicked the 'Prev' and 'Next' buttons on the sides. So I added this code to help restart the auto panel movement if you clicked outside the carousel.
document.getElementsByTagName("body").onclick = function(e) {
if(e.target != document.getElementById('carousel')) {
intervalID=setInterval(carouselPlus,speed,1)
}
}
Which works perfectly on all browsers except if you are on an iPad or iPhone.
I tried adding the following but that stopped the carousel from auto-starting due to errors in all browsers.
let touchEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
document.getElementsByTagName("body").addEventListener(touchEvent, function(e) {
if(e.target != document.getElementById('carousel')) {
intervalID=setInterval(carouselPlus,speed,1)
}
});
Any suggestions?

RE:Create a button which when pressed it replaces an existing object on the screen to another object in Smartface App Studio?

After seeing #catherinelagoon's post I also having difficulty in quite understand how to replace an object using a button so is it possible to create a button which when pressed it replaces an existing object on the screen to another object in Smartface App Studio?
I tried using the answer provided in the post however I couldn't understand it much due to I'm a beginner in using Smartface App Studio and coding itself.
Thankyou and sorry for any inconvienience
After you create an image you should add it to a Page so it can show on that page. So here is a simple code for creating and showing an image on the page.
var image = new SMF.UI.Image({
visible: false
});
Pages.Page1.add(image);
function Page1_TextButton1_OnPressed(e) {
image.visible = true;
}

Smartface Android Header Logo

Can I change this logo to show slider on android? I tried
this.actionbar.logo = "img_source";
in HeaderBar script page, but it didn't change.
Correct property is icon ;
this.actionBar.icon = 'img_source';
You can read more about actionBar from http://www.smartface.io/developer/guides/controls/actionbar/

Open File Picker in snap view of Metro Style App

When I try to open file picker on snap view in Metro Style App, exception occurs and exception dialog box was shown. How to solve that problem? Is there any good idea? I want my app works properly even on snap view.
Before opening the file picker, you must try to leave the snapped mode.
Here is the code I use:
var ready = true;
if (ApplicationView.Value == ApplicationViewState.Snapped)
ready = ApplicationView.TryUnsnap();
if (!ready)
return;
The SDK samples available on msdn use the following snippet
// FilePicker APIs will not work if the application is in a snapped state.
// If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
bool unsnapped = ((ApplicationView::Value != ApplicationViewState::Snapped) || ApplicationView::TryUnsnap());
if (!unsnapped)
{
// Unsnapping failed
}

Titanium: Youtube video

How can I show a youtube or bits on the run video full screen on my app? Is there a special link I have to naviate to? Or is there a special API that takes care of that to view it fullscreen?
The idea is to click on a link 'show video', then show the video fullscreen, and get a button play pauze and 'done'. When clicked done it goes back to the previous page.
I don't know how to get started on this one. Can anyone help me out?
I'm creating an iPhone app.
Thanks!
#Muhammad has the first part right but to get it to close when you hit the blue done button you'll need the following code.
replace
win.add(activeMovie);
activeMovie.play();
with
win.add(activeMovie);
activeMovie.fullscreen = 1; // this must be defined after you add to the window!
activeMovie.play();
then add this
activeMovie.addEventListener('fullscreen', function(e) {
if(!e.entering) { // this is run only when exiting fullscreen aka the blue done button
activeMovie.stop();
}
});
Here is a an example code to show video with controlls
var win = Titanium.UI.currentWindow;
var contentURL = 'http://movies.apple.com/media/us/ipad/2010/tours/apple-ipad-video-us-20100127_r848-9cie.mov';
var activeMovie = Titanium.Media.createVideoPlayer({
contentURL: contentURL,
backgroundColor:'#111',
movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode:Titanium.Media.VIDEO_SCALING_MODE_FILL
});
win.add(activeMovie);
activeMovie.play();
Hope this will help.