我需要导出使用 Flash 编辑器创建的矩形的渐变设置。我们的艺术家在 .fla 中创建了一个带有渐变的矩形。是否可以从 .swf 或我可以编写的 flash 插件中检索渐变参数?
问问题
580 次
3 回答
3
于 2011-01-07T09:59:46.977 回答
2
几年前我需要这个,幸运的是 Tink 已经写了一个扩展/JSFL 脚本:复制填充为 AS3。
我记得在渐变方面遇到了一些小问题,具体取决于选择,但忘记了这是怎么回事。如果扩展不能正常工作,这是我稍微改动的版本:
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' );
}
如果在 Flash 的Commands文件夹中将其保存为Copy Fill as AS3.jsfl,它应该会在 IDE 的 Commands 菜单中弹出。
高温高压
于 2011-01-07T11:35:18.737 回答
1
Sothink Decompiler 让您反编译 swf,从而获得原始 FLA。http://www.sothink.com/product/flashdecompiler/它是付费的,但他们有免费试用。
不记得您是否可以在试用版中导出到 fla。
于 2011-01-07T11:28:23.107 回答