SO xml namespace attributes access
forked from SO xml namespace access (diff: 49)
ActionScript3 source code
/**
* Copyright pleclech ( http://wonderfl.net/user/pleclech )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/ptNa
*/
// forked from pleclech's SO xml namespace access
package {
import flash.utils.ByteArray;
import flash.utils.getQualifiedSuperclassName;
import flash.utils.getQualifiedClassName;
import flash.utils.describeType;
import flash.utils.Dictionary;
import flash.events.Event;
import flash.utils.setTimeout;
import com.bit101.components.TextArea;
public class FlashTest extends TextArea {
public namespace foo;
foo var bar:String='baz';
public function FlashTest() {
width=400
height=400
setTimeout(doTest, 500)
}
public function doTest():void {
try {
var x:XML =
<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>
<item>
<user>toto</user>
</item>
</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>;
var tts:Namespace=new Namespace("http://www.w3.org/2006/10/ttaf1#styling");
trace('background color : ', x..layout.region.@tts::backgroundColor.toXMLString());
trace('background color : ', x..item);
} catch (e:*) {
trace(e);
}
}
public function trace(...args):void {
text=text+args.join(", ")+"\n"
}
}
}
