stories(container, [cb])
Returns a collection of all story objects in the given document or returns the parent story of a certain element. These elements can be text frames or text objects.
If a callback function is given, stories()
calls this callback function on each story object of the given document or on the parent story of the given element. When the callback function returns false, the loop stops and the stories()
function returns an array of all stories up to this point.
Type: function
Parameter(s):
- container {Document}:
The document instance to iterate the stories in or the element whose parent story to get.
- cb {Function} Optional:
Optional: The callback function to call with each story. When this function returns false the loop stops. Passed arguments:
story
,loopCount
Returns:
-
{Stories | Array}:
A collection or an array of Story objects.
Example(s):
stories(container(), function(story, loopCount){
println("Number of words in each Story:");
println(story.words.length);
});