0

I have an object that creates a slideshow:

Banner = SlideShowScroller.create({
    height     : 300,
    auto       : true,
    navigation : {
        color           : "#000",
    },
    slides : [
    { image : "/images/1.jpg" },
    { image : "/images/2.jpg" },
    ]
});

How do I insert a new "slides" entry?

{ image : "/images/3.jpg" },

Is there a way to add an array to populate the slides?

Brandon
  • 81
  • 3
  • 10
  • This looks like a jquery plugin. I'm sure the documentation will show you how to add additional slides. Most likely its not as easy as adding more slides to the slides array because the container heights and widths are calculated dynamically. Check for an update method in the documentation. – Jeff Ryan Dec 16 '13 at 04:33
  • What is SlideShowScroller, Titanium doesn't have such control!! What you're trying to do? Can you be more specific? – Anand Dec 16 '13 at 06:47
  • Sorry, I will try to be more specific. This is a custom titanium module that I purchased. I can manually and the new slides as you can see, but I cannot figure out how to dynamically add them. I would like to eventually populate the slideshow from a json file, but I cannot figure out how to simple just insert one new slide from a variable. – Brandon Dec 16 '13 at 14:30

1 Answers1

1

It looks like the js Object you created has a field "slides" which is an array of js Objects I would try this:

Banner.slides.push({ image : "/images/3.jpg" });

additionaly, you can use chrome element inspector (or firebug in firefox) with the break point to look at the structure of "Banner". Once you figured how to access the field "slides" I think you can just push your new image Object

Julien Altieri
  • 768
  • 5
  • 10
  • Thanks for the reply. WHen I try this, I get the following error message: 'undefined' is not an object (evaluating 'Banner.slides.push') – Brandon Dec 16 '13 at 14:30
  • That means could mean that slides is not a field in Banner. Are you using Chrome? if yes, right click anywhere in the page and choose "inspect element" then in the tabs go to 'source' and find your code in the file list. But a break point on the line of code above and and reload the page. The code should pause on the line and you will be able to hover your Banner object and see it's structure. – Julien Altieri Dec 16 '13 at 18:14
  • I am using Titanium Studio, so I cannot inspect with Chrome. – Brandon Dec 17 '13 at 13:53
  • I found this: http://stackoverflow.com/questions/1625208/print-content-of-javascript-object If you have a console to log stuff, you can do: `JSON.stringify(Banner,null,4);` – Julien Altieri Dec 17 '13 at 18:12