ActionScript 从矢量图形中绘制代码?

发布于 2024-11-17 01:34:59 字数 6641 浏览 2 评论 0 原文

有没有一种通用方法可以将 Flash Professional 中绘制的矢量图形转换为绘图 API 代码?

这些绘制或导入的矢量图形资源的代码以 XML 数据形式存在于源文件 (.xfl) 中。例如,以下绘制的矢量图形是尾随 XML 数据。

在此处输入图像描述

<DOMSymbolItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ns.adobe.com/xfl/2008/" name="MSprite" itemID="4e03ae4f-00002c0f" linkageExportForAS="true" linkageBaseClass="flash.display.Sprite" linkageClassName="MSprite" sourceLibraryItemHRef="Symbol 1" lastModified="1308864079" isSpriteSubclass="true">
  <timeline>
    <DOMTimeline name="MSprite">
      <layers>
        <DOMLayer name="Layer 1" color="#4FFF4F" current="true" isSelected="true">
          <frames>
            <DOMFrame index="0" keyMode="9728">
              <elements>
                <DOMShape>
                  <fills>
                    <FillStyle index="1">
                      <SolidColor color="#00CCFF"/>
                    </FillStyle>
                  </fills>
                  <strokes>
                    <StrokeStyle index="1">
                      <SolidStroke scaleMode="normal">
                        <fill>
                          <SolidColor/>
                        </fill>
                      </SolidStroke>
                    </StrokeStyle>
                  </strokes>
                  <edges>
                    <Edge fillStyle0="1" strokeStyle="1" edges="!6883 745S5[6369 340 5741 148!5741 148[5534 85 5314 78!5314 78[4037 36 2754 2!2754 2[1956 -18 1222 211!1222 211[693 376 393 745!393 745[139 1056 48 1512!48 1512[-130 2404 354 3085!354 3085[799 3713 1505 3927!1505 3927[1675 3979 1817 3876
