修改由闪光产生XML? [英] modify xml generated by flash?

查看:114
本文介绍了修改由闪光产生XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的闪光和动作。

I am new to flash and actionscript.

我想修改flash的xml文件一旦生成的。

I want to modify the xml file of flash once it generated.

您可以看到本教程 http://www.webwasp.co.uk/tutorials /A_IntAct-02-drag-drop/index.php 这里的时候,我改变位置,我想和更新新的XML文件。

You can see this tutorial http://www.webwasp.co.uk/tutorials/A_IntAct-02-drag-drop/index.php here when i change the position i want new xml file with update.

任何帮助是极大Appriciated。 谢谢你,

Any Help is greatly Appriciated. Thanks,

推荐答案

由于没有大多究竟你的要求,我创建了一个例子具有可拖放一个正方形的想法。当其下降其写入XML来与x和y坐标的丢弃正方形的xml文件:

Not having mostly any idea what exactly your asking for, I created an example with a square that can be dragged and dropped. When its dropped it writes xml to an xml file with the x and y co-ordinates of the dropped square:

package 
{
    import flash.display.*;
    import flash.events.*;
    import flash.filesystem.*;
    import flash.utils.*;

    public class Main extends Sprite 
    {
        private var _square:Square;

        public function Main():void 
        {
            _square = new Square();
            _square.addEventListener(MouseEvent.MOUSE_DOWN, onSquareMouseDown);
            addChild(_square);

        }// end function

        private function onSquareMouseDown(e:Event):void
        {
            _square.startDrag();

            stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUp);

        }// end function

        private function onStageMouseUp(e:Event):void
        {
            stage.removeEventListener(MouseEvent.MOUSE_UP, onStageMouseUp);
            _square.stopDrag();

            var xml:XML = <dragAndDrop>
                              <x>{_square.x}</x>
                              <y>{_square.y}</y>
                          </dragAndDrop>;

            var file:File = File.desktopDirectory.resolvePath("xml/dragAndDrop.xml");
            var fileStream:FileStream = new FileStream();
            fileStream.open(file, FileMode.WRITE);
            fileStream.writeMultiByte(String(xml), "iso-8859-01");
            fileStream.close();

        }// end function

    }// end class

}// end package

import flash.display.Sprite;

internal class Square extends Sprite
{
    public function Square()
    {
        graphics.beginFill(0xFF0000);
        graphics.drawRect(0, 0, 100, 100);
        graphics.endFill();

    }// end function

}// end class

这篇关于修改由闪光产生XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