快讯:如何阅读从形状/图形对象数据 [英] Flash : How to read data from shape/graphics object

查看:169
本文介绍了快讯:如何阅读从形状/图形对象数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想知道是否有可能获得存储在形状中的数据/图形对象?

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 draw a shape and then read all the points in that shape into my script. The reason for that is that I need go generate lines from those points that I later can use to check if my characters velocity intersects with any of them.

问候,

推荐答案

您可以阅读形状的所有部分。

新功能添加到Flash Player 11.6和AIR 3.6:

New feature added to Flash Player 11.6 and AIR 3.6:

flash.display.Grapics.readGraphicsData()

<一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html#readGraphicsData%28%29" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html#readGraphicsData%28%29

例如:

var s :Shape = new Shape();
s.graphics.lineStyle(2, 0xFF0000);
s.graphics.drawCircle(0, 0, 50)

var gd:Vector.<IGraphicsData> = s.graphics.readGraphicsData(false);

var copy_of_s :Shape = new Shape();
copy_of_s.graphics.drawGraphicsData(gd);

addChild(copy_of_s);


要使用新版本,你需要更新的playerglobal.swc


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

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

这篇关于快讯:如何阅读从形状/图形对象数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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