<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Designscripting &#187; XML</title>
	<atom:link href="http://www.designscripting.com/category/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.designscripting.com</link>
	<description>Latest in flash, Free slideshow, Flash tutorials, advance flash, actionscript, Adobe Air, flash slideshow, New technology, RIA, Abstract wall paper</description>
	<lastBuildDate>Thu, 17 Jun 2010 09:48:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Looping through each XMLNode and each attributes within Node:</title>
		<link>http://www.designscripting.com/2010/03/looping-through-each-xmlnode-and-each-attributes-within-node/</link>
		<comments>http://www.designscripting.com/2010/03/looping-through-each-xmlnode-and-each-attributes-within-node/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 08:12:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flash CS4]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.designscripting.com/?p=371</guid>
		<description><![CDATA[In this tutorial we are going to iterate through node in a XML. Intead of using direct approach of getting the XML Length(); We are going to use indirect approach to loop through the XML.
Here we are going to use For each statement and iterate through the nodes to access information intead of using index values. 
Here is XMLManager class to load XML without pain.
Before proceeding we must know the difference between XML and XMLList.
XML:
XML is a single or collection of XMLNodes with in a rootnode.
XML example:


	
	

Note:
Here the root node ...]]></description>
			<content:encoded><![CDATA[<p>In this tutorial we are going to iterate through node in a XML. Intead of using direct approach of getting the XML Length(); We are going to use indirect approach to loop through the XML.</p>
<p>Here we are going to use For each statement and iterate through the nodes to access information intead of using index values. </p>
<p>Here is <a href="http://www.designscripting.com/2008/11/xmlmanager-in-actionscript-30/">XMLManager class</a> to load XML without pain.</p>
<p>Before proceeding we must know the difference between XML and XMLList.</p>
<p>XML:<br />
XML is a single or collection of XMLNodes with in a rootnode.</p>
<p>XML example:</p>
<pre class="brush:as3">
<library>
	<book id='1' name='Book1' author='XXXXXX' category='YYYYYY'></book>
	<book id='2' name='Book2' author='AAAAAA' category='ZZZZZZ'></book>
</library></pre>
<p>Note:<br />
Here the root node is Library which contains Book Nodes.</p>
<p>XMLList:<br />
A collection of XMLNode without root node.</p>
<p>XMLList example:</p>
<pre class="brush:as3">
	<book id='1' name='Book1' author='XXXXXX' category='YYYYYY'></book>
	<book id='2' name='Book2' author='AAAAAA' category='ZZZZZZ'></book>
</pre>
<p>Next we will see how to interate through XMLNodes.</p>
<pre class="brush:as3">
var _xml:XML =
<library><book id='1' name='asdasd' author='sdcxc' category='fgsdgvs'></book><book id='2' name='sdas' author='hfdhghfg' category='sdfsdf'></book></library>
var _xmlList:XMLList = _xml.Book;

for each(var node in _xmlList)
trace(node.attribute('id'))
</pre>
<p>There may be situation that the number of attributes with in a node may not be know. So we should loop through the all the attributes of a XMLNode. </p>
<pre class="brush:as3">var _xml:XML =
<library><book id='1' name='asdasd' author='sdcxc' category='fgsdgvs'></book><book id='2' name='sdas' author='hfdhghfg' category='sdfsdf'></book></library>
var _xmlList:XMLList = _xml.Book;
trace("Attribute::Value");
trace("----------------")
for each(var node in _xmlList){
		for each(var attribute in node.attributes())
		trace(attribute.name()+"::"+attribute)
		trace("********Node End*********")
	}
</pre>
<p>Output:</p>
<p>Attribute::Value<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
id::1<br />
name::Book1<br />
author::XXXXXX<br />
category::YYYYYY<br />
********Node End*********<br />
id::2<br />
name::Book2<br />
author::AAAAAA<br />
category::ZZZZZZ<br />
********Node End*********</p>
<p>Cheers :p</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designscripting.com/2010/03/looping-through-each-xmlnode-and-each-attributes-within-node/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free Dynamic Flash Slideshow</title>
		<link>http://www.designscripting.com/2009/11/free-dynamic-flash-slideshow/</link>
		<comments>http://www.designscripting.com/2009/11/free-dynamic-flash-slideshow/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 09:31:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Webmasters]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.designscripting.com/?p=214</guid>
		<description><![CDATA[Slideshows is an excellent way of organizing content, Images and keep your website clean and user-friendly.
One main reason for using slideshows over other ways is that people are used it regularly when they browse over the Internet, and it’s easy to showcase the content of a website.
Slideshows can be used in

Entertainment sites
Gaming sites
Portfolios
Magazine sites

Designscripting.com released FaderAPI to create slideshows on the fly; here is some working samples of Slideshows using the FaderAPI&#8217;s
Features of the slideshow:

Slideshow can load Image and SWF files.
SWF may also be an animated file.
No Need of Preloaded- ...]]></description>
			<content:encoded><![CDATA[<p>Slideshows is an excellent way of organizing content, Images and keep your website clean and user-friendly.</p>
<p>One main reason for using slideshows over other ways is that people are used it regularly when they browse over the Internet, and it’s easy to showcase the content of a website.</p>
<h3>Slideshows can be used in</h3>
<ul>
<li>Entertainment sites</li>
<li>Gaming sites</li>
<li>Portfolios</li>
<li>Magazine sites</li>
</ul>
<p><a href="http://www.Designscripting.com" target="_blank">Designscripting.com</a> released FaderAPI to create slideshows on the fly; here is some working samples of Slideshows using the FaderAPI&#8217;s</p>
<h2><strong>Features of the slideshow:</strong></h2>
<ol>
<li>Slideshow can load Image and SWF files.</li>
<li>SWF may also be an animated file.</li>
<li>No Need of Preloaded- Since the animation will not happens until the next file is loaded.</li>
<li>Customized events to handle the Slideshow</li>
<li>Move to next or previous slides.</li>
<li>Ability to jump to particular slide</li>
<li>Repeat and randomize the slide</li>
</ol>
<h2>Added new features:</h2>
<ol>
<li>Full customization via XML file</li>
<li>Make the slideshow interactive or not.</li>
<li>User can add description text.</li>
<li>Position controls and description text on screen</li>
<li>Description text supports HTML text</li>
<li>Customizable animations for description text</li>
<li>Can adjust the time interval</li>
</ol>
<h2>Free SlideShow Sample</h2>
<p style="text-align: center;"><a href="http://www.designscripting.com/wp-content/uploads/2009/11/Fader%20to%20load%20External%20image.html" target="_blank"><img class="size-full wp-image-220 aligncenter" title="Slideshow" src="http://www.designscripting.com/wp-content/uploads/2009/11/Slideshow.jpg" alt="Slideshow" width="479" height="217" /></a></p>
<h3>Related Articles about Fader API</h3>
<pre><a href="http://www.designscripting.com/2009/04/14/slideshow-using-faderfilematerial-updated/" target="_blank">http://www.designscripting.com/2009/04/14/slideshow-using-faderfilematerial-updated/</a></pre>
<pre><a href="http://www.designscripting.com/2009/01/20/using-faderfilematerial-to-create-slideshow/" target="_blank">http://www.designscripting.com/2009/01/20/using-faderfilematerial-to-create-slideshow/</a></pre>
<pre><a href="http://www.designscripting.com/2009/02/12/fader-apislideshow-with-movieclips-on-stage/" target="_blank">http://www.designscripting.com/2009/02/12/fader-apislideshow-with-movieclips-on-stage/</a></pre>
<h2>Customizable variables in XML &#8211; To change the slideshow behavior</h2>
<pre><strong>Interval: interval (Time duration between two slides)
	Should be positive numeric value Multiples of 1000
	1000 = 1 second
	5000 = 5 second</strong>

<strong>Repeat: repeat (Animation repeats depends on the value)
	Should be either
	true = Repeats the animation
	false = stops the animation once the slides reaches the end</strong>

<strong>Randomize: randomize (The slides may play in random order depends upon this value)
	Should be either
	true = Randomize the animation
	false = Plays the slides in the sequential order</strong>

<strong>Reader Text Animation Type: readerTextAnimationType (The type of animation for the description text)
	Blinds
 	Fade
 	Fly
 	Iris
 	Photo
 	PixelDissolve
 	Rotate
 	Squeeze
 	Wipe
 	Zoom</strong>

<span style="color: #000000;"><strong>Reader Text Animation Type</strong></span><strong>: readerTextPosition (Position the Description text on the slideshow)
	Default is 0
	Value = 0 position at the Top and
	Value more than 0 increases on Y</strong></pre>
<pre><strong>
</strong></pre>
<h2><a href="http://www.designscripting.com/donate/" target="_blank">Donate Me</a></h2>
<pre style="text-align: center;"><a href="http://www.designscripting.com/wp-content/uploads/2009/11/Free-SlideShow.zip"><img class="alignnone" src="http://www.designscripting.com/wp-content/uploads/2008/12/download.jpg" alt="" width="239" height="54" /></a></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.designscripting.com/2009/11/free-dynamic-flash-slideshow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActionScript3.0 Quiz</title>
		<link>http://www.designscripting.com/2009/11/actionscript3-0-quiz/</link>
		<comments>http://www.designscripting.com/2009/11/actionscript3-0-quiz/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 10:30:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flash CS4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.designscripting.com/?p=156</guid>
		<description><![CDATA[Today I came across the wonderful website(learningactionscript3.com) for actionscript,
I have taken the quiz section where we can see questions from chapters of the book Learning ActionScript3.0, It covers all the chapters from

ActionScript Overview,
Events,
Display List,
OOP,
Text,
Sound,
Video,
XML,
Advance Actionscript.

Below is the screenshot of the result.

From the result I need to concentrate in XML and Prgramming Design.
I encourage you people to participate in the Quiz and post me the Screenshot to publish here in the blog.
All the best guys&#8230;
cheers  
]]></description>
			<content:encoded><![CDATA[<p>Today I came across the wonderful website(learningactionscript3.com) for actionscript,</p>
<p>I have taken the quiz section where we can see questions from chapters of the book Learning ActionScript3.0, It covers all the chapters from</p>
<ul>
<li>ActionScript Overview,</li>
<li>Events,</li>
<li>Display List,</li>
<li>OOP,</li>
<li>Text,</li>
<li>Sound,</li>
<li>Video,</li>
<li>XML,</li>
<li>Advance Actionscript.</li>
</ul>
<p>Below is the screenshot of the result.</p>
<p><img class="aligncenter size-full wp-image-157" title="Actionscript-Quiz" src="http://www.designscripting.com/wp-content/uploads/2009/11/Actionscript-Quiz.jpg" alt="Actionscript-Quiz" width="546" height="445" /></p>
<p>From the result I need to concentrate in XML and Prgramming Design.</p>
<p>I encourage you people to participate in the Quiz and post me the Screenshot to publish here in the blog.</p>
<p>All the best guys&#8230;</p>
<p>cheers <img src='http://www.designscripting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.designscripting.com/2009/11/actionscript3-0-quiz/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dynamic Slideshow + with preloader</title>
		<link>http://www.designscripting.com/2009/01/dynamic-slideshow-with-preloader/</link>
		<comments>http://www.designscripting.com/2009/01/dynamic-slideshow-with-preloader/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 10:33:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.designscripting.com/?p=78</guid>
		<description><![CDATA[In this version2 of Dynamic slide show i have added preloading support and opening links on clicking the image..
Here you can have look t previous version 
Nothing complicated from the previous version&#8230; just need to update the swf and xml
in xml
image url=&#8221;Images/image1.jpg&#8221; gotoURL=&#8221;http://www.designscripting.com&#8221; target=&#8221;_blank&#8221;
gotoURL = webpage to be opened on clicking
target = _blank &#124; _self
_blank opens the link in new page;
_self opens the link in same page.
Next in slideshow is Fader Classes in AS3 with that its possible to Fade back to back images, wait till preloading, load animated swf ...]]></description>
			<content:encoded><![CDATA[<p>In this version2 of Dynamic slide show i have added preloading support and opening links on clicking the image..</p>
<p><a href="http://www.designscripting.com/2008/11/12/dynamic-slideshow-xml-flash/" target="_blank">Here you can have look t previous version </a></p>
<p>Nothing complicated from the previous version&#8230; just need to update the swf and xml</p>
<p>in xml</p>
<p>image url=&#8221;Images/image1.jpg&#8221; gotoURL=&#8221;http://www.designscripting.com&#8221; target=&#8221;_blank&#8221;</p>
<p style="padding-left: 30px;">gotoURL = webpage to be opened on clicking</p>
<p style="padding-left: 30px;">target = _blank | _self</p>
<p style="padding-left: 90px;">_blank opens the link in new page;</p>
<p style="padding-left: 90px;">_self opens the link in same page.</p>
<p>Next in slideshow is <strong>Fader Classes</strong> in AS3 with that its possible to Fade back to back images, wait till preloading, load animated swf files in slideshow, fade textfield without embeding fonts&#8230; <img src='http://www.designscripting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="padding-left: 30px; text-align: center;"><a href="http://www.designscripting.com/wp-content/uploads/2009/01/slideshow-v2.zip"><img src="http://www.designscripting.com/wp-content/uploads/2008/12/download.jpg" alt="" width="239" height="54" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.designscripting.com/2009/01/dynamic-slideshow-with-preloader/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>XMLManager in ActionScript 3.0</title>
		<link>http://www.designscripting.com/2008/11/xmlmanager-in-actionscript-30/</link>
		<comments>http://www.designscripting.com/2008/11/xmlmanager-in-actionscript-30/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 17:50:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XML Manager]]></category>

		<guid isPermaLink="false">http://www.designscripting.com/?p=36</guid>
		<description><![CDATA[XMLManager is a utility class that provides a single interface to load XML. Please find the source files at the end of the tutorial.
XMLManager Utility makes work easy to load XML in actionscript3.0, Utility is free to use.
Just pass the URL of the xml as explained in code at timeline at source file to load XML.
XMLManager Class : 


/**
  * XMLManager is a utility class that provides a single interface to load XML
  * And dispatches XMLLOADEDCOMPLETE event when the XML loaded
  *
  * Code from ...]]></description>
			<content:encoded><![CDATA[<p>XMLManager is a utility class that provides a single interface to load XML. Please find the source files at the end of the tutorial.<br />
XMLManager Utility makes work easy to load XML in actionscript3.0, Utility is free to use.<br />
Just pass the URL of the xml as explained in code at timeline at source file to load XML.</p>
<p><strong>XMLManager Class : </strong></p>
<p style="PADDING-LEFT: 30px">
<pre class="brush:as3">
/**
  * XMLManager is a utility class that provides a single interface to load XML
  * And dispatches XMLLOADEDCOMPLETE event when the XML loaded
  *
  * Code from -- <a href="http://www.designscripting.com/">http://www.designscripting.com/</a>
  * Don't delete the above lines.
  */
package com.Manager
{
  import flash.events.*;
  import flash.net.URLLoader;
  import flash.net.URLRequest;
  /**
   * XMLManager extends EventDispatcher to dispatch Event
   */
  public class XMLManager extends EventDispatcher
  {
    /**
     * Static variable XMLLOADEDCOMPLETE for holding the new Event
     */
    public static var XMLLOADEDCOMPLETE : String = "XMLComplete";
    public static var XMLLOADSTATUS : String = "XMLStatus";
    /**
     * private variables
     */
    private var _loader : URLLoader;
    private var _XMLData : XML;
    public var XMLLoadedPercentage : Number;
    /**
     * Function: XMLManager
     * Calls super method which invokes the Super Class   constructor
     */
    public function XMLManager()
    {
      super();
      _loader = new URLLoader();
    }
    /**
     * Function: loadXML
     * @param XMLPath The path of the XML to load.
     * Adding the Complete Event to URLLoader.
     */
    public function loadXML( XMLPath : String ) : void
    {
      _loader.load( new URLRequest( XMLPath ) );
      _loader.addEventListener( Event.COMPLETE , handleXMLLoaded, false, 0, true );
      _loader.addEventListener( ProgressEvent.PROGRESS, handleXMLProgress, false, 0, true);
    }
    /**
     * Function: handleXMLLoaded
     * _XMLData has been set here.
     * Removing the loader Listener.
     * Dispatching new Event "XMLComplete" after XML loading complete
     */
    private function handleXMLLoaded( event:Event ) : void
    {
      _XMLData = XML(event.target.data);
      _loader.removeEventListener( Event.COMPLETE, handleXMLLoaded, false );
      _loader.removeEventListener( Event.COMPLETE, handleXMLProgress, false );
      _loader = null;
      dispatchEvent( new Event( XMLLOADEDCOMPLETE ) );
    }
    /**
     * Function: data
     * Getter function to get data once loaded
     * Returns XML data
     */
    public function get data() : XML
    {
      return _XMLData;
    }
    /**
     * Function: handleXMLProgress
     */
    private function handleXMLProgress( event : ProgressEvent ) : void
    {
      XMLLoadedPercentage = ( event.bytesLoaded/event.bytesTotal )*100;
      dispatchEvent( new Event( XMLLOADSTATUS ) );
    }
  }
}</pre>
<p><span style="color: #000000;"><strong>Code in Timeline:</strong></span>
</p>
<p style="PADDING-LEFT: 30px">
<pre class="brush:as3">
// Import the XMLManager Class
import com.Manager.XMLManager;
// Creating instance for XMLManager Class
var _xmlmanager : XMLManager = new XMLManager();
// Adding event to handle XML status
_xmlmanager.addEventListener( XMLManager.XMLLOADSTATUS , handleXMLStatus, false, 0, true);
// Adding event to handle XML loaded complete event
_xmlmanager.addEventListener( XMLManager.XMLLOADEDCOMPLETE , handleXMLData, false, 0, true);
// Passing the URL of the XML to load
_xmlmanager.loadXML( "store.xml" );
function handleXMLStatus( event : Event )
{
  trace("XML Loaded percentage:::"+_xmlmanager.XMLLoadedPercentage);
}
// Getting the Loaded XML
function handleXMLData( event : Event )
{
  trace("XML Loaded:::"+_xmlmanager.data);
}
</pre>
<p><span style="color: #000000;"><strong>Code Explanation:</strong></span><br />
Before code explanation lets discuss some basic concepts.<br />
<strong>PACKAGE :</strong>
</p>
<p style="PADDING-LEFT: 30px">Allows you to organize your code into discrete groups that can be imported by other scripts. You must use the package keyword to indicate that a class is a member of a package.<br />
The above definition is from Flash help.<br />
Package is just like folder structure in hard disk.<br />
Here,<br />
package com.Manager<br />
specifies the Class resides inside com which resides inside Manager. Have a look at source.</p>
<p><strong>STATIC VARIABLE:</strong>
</p>
<p style="PADDING-LEFT: 30px">Static variable is also called as Class variable, since static variables can be accessed through class not through objects.<br />
Static variables cannot be override.<br />
Static variables and instance variable can have the same name in AS3, this is not the case in AS2.</p>
<p><strong>Explanation:</strong>
</p>
<p style="PADDING-LEFT: 30px">public static var XMLLOADEDCOMPLETE : String = &#8220;XMLComplete&#8221;;<br />
Holds the event type .</p>
<p style="PADDING-LEFT: 30px">In constructor function we are calling super(); method<br />
Which calls the super class EventDispatcher constructor and initializes the superclass which is extended by   the sub class XMLManager.</p>
<p style="PADDING-LEFT: 30px">In general, the easiest way for a user-defined class to gain event dispatching capabilities is to extend EventDispatcher.<br />
The public function loadXML gets the parameter for XML file to be loaded and dispatches Event.Complete Event when the XML loaded.<br />
Dispatches an event into the event flow.<br />
In the load complete event we are dispatching custom event, that €™s used to handle the data loaded.
</p>
<p style="PADDING-LEFT: 30px">To learn more about EventFlow or EventHandling in actionscript3.0 <a href="http://www.designscripting.com/2008/10/30/introduction-to-as3-part2" target="_blank">click here</a></p>
<p style="PADDING-LEFT: 30px">
<p>In timeline,<br />
We are importing the class XMLManager<br />
And adding the eventlistener for the custom event we are dispatching, in the handler for custom event we are calling the _xmlmanager.data which actually calls the get data method.</p>
<p>Find any trouble in using the utility, please add comments.</p>
<p><strong><a href="http://www.designscripting.com/wp-content/uploads/2008/11/xmlmanager.zip">Download Source files</a></strong></p>
<p>  -sara</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designscripting.com/2008/11/xmlmanager-in-actionscript-30/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dynamic Slideshow XML + Flash:</title>
		<link>http://www.designscripting.com/2008/11/dynamic-slideshow-xml-flash/</link>
		<comments>http://www.designscripting.com/2008/11/dynamic-slideshow-xml-flash/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 06:49:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[Sllideshow]]></category>

		<guid isPermaLink="false">http://www.designscripting.com/?p=30</guid>
		<description><![CDATA[This tutorial shows how to create dynamic slideshow by fetching the data from XML and the slideshow.
This tutorial covers reading XML using XPathAPI, Conditional operator, MovieClipLoader, setTimeout.
XpathAPI:
The native XPathAPI class allows us to search the XML nodes and attributes within XML that €™s loaded in to flash.
To know more about using XPathAPI click here
Conditional Operator:
Using conditional operator is similar to if else statement.
Example:

var test_boolean : Boolean = true
if(test_boolean)
trace("I am True");
else
trace("I am False");
//output:I am True

Same Logic using the conditional operator

var test_boolean : Boolean = true
test_boolean == true ? trace("I am True") ...]]></description>
			<content:encoded><![CDATA[<p>This tutorial shows how to create dynamic slideshow by fetching the data from XML and the slideshow.<br />
This tutorial covers reading XML using XPathAPI, Conditional operator, MovieClipLoader, setTimeout.<br />
<strong>XpathAPI:</strong><br />
The native XPathAPI class allows us to search the XML nodes and attributes within XML that €™s loaded in to flash.<br />
To know more about using XPathAPI click here</p>
<p><strong>Conditional Operator:</strong><br />
Using conditional operator is similar to if else statement.</p>
<p style="PADDING-LEFT: 30px"><strong>Example:</strong></p>
<p style="PADDING-LEFT: 30px">
<pre class="brush:as3">var test_boolean : Boolean = true
if(test_boolean)
trace("I am True");
else
trace("I am False");
//output:I am True</pre>
</p>
<p style="PADDING-LEFT: 30px">Same Logic using the conditional operator</p>
<p style="PADDING-LEFT: 30px">
<pre class="brush:as3">var test_boolean : Boolean = true
test_boolean == true ? trace("I am True") : trace("I am False");
//output:I am True</pre>
</p>
<p><strong>setTimeout:</strong><br />
setTimeOut() method is an undocumented feature of flash8. This method is very useful when we need to call a function after specified duration of time. But not more than once.<br />
<strong>Simple usage:</strong></p>
<p style="PADDING-LEFT: 30px">
<pre class="brush:as3">setTimeout(sayHello, 1000);
function sayHello() {
  trace("Hello, welcome here!");
}</pre>
</p>
<p style="PADDING-LEFT: 30px"><strong>Passing argument:</strong></p>
<p style="PADDING-LEFT: 30px">And incase we need to pass some argument then</p>
<p style="PADDING-LEFT: 30px">
<pre class="brush:as3">setTimeout(sayHello, 1000,"Hello, welcome here!");
function sayHello( arg:String ) {
  trace(arg);
}</pre>
</p>
<p style="PADDING-LEFT: 30px">
<p>Output SWF File</p>
<div>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="223" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.designscripting.com/wp-content/uploads/2008/11/Slideshow.swf" /><embed type="application/x-shockwave-flash" width="480" height="223" src="http://www.designscripting.com/wp-content/uploads/2008/11/Slideshow.swf"></embed></object></div>
<p><strong>Slideshow Code:</strong></p>
<p style="PADDING-LEFT: 30px"><strong></strong></p>
<pre class="brush:as3">
import mx.transitions.Tween;
import mx.transitions.easing.*;
import mx.xpath.XPathAPI;
var delay:Number;
var animationDuration:Number;
var current_num:Number = 0;
var first_num:Number = 0;
var image_holder:MovieClip = this.createEmptyMovieClip("image_holder", this.getNextHighestDepth());
var mcl_lis:Object = new Object();
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.addListener(mcl_lis);
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function( isLoaded:Boolean )
{
  if( isLoaded )
  {
    data_arr = XPathAPI.selectNodeList(this.firstChild,"Slideshow/images/image");
    delay = parseInt(XPathAPI.selectSingleNode(this.firstChild,"Slideshow/settings/delay").firstChild);
    animationDuration = parseInt(XPathAPI.selectSingleNode(this.firstChild,"Slideshow/settings/animationDuration").firstChild);
    //optional code to check delay and animationDuration values
    (delay == undefined || delay == null) ? delay = 5000: delay&lt;1000? delay =1000:true;
    (animationDuration == undefined || animationDuration == null) ? animationDuration = .8: animationDuration&lt;.3? animationDuration =.8:true;
    load_image();
  }else
  {
    trace("XML Load error");
  }
}
xml.load("XML/data.xml")

function load_image()
{
  mcl.loadClip(data_arr[current_num].attributes.url, image_holder);
  (current_num&gt;=data_arr.length-1) ? current_num = first_num:current_num++;
}

mcl_lis.onLoadInit = function(target_mc:MovieClip) {
  var obj:Tween = new Tween(target_mc, "_alpha", Normal.easeIn, 0, 100, .5, true);
    setTimeout(function(){
                var obj:Tween = new Tween(target_mc, "_alpha", Normal.easeIn, 100, 0, .5, true);
                  obj.onMotionFinished = function() {load_image();};
               },5000);
};</pre>
</p>
<p>In loadImage function we are loading the next image using MovieClip Loader and Checking the present number of image against the last.</p>
<pre class="brush:as3">
mcl.loadClip(data_arr[current_num].attributes.url, image_holder);
  (current_num&gt;=data_arr.length-1) ? current_num = first_num:current_num++;</pre>
<p>Here I am not going to explain the full code bcoz after the above description and XPath tutorial; it €™s very easy to understand.</p>
<p style="text-align: center;"><a href="http://www.designscripting.com/wp-content/uploads/2008/11/Slideshow.zip"><img src="http://www.designscripting.com/wp-content/uploads/2008/12/download.jpg" alt="" /></a></p>
<p style="text-align: left;"><a href="http://www.designscripting.com/2009/01/06/dynamic-slideshow-with-preloader/">Updated SlideShow</a></p>
<p>Cheers<br />
-sara</p>
]]></content:encoded>
			<wfw:commentRss>http://www.designscripting.com/2008/11/dynamic-slideshow-xml-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>XPathAPI &#8211; Actionscript 2.0</title>
		<link>http://www.designscripting.com/2008/11/xpathapi-actionscript-20/</link>
		<comments>http://www.designscripting.com/2008/11/xpathapi-actionscript-20/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 09:01:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 2.0]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[loading xml]]></category>
		<category><![CDATA[query XML]]></category>
		<category><![CDATA[XML and actionscript]]></category>
		<category><![CDATA[XPathAPI]]></category>

		<guid isPermaLink="false">http://www.designscripting.com/?p=25</guid>
		<description><![CDATA[XPath API:
XML used to make our flash applications more dynamic.
The native XPathAPI class allows us to search the XML nodes and attributes within XML that €™s loaded in to flash.
Simple XML Structure:
  
Loading XML:

The basic actionscript code for loading XML in actionscript 2.0

var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function( isLoaded:Boolean )
{
  if(isLoaded)
  {
    // here this refers to the xml object. Instead of this we can also use xml there.
    trace( this );
//trace( xml );
  }else
  {
 ...]]></description>
			<content:encoded><![CDATA[<p>XPath API:<br />
XML used to make our flash applications more dynamic.<br />
The native XPathAPI class allows us to search the XML nodes and attributes within XML that €™s loaded in to flash.<br />
Simple XML Structure:<br />
  <img src="http://www.designscripting.com/wp-content/uploads/2008/11/xmlstructure.jpg" alt="" /><br />
Loading XML:</p>
<p style="PADDING-LEFT: 30px">
The basic actionscript code for loading XML in actionscript 2.0</p>
<pre class="brush:as3">
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function( isLoaded:Boolean )
{
  if(isLoaded)
  {
    // here this refers to the xml object. Instead of this we can also use xml there.
    trace( this );
//trace( xml );
  }else
  {
    trace("XML loading error");
  }
}
xml.load( "XML/store.xml" );</pre>
<p>Output:<br />
Entire xml content.</p>
<p>Explanation:</p>
<p style="PADDING-LEFT: 30px">
var xml:XML = new XML();<br />
Declaring the xml object that holds the externally loaded XML data.<br />
xml.ignoreWhite = true;<br />
Ignoring the unwanted whitespaces in loaded XML.<br />
xml.onLoad = function(){}<br />
onLoad function triggered once the xml is loaded using xml.load method is called. onLoad function also checks whether the load is success or not.</p>
<p>Importing XPath API:</p>
<p style="PADDING-LEFT: 30px">
First step before using Xpath Api is to import the XPathAPI class. This will make us to use the methods of the XPathAPI in our code.<br />
Import mx.xpath.XPathAPI;<br />
Or<br />
mx.xpath.XPathAPI.[methodName]</p>
<p>XPath API methods:</p>
<p style="PADDING-LEFT: 30px">
selectNodeList()<br />
selectSingleNode()<br />
XPathAPI.getEvalString()<br />
XPathAPI.setNodeValue()</p>
<p><span style="color: #ffffff;">getEvalString:</span></p>
<p style="PADDING-LEFT: 30px">
A string that represents the code required to access the value specified by the path parameter from the parent node.</p>
<pre class="brush:as3">import mx.xpath.XPathAPI;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function( isLoaded:Boolean )
{
  if(isLoaded)
  {
    //trace( this );
    //  or
    //trace( xml )
    var myEvalString_str:String = XPathAPI.getEvalString(this.firstChild,"store/item/name");
    trace("getEvalString: " + myEvalString_str);
  //output
    //getEvalString: this.firstChild.childNodes.0.childNodes.0.firstChild.nodeValue
    //we can use this to locate the value, for example
    //add this.firstChild infront bcoz we give this as the first argument for getEvalString.
    //replace childNodes.0 with childNodes[0]
    trace(this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue)
  //Outputs Pencil
  }else
  {
    trace("XML loading error");
  }
}
xml.load( "XML/store.xml" );</pre>
<p>Explanation:</p>
<p style="PADDING-LEFT: 30px">
Outputs:<br />
  getEvalString: this.firstChild.childNodes.0.childNodes.0.firstChild.nodeValue<br />
  this method is useful   to locate the value, for example<br />
  add this.firstChild infront bcoz we give this as the first argument for getEvalString.<br />
replace childNodes.0 with childNodes[0], this forms this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue<br />
now trace the value and see<br />
  trace(this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue)</p>
<p><span style="color: #ffffff;">selectNodeList:</span></p>
<p style="PADDING-LEFT: 30px">
Method returns an array of nodes matching the given XPathAPI statement.<br />
import mx.xpath.XPathAPI;</p>
<p style="PADDING-LEFT: 30px">
<pre class="brush:as3">var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function( isLoaded:Boolean )
{
  if(isLoaded)
  {
    //trace( this );
    //  or
    //trace( xml )
    var nodeList_arr : Array = XPathAPI.selectNodeList(this.firstChild,"store/item/name");
    trace("selectNodeList: " + nodeList_arr);
    //output
    //selectNodeList: &lt;name&gt;Pencil&lt;/name&gt;,&lt;name&gt;Eraser&lt;/name&gt;,&lt;name&gt;NoteBook&lt;/name&gt;
    //nodeList_arr contains collection of XMLNodes with nodeName as name
    //to get the values from XMLNodes use looping statements
    for(i=0;i&lt;nodeList_arr.length;i++)trace("Value :"+nodeList_arr[i].firstChild.nodeValue);
  }else
  {
    trace("XML loading error");
  }
}
xml.load( "XML/store.xml" );</pre>
</p>
<p style="PADDING-LEFT: 30px">//output<br />
//selectNodeList: &lt;name&gt;Pencil&lt;/name&gt;,&lt;name&gt;Eraser&lt;/name&gt;,&lt;name&gt;NoteBook&lt;/name&gt;<br />
//Value : Pencil<br />
//Value : Eraser<br />
//Value : NoteBook</p>
<p>Explanation:</p>
<p style="PADDING-LEFT: 30px">
store/item/name   defines the path of node name (name)<br />
we cal also use<br />
*/*/name<br />
This retrives the XMLNodes with nodeName  €“name, selectNodeList returns array.<br />
To get the nodeValues we need to use looping statements to loop through the array.</p>
<p><span style="color: #ffffff;">SelectSingleNode:</span></p>
<p style="PADDING-LEFT: 30px">
This XPathAPI method retives the XMLNode which matches the query we can also use AND, OR statements while using the query.</p>
<pre class="brush:as3">
import mx.xpath.XPathAPI;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function( isLoaded:Boolean )
{
  if(isLoaded)
  {
    //trace( this );
    //  or
    //trace( xml )
    var xmlNode:Array = XPathAPI.selectNodeList(this.firstChild,"store/item[@id='1']");
    trace("selectSingleNode: " + xmlNode);
    //output
    //selectSingleNode: &lt;item id="1"&gt;&lt;name&gt;Pencil&lt;/name&gt;&lt;price&gt;10&lt;/price&gt;&lt;code&gt;1120&lt;/code&gt;&lt;/item&gt;
    //Here the query retives the node which has the attribute id ='1'
  }else
  {
    trace("XML loading error");
  }
}
xml.load( "XML/store.xml" );</pre>
<p><a href="http://download.macromedia.com/pub/documentation/en/flash/fl8/XpathAPI.pdf" target="_blank">Download Macromedia XPathAPI documentation</a></p>
<p><a href="http://sarashar.googlepages.com/XPath.zip" target="_blank">Download source files</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.designscripting.com/2008/11/xpathapi-actionscript-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
