0

フラッシュを埋め込むためにswfobjectを使用しています。変なことをしている。

FlexBuilder を使用して単純なテキスト フィールドを作成しました。Sprite を拡張する AS3 プロジェクトです。幅を 640 に、高さを 450 に設定しました。次に、ページの swfobject パラメータで、640 x 450 も設定しました。:)

http://www.brighttext.com/flash/TextFieldSetFormat.html

寸法が合っているようです。しかし、ほぼ同じサイズと高さであるはずのテキストフィールドがあります。これは FlexBuilder で正常に動作します (適切なサイズです) が、swfobject を追加するとすべてが台無しになります。

編集注:私はそれを見ただけで、問題ないようです。しかし、ページを更新すると、テキストフィールドは切手サイズです (これも私が見た元の動作です)。現在、Firefox では正常に見えますが、IE8 では正常に見えません。Flash はすべてのブラウザーで同じように見えるはずです !??

AS3 コード:

package {
 import flash.display.Sprite;
 import flash.text.TextField;
 import flash.text.TextFormat;
 import flash.text.Font;

[SWF(width="640", height="450", backgroundColor="#FFFFFF", frameRate="30")]
public class TextFieldSetFormat extends Sprite
{
    [Embed(source='C:/WINDOWS/Fonts/ArialBD.TTF',  fontWeight = 'bold', fontName='ArialBold')]

    [Embed(source='C:/WINDOWS/Fonts/Arial.TTF', fontWeight = 'regular', fontName='Arial')]

    public function TextFieldSetFormat()
    {
        var tf2:TextFormat = new TextFormat();
        tf2.size = 16;
        tf2.font = "Arial";
        Font.registerFont(_VerdanaFontBold);
        Font.registerFont(_VerdanaFont);
        var pad:Number = 10;
        var brightTextField:TextField = new TextField;
        brightTextField.backgroundColor = 0xDDF3B2;
        brightTextField.background = true;
        brightTextField.embedFonts = true;
        brightTextField.border = true;
        brightTextField.defaultTextFormat = tf2;
        brightTextField.wordWrap = true;
        brightTextField.multiline = true;
        brightTextField.width = stage.stageWidth - (4 * pad);
        brightTextField.height = stage.stageHeight - (3 * pad);
        brightTextField.x = 2*pad;
        brightTextField.y = 2*pad;

        brightTextField.text = "Dear Senators, I have become concerned over the idea that some in the Senate will oppose the public option because of a group of wild-eyed, overbearing but misinformed ideologues. These people mistakenly equate insurance reform with Socialism and call our  first African-American President unprintable epithets. This is unacceptable. The public option is the choice of more than 70% of Americans, a majority of the House and a great many opinion leaders. Passing insurance reform without a public option persists the current broken system. I am aware that many Senators would prefer to pass a reform bill with bipartisan support. But we cannot allow this critical debate to be hijacked by extremists or corporate profiteers. Thank you, and I look forward to hearing from you.";
        addChild(brightTextField);
    }
}
} 
4

2 に答える 2

0

わかりました、まあ、私はこれを理解しました。

問題は、stage.stageWidth と stage.stageHeight の使用にあります。これがなぜそうなのかはまだわかりませんが、アジャイル開発の精神から、これは修正です。:)

stage.stageWidth を使用する代わりに、ピクセル数を使用します。(私の場合は 640 x 450)。その後、問題は解決します。

これについては、私が撮ったスクリーンショットや行ったテストを含めて、すぐに私のブログに投稿し、ここにリンクを投稿します。

于 2009-12-11T22:50:48.103 に答える
0

stage.stageWidth/Height の値をトレースしてみて、Flash Tracer のようなプラグインを使用して、その出力を確認してください。

Event.ADDED_TO_STAGE/INIT のイベント リスナーを追加し、そのリスナー内でセットアップ コードを実行するだけでよい場合があります。

于 2009-11-20T19:21:08.643 に答える