我需要导出使用Flash编辑器创建的矩形的梯度设置。我们的艺术家在.fla中与梯度创建了一个矩形。是否可以从.swf或我可以编写的闪存插件中检索梯度参数?

有帮助吗?

解决方案

几年前,我需要这个,幸运的是Tink已经编写了一个扩展名/JSFL脚本: 复制填充为3.

我记得根据选择的不同,梯度遇到了小问题,但忘记了这一切。如果扩展名无法正常工作,这是我稍微更改的版本:

document = fl.getDocumentDOM();
selection = document.getSelectionRect();
selection.left != undefined ? useSelection = true : useSelection = false;
useSelection ? fill = document.getCustomFill( "selection" ) : fill = document.getCustomFill( "toolbar" );
fl.outputPanel.clear();
var output = "";
if(fill.style != "noFill"){
    if( fill.style == "solid" )
    {
        if( fill.color.length == 9 )
        {
            a = Math.round( ( parseInt( "0x" + fill.color.substr( 7, 2 ) ) / 255 ) * 100 ) / 100;
            output += "beginFill( 0x" + fill.color.substr( 1, 6 ).toUpperCase() + ", " + a + " );";
        }
        else
        {
            output += "beginFill( 0x" + fill.color.substr( 1, 6 ).toUpperCase() + ", 1 );";
        }

    }
    else if( fill.style == "linearGradient" )
    {
        output += "beginGradientFill( GradientType.LINEAR, ";
    }
    else if( fill.style == "radialGradient" )
    {
        output += "beginGradientFill( GradientType.RADIAL, ";
    }
    if( fill.style != "solid" )
    { 
        c = new Array();
        a = new Array()
        for( i = 0; i < fill.colorArray.length; i++ )
        {
            if(fill.colorArray){
                if( fill.colorArray[ i ].length == 9 )
                {
                    c.push( "0x" + fill.colorArray[ i ].substr( 1, 6 ).toUpperCase() );
                    a.push( Math.round( ( parseInt( "0x" + fill.colorArray[ i ].substr( 7, 2 ) ) / 255 ) * 100 ) / 100 );
                }
                else
                {
                    c.push( "0x" + fill.colorArray[ i ].substr( 1, 6 ).toUpperCase() );
                    a.push( 1 );
                }
            }
        }
        document.setSelectionRect({left:0,top:0,right:0,bottom:0},true);
        document.setSelectionRect(selection,true);
        localX = fill.matrix.tx - selection.left;
        localY = fill.matrix.ty - selection.top
        if(localX < 0 || localY < 0) error = true;
        else error = false;
        if(useSelection) 
        {
            matrix = 'new Matrix(' + fill.matrix.a + ', ' + fill.matrix.b + ', ' + fill.matrix.c + ', ' + fill.matrix.d + ', ' + localX + ', ' + localY + ')';
        }
        else
        {
            matrix = 'new Matrix(' + fill.matrix.a + ', ' + fill.matrix.b + ', ' + fill.matrix.c + ', ' + fill.matrix.d + ', ' + fill.matrix.tx + ', ' + fill.matrix.ty + ')';
        }

        switch(fill.overflow){
            case "Extend":
            spreadMethod = "SpreadMethod.PAD";
            break;
            case "Repeat":
            spreadMethod = "SpreadMethod.REPEAT";
            break;
            case "Reflect":
            spreadMethod = "SpreadMethod.REFLECT";
            break;
        }
        !fill.linearRGB ? interpolationMethod = 'InterpolationMethod.RGB' : interpolationMethod = 'InterpolationMethod.LINEAR_RGB';

        if(fill.focalPoint != 0) output += "[ " + c.join( ", " ) + " ], [ " + a.join( ", " ) + " ], [ " + fill.posArray.join( ", " ) + " ], " + matrix + ", " + spreadMethod + ", " + interpolationMethod + ", " + fill.focalPoint + "); ";
        else output += "[ " + c.join( ", " ) + " ], [ " + a.join( ", " ) + " ], [ " + fill.posArray.join( ", " ) + " ], " + matrix + ", " + spreadMethod + ", " + interpolationMethod + "); ";

    }

    if(error) 
    {
        fl.trace("You have moved your selection!Please re-select the shape and run this command again");
    }else
    {
        fl.clipCopyString( output );
        fl.trace( output );
    }
}else{
    fl.trace( 'No Fill is Selected' );
}

如果将其保存为 复制填充为3.jsfl 在Flash的 命令 文件夹,它应该弹出在IDE的命令菜单中。

Hth

其他提示

看一下出色的库 AS3SWF 由Claus Wahlers撰写,您可以

解析,创建,修改和发布SWF文件

.

Sothink Encompiler可以让您对SWF进行反编译,因此您可以获得原始的FLA。 http://www.sothink.com/product/flashdecompiler/ 它是报酬,但他们有免费试用。

不记得您是否可以在审判中出口到FLA。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top