1

Flashエディターで作成した長方形のグラデーション設定をエクスポートする必要があります。私たちのアーティストは、.flaのグラデーションで長方形を作成します。.swfまたは私が書くことができるフラッシュプラグインからグラデーションパラメータを取得することは可能ですか?

4

3 に答える 3

3

あなたができるところから、ClausWahlersによって書かれた優れたライブラリas3swfを見てください

SWFファイルの解析、作成、変更、公開

于 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のコマンドフォルダにAS3.jsflとしてコピーフィルとして保存すると、IDEの[コマンド]メニューにポップアップ表示されます。

HTH

于 2011-01-07T11:35:18.737 に答える
1

Sothink Decompilerを使用すると、swfを逆コンパイルして、元のFLAを取得できます。http://www.sothink.com/product/flashdecompiler/有料ですが、無料トライアルがあります。

トライアルでflaにエクスポートできるかどうか思い出せませんでした。

于 2011-01-07T11:28:23.107 に答える