flash on 2011-2-25

by pleclech
♥0 | Line 32 | Modified 2011-03-24 22:55:16 | MIT License
play

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/fHph
 */

package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
             if (stage) _init()
            else addEventListener(Event.ADDED_TO_STAGE, _init)
        }
        import flash.text.TextField;
        import flash.events.Event;

        private var tf:TextField=new TextField()
        private function trace(...args):void{
            tf.appendText(args.join(", ")+"\n")
        }
        private function _init(e:Event=null):void {
            removeEventListener(Event.ADDED_TO_STAGE, _init)
            addChild(tf)
            tf.autoSize="left"
            tf.background=true
            start()
       }
       private function start():void {
           var xml1:XML=<Array2><DBL><Val>0.302770</Val></DBL><DBL><Val>0.302770</Val></DBL></Array2>
           trace("before delete ---------:\n"+xml1.toXMLString())
           xml1..Val.(delete parent().children()[valueOf().childIndex()])
           trace("\nafter delete ----------:\n"+xml1.toXMLString())

           xml1=<Array2><DBL><Val>0.302770</Val></DBL><DBL><Val>0.302770</Val></DBL></Array2>
           trace("\nbefore update ---------:\n"+xml1.toXMLString())
           xml1..Val.(parent().replace(valueOf().childIndex(), valueOf().text()))
           trace("\nafter update ----------:\n"+xml1.toXMLString())

       }
    }
}

Forked