I am new to actionscript. Can anyone help me to try getting the values from the XML in the following timed text format :
<?xml version="1.0" encoding="UTF-8"?>
<tt xml:lang="en"
xmlns:tts="http://www.w3.org/2006/10/ttaf1#styling"
xmlns:ttm="http://www.w3.org/2006/10/ttaf1#metadata"
xmlns:smpte="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt"
xmlns:m608="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt#cea608">
<head>
<ttm:title>SCCconvert </ttm:title>
<ttm:desc>converted document; </ttm:desc>
<ttm:copyright>Copyright (C) Computer Prompting and Captioning Co.</ttm:copyright>
<styling>
<style xml:id='basic' tts:color='white' tts:fontFamily='proportionalSansSerif'
tts:lineHeight='8%'
tts:fontSize='8%'
tts:fontWeight='bold'
tts:textOutline='black 8% 8%' />
</styling>
<layout>
<region xml:id='pop1' tts:backgroundColor='transparent'></region>
<region xml:id='pop2' tts:backgroundColor='blue'></region>
</layout>
</head>
<body>
<div>
<p region='pop1' style='basic' xml:space='preserve' begin='00:00:02:05' end='00:00:06:16' tts:origin='47% 10%'>
<span>♫</span>
</p>
<p region='pop1' style='basic' xml:space='preserve' begin='00:00:06:16' end='00:00:08:05' tts:origin='27% 84%'>
<span>I can't do this!</span>
</p>
<p region='pop2' style='basic' xml:space='preserve' begin='00:00:08:05' end='00:00:09:17' tts:origin='10% 78%'>
<span>You fail because</span>
</p>
</div>
</body>
</tt>
I can read the XML values if it is in normal form. But I need to display the values in the styles mentioned in the <layout> section
It’s because your attributes are prefixed by a namespace so you have to create a new namespace for ttm, tts etc… and then use it to access the attribute.
Example for accessing all backgroundColor inside layout.region node:
Live example on wonderfl : http://wonderfl.net/c/ptNa
Article for using xml namespace on Adobe channel:
http://cookbooks.adobe.com/post_Accessing_XML_attributes_and_nodes_with_different-16316.html