Q: Slider
Hi,
I want to create a widget with multiple images of the same subject, but with different apertures so people can see the effect (depth of field) when changing the aperture.
I used the multiview object in iAd Producer and loaded the images.
Next I created a slider with the appropiate steps.
So far so good.
The slider works fine, but it needs to be coupled to the images.
In Events under Interaction I can select an option to go to the next cell, but not to go back.
Do I need additional java code of have I missed an event??
Any help would be appreciated.
Thanks in advance
Rien
Posted on Mar 23, 2014 6:19 AM
As with the other multicell objects, the MultiView object implements the functions of the iAd.CellContainer class which are documented here.
Given a page with a MultiView and a Slider, select the Slider on the page and click the inspector button.
Set the slider's Min value to 0, the Max value the the number of cells in your multiview minus 1 and Step value to 1.
Then all you need to do is hook up some code to tell the multiview to display the cell with an index value of the current position value of the slider.
With the slider selected, click the code button and choose Did Change Value from the Add Event Handler drop-down menu in the upper right of the code window.
A function onControlValueChange will be inserted and get called whenever the slider is moved by the user. To hook up the multiview and the slider, simply get a reference to the multiview and call its focusCellAtIndexAnimated function passing the value of the slider.
It should look something like:
this.onControlValueChange = function (event) {
// Code here for the "Did Change Value" event.
// get a reference to the multiview
var multiView = this.viewController.outlets.multiView;
// set the multiviews index to whatever my value is
multiView.focusCellAtIndexAnimated(this.value, true, true);
};
Cheers,
-Mark
Posted on Mar 24, 2014 3:11 PM