flash on 2012-6-27
/**
* Copyright whirlpower ( http://wonderfl.net/user/whirlpower )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/5pEr
*/
package
{
import flash.display.Sprite;
public class Main extends Sprite
{
public function Main()
{
Tracer.init( this );
var xml:XML = XML(
'<data>\n' +
'<node huga="moga_001"/>\n' +
'<node huga="hoge_001"/>\n' +
'<node huga="hoge_002"/>\n' +
'<node huga="unk_001"/>\n' +
'</data>'
);
Tracer.add( xml );
var xmlList:XMLList = xml.node.(@huga.indexOf("hoge_") == 0)
Tracer.add( xmlList );
}
}
}
// trace template -------------------------------------
import flash.display.*;
import flash.text.*;
internal class Tracer
{
private static var text : String = "";
private static var viewText : TextField = new TextField();
public static function init( _container:DisplayObjectContainer ):void
{
viewText.defaultTextFormat = new TextFormat( "MS UI Gothic", 12, 0xDDDDDD );
viewText.width = 465-10;
viewText.height = 465-10;
viewText.selectable = false;
viewText.text = "view trace";
viewText.x = 5;
viewText.y = 5;
viewText.mouseWheelEnabled = true;
var s:Shape = new Shape();
s.graphics.clear();
s.graphics.beginFill( 0x000000, 0.5 );
s.graphics.drawRect(0, 0, 456, 456 );
s.graphics.endFill();
var c:Sprite = new Sprite();
c.mouseChildren = false;
c.mouseEnabled = false;
c.addChild( s );
c.addChild( viewText );
_container.addChild( c );
}
public static function add( t:String = "tracer" ):void
{
text += t + "\n";
viewText.text = text;
viewText.scrollV += 1;
}
}