通过AS3(用于导出)访问在Flash编辑器中创建的矩形的渐变

通过AS3(用于导出)访问在Flash编辑器中创建的矩形的渐变,flash,actionscript-3,export,gradient,jsfl,Flash,Actionscript 3,Export,Gradient,Jsfl,我需要导出使用Flash编辑器创建的矩形的渐变设置。我们的艺术家创建了一个带有.fla渐变的矩形。是否可以从.swf或我可以编写的flash插件中检索渐变参数?看看克劳斯·瓦勒(Claus Wahlers)编写的卓越库,您可以从中 解析、创建、修改和发布SWF文件 .看看克劳斯·瓦勒(Claus Wahlers)写的卓越图书馆,从这里你可以 解析、创建、修改和发布SWF文件 .Sothink Decompiler允许您对swf进行反编译,从而获得原始FLA。它是付费的,但他们有免费试用 不记得您

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

看看克劳斯·瓦勒(Claus Wahlers)编写的卓越库,您可以从中

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


.

看看克劳斯·瓦勒(Claus Wahlers)写的卓越图书馆,从这里你可以

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


.

Sothink Decompiler允许您对swf进行反编译,从而获得原始FLA。它是付费的,但他们有免费试用


不记得您是否可以在试用中导出到fla。

Sothink Decompiler允许您反编译swf,以便获得原始fla。它是付费的,但他们有免费试用


不记得您是否可以在试用中导出到fla。

我几年前就需要它,幸运的是Tink已经编写了一个扩展/JSFL脚本:

我记得根据选择的不同,在渐变方面有一些小问题,但我忘了这是怎么回事。如果扩展无法正常工作,下面是我的稍作更改的版本:

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' );
}
document=fl.getDocumentDOM();
selection=document.getSelectionRect();
选择。左!=未定义?useSelection=true:useSelection=false;
使用选择?fill=document.getCustomFill(“选择”):fill=document.getCustomFill(“工具栏”);
fl.outputPanel.clear();
var输出=”;
如果(fill.style!=“noFill”){
如果(fill.style==“实体”)
{
if(fill.color.length==9)
{
a=数学圆((parseInt(“0x”+fill.color.substr(7,2))/255)*100)/100;
输出+=“beginull(0x”+fill.color.substr(1,6.toUpperCase()+”,“+a+”;”;
}
其他的
{
输出+=“beginull(0x”+fill.color.substr(1,6.toUpperCase()+”,1);”;
}
}
否则如果(fill.style==“linearGradient”)
{
输出+=“beginGradientFill(GradientType.LINEAR)”;
}
否则,如果(fill.style==“radialGradient”)
{
输出+=“beginGradientFill(GradientType.RADIAL)”;
}
如果(fill.style!=“solid”)
{ 
c=新数组();
a=新数组()
对于(i=0;i
如果将其另存为Flash的Commands文件夹中的Copy Fill as AS3.jsfl,它应该会在IDE的Commands菜单中弹出


HTH

几年前我就需要这个,幸运的是Tink已经编写了一个扩展/JSFL脚本:

我记得根据选择的不同,在渐变方面有一些小问题,但我忘了这是怎么回事。如果扩展无法正常工作,下面是我的稍作更改的版本:

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' );
}
document=fl.getDocumentDOM();
selection=document.getSelectionRect();
选择。左!=未定义?useSelection=true:useSelection=false;
使用选择?fill=document.getCustomFill(“选择”):fill=document.getCustomFill(“工具栏”);
fl.outputPanel.clear();
var输出=”;
如果(fill.style!=“noFill”){
如果(fill.style==“实体”)
{
if(fill.color.length==9)
{
a=数学圆((parseInt(“0x”+fill.color.substr(7,2))/255)*100)/100;
输出+=“beginull(0x”+fill.color.substr(1,6.toUpperCase()+”,“+a+”;”;
}