Package | com.dwuser.ss4.managers |
Class | public class XMLManager |
FlashSlideshow_instance.xmlManager
property.
This class can be extended, but at this point there is no reason to do so.
Once the SlideshowEvent.DATA_XMLLOADED
event has been dispatched on the main slideshow instance, you can then use the query
and/or
queryList
methods to query or modify the XML object.
Working With Dynamic Data Sources: Transforming the XML Format
Sometimes, when you use a dynamic data source, you may not have full control over all of the fields which are passed. A common example of this is a Flickr API feed. When using a Flickr API feed, only the image
title is passed; the description is not. In other cases, you may not have access to all XML fields, but you need to pass something like a custom autoplayDelay
value for a specific image. To work around
this limitation, the XFS v4 provides custom field transformation support. This allows you to embed multiple fields in a single field which is passed,
and the XMLManager automatically parses out all of the information and assigns it to the appropriate fields. There are two custom transformation types which are supported:
Embedding caption/description in the title field: In cases like the Flickr API usage case described above, you may need to include both the caption/description and title all in the title field. To
do this, specify both the title and caption in the title
attribute, separated by: {desc}
. The {desc}
code indicates the boundary between the title and the caption.
Here is an example:
<img src="somefile.jpg" title="The Image Title{desc}The image description/caption is here." />
Custom image attributes embedded in the caption: This is especially helpful when using an RSS feed, or some other format in which you have no control over custom slideshow-relevant <img ... />
fields (such as autoplayDelay
or toolTip
). In these instances, you include a special value (or values) in the caption/description which will cause the XML parser to add custom attributes to
the corresponding <img ... />
node which is created. The format for this custom value is: {setAtt:attributeName=attributeValue}
. Thus, suppose you wanted to set a custom
autoplayDelay
value of stop
(which makes autoplay stop when the image is reached). To do this, you would use a caption/description like this:
The image's full description {setAtt:autoplayDelay=stop}
This would result in: <img ... caption="The image's full description " autoplayDelay="stop" />
. The next example shows a caption/description which would specify a custom video file for the slide, as
well as specify a custom tooltip:
The image's description {setAtt:toolTip=Click the slide for video to play...} {setAtt:video=path/to/custom_movie.flv}
See also
Property | Defined by | ||
---|---|---|---|
failedURLs : Array
If a loading failure occurs while loading any of the XML files, its url will be added to this array.
| XMLManager |
Method | Defined by | ||
---|---|---|---|
query(q:String, x:XML = null):*
Allows for querying the XML object for a single node using an XPath query.
| XMLManager | ||
queryList(q:String, x:XML = null):XMLList
Allows for querying the XML object for a list of results using an XPath query.
| XMLManager |
failedURLs | property |
public var failedURLs:Array
If a loading failure occurs while loading any of the XML files, its url will be added to this array.
query | () | method |
public function query(q:String, x:XML = null):*
Allows for querying the XML object for a single node using an XPath query.
Returns an XML
node result. You can use e4x expressions on the returned XML.
This method should not be called until the main slideshow dispatches the SlideshowEvent.DATA_XMLLOADED
event, which indicates that the XML data is ready to be accessed.
If you select multiple nodes and get an XMLList
result, use the queryList
method instead.
q:String |
|
x:XML (default = null )
|
* |
See also
queryList | () | method |
public function queryList(q:String, x:XML = null):XMLList
Allows for querying the XML object for a list of results using an XPath query.
Returns an XMLList
of results. You can use e4x expressions on the returned XMLList.
This method should not be called until the main slideshow dispatches the SlideshowEvent.DATA_XMLLOADED
event, which indicates that the XML data is ready to be accessed.
If you only want to select a single XML
node, use the query
method instead.
q:String |
|
x:XML (default = null )
|
XMLList |
See also