How to read data from shape/graphics object

后端 未结 4 512
傲寒
傲寒 2020-12-12 04:16

I am wondering if it is possible to get the data that is stored in a shape/graphics object in flash using actionscript 3?

In my project I would like to be able to dr

4条回答
  •  清歌不尽
    2020-12-12 05:10

    You can read all parts of Shape.

    New feature added to Flash Player 11.6 and AIR 3.6:

    flash.display.Grapics.readGraphicsData()

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html#readGraphicsData%28%29

    Example:

    var s :Shape = new Shape();
    s.graphics.lineStyle(2, 0xFF0000);
    s.graphics.drawCircle(0, 0, 50)
    
    var gd:Vector. = s.graphics.readGraphicsData(false);
    
    var copy_of_s :Shape = new Shape();
    copy_of_s.graphics.drawGraphicsData(gd);
    
    addChild(copy_of_s);
    

    To use the new version, you have to update playerglobal.swc

    http://www.adobe.com/support/flashplayer/downloads.html

提交回复
热议问题