!1817 3876[1970 3765 2071 3564!2071 3564|1474 3205!1474 3205[1230 2199 2029 1548!2029 1548[2144 1454 2274 1365!2274 1365|2834 1365!2834 1365|3194 1585!3194 1585|3254 1705!3254 1705|3434 2245!3434 2245|3514 2305!3514 2305[3652 1520 4512
 1353!4512 1353[5351 1190 5981 1839!5981 1839[6054 1915 6115 1995!6115 1995[6394 2358 6314 2845!6314 2845[6188 3617 6664 4084!6664 4084[6710 4129 6761 4171!6761 4171[6898 4282 7071 4308!7071 4308[7421 4359 7733 4184!7733 4184[7760 4134
 7785 4084!7785 4084[8238 3170 7920 2182!7920 2182[7733 1598 7325 1156!7325 1156[7115 929 6883 745"/>
                    <Edge cubics="!5741 148(;5603,106 5461,83 5314,78q5741 148Q5534 85q5314 78);"/>
                    <Edge cubics="!5981 1839(;6030,1890 6074,1942 6115,1995q5981 1839Q6054 1915q6115 1995);"/>
                    <Edge cubics="!6115 1995(;6301,2237 6367,2520 6314,2845q6115 1995Q6394 2358q6314 2845);"/>
                    <Edge cubics="!6761 4171(;6852,4245 6956,4291 7071,4308q6761 4171Q6898 4282q7071 4308);"/>
                    <Edge cubics="!6314 2845(;6230,3363 6348,3778 6664,4084q6314 2845Q6188 3617q6664 4084);"/>
                    <Edge cubics="!6664 4084(;6699,4118 6729,4145 6761,4171q6664 4084 6761 4171);"/>
                    <Edge cubics="!7733 4184(;7751,4152 7768,4119 7785,4084q7733 4184 7785 4084);"/>
                    <Edge cubics="!7785 4084(;8086,3476 8132,2842 7920,2182q7785 4084Q8238 3170q7920 2182);"/>
                    <Edge cubics="!4512 1353(;5071,1244 5561,1406 5981,1839q4512 1353Q5351 1190q5981 1839);"/>
                    <Edge cubics="!7071 4308(;7304,4342 7525,4301 7733,4184q7071 4308Q7421 4359q7733 4184);"/>
                    <Edge cubics="!7920 2182(;7795,1793 7597,1451 7325,1156q7920 2182Q7733 1598q7325 1156);"/>
                    <Edge cubics="!7325 1156(;7188,1007 7043,872 6883,745q7325 1156Q7115 929q6883 745);"/>
                    <Edge cubics="!6883 745(;6546,478 6163,277 5741,148q6883 745Q6369 340q5741 148);"/>
                    <Edge cubics="!2029 1548(;2106,1485 2187,1424 2274,1365q2029 1548Q2144 1454q2274 1365);"/>
                    <Edge cubics="!2834 1365(;2834,1365 3194,1585 3194,1585q2834 1365 3194 1585);"/>
                    <Edge cubics="!2274 1365(;2274,1365 2834,1365 2834,1365q2274 1365 2834 1365);"/>
                    <Edge cubics="!2754 2(;2222,-11 1711,58 1222,211q2754 2Q1956 -18q1222 211);"/>
                    <Edge cubics="!3254 1705(;3254,1705 3434,2245 3434,2245q3254 1705 3434 2245);"/>
                    <Edge cubics="!3434 2245(;3434,2245 3514,2305 3514,2305q3434 2245 3514 2305);"/>
                    <Edge cubics="!1505 3927(;1618,3962 1722,3945 1817,3876q1505 3927Q1675 3979q1817 3876);"/>
                    <Edge cubics="!1222 211(;870,321 594,498 393,745q1222 211Q693 376q393 745);"/>
                    <Edge cubics="!393 745(;224,951 109,1207 48,1512q393 745Q139 1056q48 1512);"/>
                    <Edge cubics="!1474 3205(;1311,2534 1496,1982 2029,1548q1474 3205Q1230 2199q2029 1548);"/>
                    <Edge cubics="!3194 1585(;3194,1585 3254,1705 3254,1705q3194 1585 3254 1705);"/>
                    <Edge cubics="!48 1512(;-71,2107 31,2631 354,3085q48 1512Q-130 2404q354 3085);"/>
                    <Edge cubics="!354 3085(;651,3504 1034,3784 1505,3927q354 3085Q799 3713q1505 3927);"/>
                    <Edge cubics="!3514 2305(;3606,1782 3939,1464 4512,1353q3514 2305Q3652 1520q4512 1353);"/>
                    <Edge cubics="!5314 78(;4463,50 3609,25 2754,2q5314 78Q4037 36q2754 2);"/>
                    <Edge cubics="!2071 3564(;2071,3564 1474,3205 1474,3205q2071 3564 1474 3205);"/>
                    <Edge cubics="!1817 3876(;1919,3802 2004,3698 2071,3564q1817 3876Q1970 3765q2071 3564);"/>
                  </edges>
                </DOMShape>
              </elements>
            </DOMFrame>
          </frames>
        </DOMLayer>
      </layers>
    </DOMTimeline>
  </timeline>
</DOMSymbolItem>

这证明肯定可以创建一个可以将 XML 代码移植到 AS3 的实用程序。这样,AS3 开发人员就不必担心处理矢量资源,特别是当他们从 Flash Professional 迁移到 Flash Builder 时。

就我个人而言,如果还没有可用的实用程序,我最终有兴趣为此创建一个实用程序,但我想知道是否已经有可用的实用程序?


[编辑]

自从我发布这个问题以来,我了解了 SVG Web 项目,其中包含 ActionScript 3.0 的一个分支,用于读取 SVG 数据并将其添加到显示列表中。该库允许开发人员创建 SVG 图形并将源代码嵌入为 XML 文本。虽然这仍然无法使用 Drawing API 简单地编辑图形,但编辑 SVG XML 并不困难,并且可以避免在 Flash Builder 中使用图形的 .swf 资源。这个库并不完美,我花了很短的时间使用它,我发现它似乎无法渲染超过 2 种颜色的径向渐变,并且它不允许缩放(看起来你只能更改宽度和高度属性,这既奇怪又非常不幸),但至少现在我可以包含图形代码而不是使用资源。

来源:com.zavoo.labs - 新的 Flex 和 Flash SVGWeb 组件

is there a common way to convert a drawn vector graphic in Flash Professional to code for the Drawing API?

the code of these drawn or imported vector graphic assets are available in the source files (.xfl) as XML data. for example, the following drawn vector graphic is the trailing XML data.

enter image description here

<DOMSymbolItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ns.adobe.com/xfl/2008/" name="MSprite" itemID="4e03ae4f-00002c0f" linkageExportForAS="true" linkageBaseClass="flash.display.Sprite" linkageClassName="MSprite" sourceLibraryItemHRef="Symbol 1" lastModified="1308864079" isSpriteSubclass="true">
  <timeline>
    <DOMTimeline name="MSprite">
      <layers>
        <DOMLayer name="Layer 1" color="#4FFF4F" current="true" isSelected="true">
          <frames>
            <DOMFrame index="0" keyMode="9728">
              <elements>
                <DOMShape>
                  <fills>
                    <FillStyle index="1">
                      <SolidColor color="#00CCFF"/>
                    </FillStyle>
                  </fills>
                  <strokes>
                    <StrokeStyle index="1">
                      <SolidStroke scaleMode="normal">
                        <fill>
                          <SolidColor/>
                        </fill>
                      </SolidStroke>
                    </StrokeStyle>
                  </strokes>
                  <edges>
                    <Edge fillStyle0="1" strokeStyle="1" edges="!6883 745S5[6369 340 5741 148!5741 148[5534 85 5314 78!5314 78[4037 36 2754 2!2754 2[1956 -18 1222 211!1222 211[693 376 393 745!393 745[139 1056 48 1512!48 1512[-130 2404 354 3085!354 3085[799 3713 1505 3927!1505 3927[1675 3979 1817 3876
!1817 3876[1970 3765 2071 3564!2071 3564|1474 3205!1474 3205[1230 2199 2029 1548!2029 1548[2144 1454 2274 1365!2274 1365|2834 1365!2834 1365|3194 1585!3194 1585|3254 1705!3254 1705|3434 2245!3434 2245|3514 2305!3514 2305[3652 1520 4512
 1353!4512 1353[5351 1190 5981 1839!5981 1839[6054 1915 6115 1995!6115 1995[6394 2358 6314 2845!6314 2845[6188 3617 6664 4084!6664 4084[6710 4129 6761 4171!6761 4171[6898 4282 7071 4308!7071 4308[7421 4359 7733 4184!7733 4184[7760 4134
 7785 4084!7785 4084[8238 3170 7920 2182!7920 2182[7733 1598 7325 1156!7325 1156[7115 929 6883 745"/>
                    <Edge cubics="!5741 148(;5603,106 5461,83 5314,78q5741 148Q5534 85q5314 78);"/>
                    <Edge cubics="!5981 1839(;6030,1890 6074,1942 6115,1995q5981 1839Q6054 1915q6115 1995);"/>
                    <Edge cubics="!6115 1995(;6301,2237 6367,2520 6314,2845q6115 1995Q6394 2358q6314 2845);"/>
                    <Edge cubics="!6761 4171(;6852,4245 6956,4291 7071,4308q6761 4171Q6898 4282q7071 4308);"/>
                    <Edge cubics="!6314 2845(;6230,3363 6348,3778 6664,4084q6314 2845Q6188 3617q6664 4084);"/>
                    <Edge cubics="!6664 4084(;6699,4118 6729,4145 6761,4171q6664 4084 6761 4171);"/>
                    <Edge cubics="!7733 4184(;7751,4152 7768,4119 7785,4084q7733 4184 7785 4084);"/>
                    <Edge cubics="!7785 4084(;8086,3476 8132,2842 7920,2182q7785 4084Q8238 3170q7920 2182);"/>
                    <Edge cubics="!4512 1353(;5071,1244 5561,1406 5981,1839q4512 1353Q5351 1190q5981 1839);"/>
                    <Edge cubics="!7071 4308(;7304,4342 7525,4301 7733,4184q7071 4308Q7421 4359q7733 4184);"/>
                    <Edge cubics="!7920 2182(;7795,1793 7597,1451 7325,1156q7920 2182Q7733 1598q7325 1156);"/>
                    <Edge cubics="!7325 1156(;7188,1007 7043,872 6883,745q7325 1156Q7115 929q6883 745);"/>
                    <Edge cubics="!6883 745(;6546,478 6163,277 5741,148q6883 745Q6369 340q5741 148);"/>
                    <Edge cubics="!2029 1548(;2106,1485 2187,1424 2274,1365q2029 1548Q2144 1454q2274 1365);"/>
                    <Edge cubics="!2834 1365(;2834,1365 3194,1585 3194,1585q2834 1365 3194 1585);"/>
                    <Edge cubics="!2274 1365(;2274,1365 2834,1365 2834,1365q2274 1365 2834 1365);"/>
                    <Edge cubics="!2754 2(;2222,-11 1711,58 1222,211q2754 2Q1956 -18q1222 211);"/>
                    <Edge cubics="!3254 1705(;3254,1705 3434,2245 3434,2245q3254 1705 3434 2245);"/>
                    <Edge cubics="!3434 2245(;3434,2245 3514,2305 3514,2305q3434 2245 3514 2305);"/>
                    <Edge cubics="!1505 3927(;1618,3962 1722,3945 1817,3876q1505 3927Q1675 3979q1817 3876);"/>
                    <Edge cubics="!1222 211(;870,321 594,498 393,745q1222 211Q693 376q393 745);"/>
                    <Edge cubics="!393 745(;224,951 109,1207 48,1512q393 745Q139 1056q48 1512);"/>
                    <Edge cubics="!1474 3205(;1311,2534 1496,1982 2029,1548q1474 3205Q1230 2199q2029 1548);"/>
                    <Edge cubics="!3194 1585(;3194,1585 3254,1705 3254,1705q3194 1585 3254 1705);"/>
                    <Edge cubics="!48 1512(;-71,2107 31,2631 354,3085q48 1512Q-130 2404q354 3085);"/>
                    <Edge cubics="!354 3085(;651,3504 1034,3784 1505,3927q354 3085Q799 3713q1505 3927);"/>
                    <Edge cubics="!3514 2305(;3606,1782 3939,1464 4512,1353q3514 2305Q3652 1520q4512 1353);"/>
                    <Edge cubics="!5314 78(;4463,50 3609,25 2754,2q5314 78Q4037 36q2754 2);"/>
                    <Edge cubics="!2071 3564(;2071,3564 1474,3205 1474,3205q2071 3564 1474 3205);"/>
                    <Edge cubics="!1817 3876(;1919,3802 2004,3698 2071,3564q1817 3876Q1970 3765q2071 3564);"/>
                  </edges>
                </DOMShape>
              </elements>
            </DOMFrame>
          </frames>
        </DOMLayer>
      </layers>
    </DOMTimeline>
  </timeline>
</DOMSymbolItem>

this proves that it would be certainly possible to create a utility that could port the XML code to AS3. in doing so, AS3 developers wouldn't have to worry about handling vector assets, especially if they migrate away from Flash Professional to Flash Builder.

personally, i'm interested in creating a utility for this eventually if there is not one available already, but i'd like to know if there is one already available?


[EDIT]

since i've posted this question i've learned of the SVG Web Project, which contains a branch for ActionScript 3.0 for reading SVG data and adding it to the display list. the library allows developers to create SVG graphics and embed the source code as an XML literal. while this still doesn't open up the possibility of simply editing graphics using the Drawing API, it's not so difficult to edit the SVG XML and it makes it possible to avoid using .swf assets for graphics in Flash Builder. the library isn't perfect, my brief time spent with it i've leared that it doesn't seem to render radial gradients with more than 2 colors, and it doesn't allow scaling (it appears you can only change the width and height properties, which is both strange and very unfortunate), but at least now i can include the code for the graphics instead of using assets.

source: com.zavoo.labs - New Flex and Flash SVGWeb Components

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

十级心震 2024-11-24 01:34:59

就我个人而言,目前我更喜欢 .swc 方法,因为您最终会得到一个压缩的二进制文件,因此您会获得较小的文件大小,并且只有稍后在 ActionScript 中需要的资源可用。

如果组/绘图对象/图形符号有名称/ID,那就太好了,但目前还没有。这意味着走 xml 路线,您将加载一个大文件并遍历它以获取您需要的部分(除非您导出单独的 xml 文件)。

XFL 将是整个文档。我建议文件>导出图像> FXG 因为您可以导出单个资产。我已经有一个 as3 FXGParser 之前使用过非常好。

目前,可能是 FXG、SWC 或 SWF(使用@Claus Wahlers 提供的精彩 AS3SWF 库)是从 as3 访问设计师资源的好方法。

据我了解,在 Flash Builder 项目中使用 XFL 作为资源将节省将资源从 Flash Professional/Authoring 编译/导出为其他格式的额外步骤。设计器 XFL(也可以进行适当的版本控制)可以直接使用,而不是使用中间工作流程步骤和格式,这很有趣。我唯一关心的是处理大/混乱且难以管理的 xfl 文件(是的,设计师通常对它们的资产感到“混乱”)。

不幸的是,XFL 并不完全是 FXG,而且还没有可用的 XFL 规范(不过有一个针对 FXG 的规范)。
查看 XFL 规范 上的这些答案以及<一href="https://stackoverflow.com/questions/4077200/whats-the-meaning-of-the-non-numeric-values-in-the-xfls-edge-definition">XFL 边缘定义。
要么有人需要亲自动手对 XFL 格式进行逆向工程/记录,要么等待 Adob​​e 来做。后者基本上意味着淹没功能请求表单论坛,联系 传播者活动直到他们这样做。据我所知,如果很多人发现这很有用,我想 Adob​​e 会愿意在这方面投入时间。

简而言之,拥有一个像样的库来解析/搜索/从 XFL 文件中获取资源可能会非常方便,并且从长远来看,能够从其他工具导入/导出 XFL 将是有益的。

Personally, for now, I prefer the .swc approach because you get a smaller filesize since you end up with a compressed binary file, and only the assets that are needed later in actionscript are available.

It would be great if groups/drawing objects/Graphic symbols would have name/ids, but they don't currently. This means going the xml route you would load a large file and traverse it to fetch the part you need (unless you export separate xml files).

XFL would be the whole document. I would suggest File > Export Image > FXG since you can export individual assets. There is an as3 FXGParser already which I've used before and it's pretty good.

For now, probably FXG, SWC or SWF (using the wonderful AS3SWF library by @Claus Wahlers ) would be decent ways to access designer assets from as3.

As far as I understand using XFL as assets in Flash Builder project will save the extra step of compiling/exporting assets from Flash Professional/Authoring to other formats. The designer XFL (which could be also properly versioned) could be used directly as opposed to having an intermediary workflow step and format, which is interesting. My only concern is dealing with large/messy and hard to manage xfl files (and yes, designers usually are 'messy' with they're assets).

XFL is not exactly FXG unfortunately and there isn't an XFL specification available yet (there is one for FXG though).
Check out these answers on XFL specs and XFL Edge definitions.
Either somebody needs to get their hands dirty and reverse engineer/document the XFL format or wait for Adobe to do it. The later basically means flooding the feature request form and forums, contacting evangelists, campaigning until they do it. As far as I can see, if a LOT of people find this useful I imagine Adobe would be willing to invest time into this.

In short, having a decent library to parse/search/fetch assets from XFL files might be pretty handy and on the long run being able to import/export XFL's from other tools will be beneficial.

猫烠⑼条掵仅有一顆心 2024-11-24 01:34:59

ActionScript Viewer 从版本 3.1 及更高版本(2002 年发布)开始具有该功能。该工具不是免费的。

他们所做的就是解析以 SWF 格式存储的矢量图形。

引用他们的绘图课(由 Peter Joel 编写):

    The data array is a special format, which can be obtained from graphics in a swf, using
    It is structured as a list of commands, which correspond to the movieClip methods moveTo, 
lineTo etc. Each command is a two-element array. The first element is a string, indicating the
type of command and the second element is another array, containing arguments. The following 
commands are supported:
    ['M',[x,y]]  -  moveTo(x,y)
    ['L',[x,y]]  -  lineTo(x,y)
    ['C',[cx,cy,ax,ay]]  -  moveTo(cx,cy,ax,ay)
    ['S',[th,col,alph]]  -  lineStyle(th,col,alph)
    ['F',[col,alph]]  -  beginFill(col,alph)
    ['EF']  -  endFill()
    ['GF',[a,b,c,d,e,f]]  -  beginGradientFill(a,b,c,d,e,f)

输出可能如下所示(此处为 ASV5 的示例输出):

//Created by Action Script Viewer - http://www.buraks.com/asv
//ASVDrawing Data format specification by Peter Hall (http://www.peterjoel.com)
//See ASV help file for more information.
//bounding rectangle (95,69) (427,327)
var data=new Array(['S',[1,0xFF0000,100]],['M',[426.5,132.5]],['L',[426.5,326.5]],['L',[358.5,326.5]]
,['L',[358.5,246.5]],['L',[249.5,246.5]],['L',[249.5,305.5]],['L',[157.5,305.5]],['L',[157.5,246.5]],['L',[116.5,246.5]]
,['L',[116.5,177.5]],['L',[95.5,177.5]],['L',[95.5,69.5]],['L',[414.5,69.5]],['L',[414.5,132.5]],['L',[426.5,132.5]]
,['M',[414.5,132.5]],['L',[414.5,177.5]],['L',[358.5,177.5]],['L',[358.5,246.5]],['M',[157.5,246.5]],['L',[157.5,177.5]]
,['L',[116.5,177.5]],['M',[249.5,246.5]],['L',[249.5,177.5]],['L',[157.5,177.5]],['M',[358.5,177.5]],['L',[249.5,177.5]]
);

或者,

//Created by Action Script Viewer - http://www.buraks.com/asv
//bounding rectangle (95,69) (427,327)
lineStyle(1,0xFF0000,100);
moveTo(426.5,132.5);
lineTo(426.5,326.5);
lineTo(358.5,326.5);
lineTo(358.5,246.5);
lineTo(116.5,246.5);
moveTo(414.5,132.5);
// ......

在我看来,ASV 是一个不错的工具,尽管它没有定期更新。我记得它是市场上最可靠的反编译器的日子。 :)

如果您打算自己实现类似的功能,您可能会发现这个关于 SWF 的精彩解释文件格式有用。

ActionScript Viewer had that feature from version 3.1 and onwards (released in 2002). The tool is not free.

What they do is parse vector graphics stored in SWF format.

A quotation from their drawing class (written by Peter Joel):

    The data array is a special format, which can be obtained from graphics in a swf, using
    It is structured as a list of commands, which correspond to the movieClip methods moveTo, 
lineTo etc. Each command is a two-element array. The first element is a string, indicating the
type of command and the second element is another array, containing arguments. The following 
commands are supported:
    ['M',[x,y]]  -  moveTo(x,y)
    ['L',[x,y]]  -  lineTo(x,y)
    ['C',[cx,cy,ax,ay]]  -  moveTo(cx,cy,ax,ay)
    ['S',[th,col,alph]]  -  lineStyle(th,col,alph)
    ['F',[col,alph]]  -  beginFill(col,alph)
    ['EF']  -  endFill()
    ['GF',[a,b,c,d,e,f]]  -  beginGradientFill(a,b,c,d,e,f)

The output may look like (sample output from ASV5 here):

//Created by Action Script Viewer - http://www.buraks.com/asv
//ASVDrawing Data format specification by Peter Hall (http://www.peterjoel.com)
//See ASV help file for more information.
//bounding rectangle (95,69) (427,327)
var data=new Array(['S',[1,0xFF0000,100]],['M',[426.5,132.5]],['L',[426.5,326.5]],['L',[358.5,326.5]]
,['L',[358.5,246.5]],['L',[249.5,246.5]],['L',[249.5,305.5]],['L',[157.5,305.5]],['L',[157.5,246.5]],['L',[116.5,246.5]]
,['L',[116.5,177.5]],['L',[95.5,177.5]],['L',[95.5,69.5]],['L',[414.5,69.5]],['L',[414.5,132.5]],['L',[426.5,132.5]]
,['M',[414.5,132.5]],['L',[414.5,177.5]],['L',[358.5,177.5]],['L',[358.5,246.5]],['M',[157.5,246.5]],['L',[157.5,177.5]]
,['L',[116.5,177.5]],['M',[249.5,246.5]],['L',[249.5,177.5]],['L',[157.5,177.5]],['M',[358.5,177.5]],['L',[249.5,177.5]]
);

Or

//Created by Action Script Viewer - http://www.buraks.com/asv
//bounding rectangle (95,69) (427,327)
lineStyle(1,0xFF0000,100);
moveTo(426.5,132.5);
lineTo(426.5,326.5);
lineTo(358.5,326.5);
lineTo(358.5,246.5);
lineTo(116.5,246.5);
moveTo(414.5,132.5);
// ......

ASV is a nice tool in my opinion, though it's not being updated regularly. I remember the days when it was the most reliable decompiler on the market. :)

If you are going to implement something like that on you own, you may find this great explanation of SWF file format usefull.

明月松间行 2024-11-24 01:34:59

我不知道如何转换用于以 XFL 文件结构存储 MovieClip 的 XML 文件。如果您尝试将 Flash IDE 资源制作为 Flash Builder 中的 ActionScript 项目,则只需将它们导出为 SWC 文件即可。如果您确实想创建一个转换工具,您可以尝试从 FXG 文件转换为绘图 API 版本。 FXG 格式在描述路径方面与 SVG 类似。该符号应该很容易转换为Flash 的drawPath 命令和数据。

当您这样做时,您可以移植 HTML5 画布的代码。

I do not know of a way of converting the XML files that are used to store the MovieClips in XFL file structures. If you are trying to make Flash IDE assets to an ActionScript project in Flash Builder, you could just export them as SWC files. If you are really trying to create a conversion tool, you might try converting from FXG files to the drawing API versions. The FXG format is similar to SVG in how it describes paths. The notation should be easy to translate to Flash's drawPath commands and data.

While you are at it you could port the code for HTML5 canvas.

一个人的旅程 2024-11-24 01:34:59

我刚刚了解了 Drawscript,这是一个 Adob​​e Illustrator 扩展,可将绘图转换为 AS3、C++ 代码、JavaScript等,看起来很有前途。

I just learned about Drawscript, an Adobe Illustrator extension that converts drawings into code for AS3, C++, JavaScript, etc., which looks very promising.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文