2009-11-20 4 views
0

swfobject를 사용하여 플래시를 포함하고 있습니다. 이상한 일을하고 있어요.swfobject 이상한 행동

FlexBuilder를 사용하여 간단한 텍스트 필드를 만들었습니다. 그것은 Sprite를 확장 한 AS3 프로젝트입니다. 너비를 640으로 설정하고 높이를 450으로 설정했습니다. 그런 다음 페이지의 swfobject 매개 변수에서 640 x 450을 설정했습니다. 배경을 멋지고 붉게 만들었으므로 볼 수 있습니다. :)

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

올바른 크기를 것 같다. 하지만 거의 같은 크기와 높이가되는 텍스트 필드가 있습니다. 이것은 FlexBuilder에서 제대로 실행되지만 (올바른 크기) swfobject를 추가하면 엉망입니다.

편집 참고 : 방금 살펴 봤는데 괜찮아 보입니다. 하지만 그때 나는 페이지를 새로 고쳤으며 텍스트 필드는 postage-stamp 크기입니다 (다시 - 이것은 본 원래의 동작입니다). 이제 Firefox8에서는 괜찮 았지만 IE8에서는 그렇지 않습니다. 플래시는 모든 브라우저에서 똑같이 보일 것입니다 !! ??

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); 
    } 
} 
} 

답변

0

좋아, 글쎄, 나는 이것을 알아 냈다.

문제는 stage.stageWidth 및 stage.stageHeight를 사용하는 데 있습니다. 나는 이것이 왜 그렇게 중요한지 아직 알지 못하지만, 민첩한 발전의 정신에서, 그것은 해결책입니다. :)

대신 stage.stageWidth를 사용하고 픽셀 수만 사용하십시오. (필자의 경우 640x450). 그런 다음 문제는 사라집니다.

내가 찍은 스크린 샷과 내가 한 테스트를 곧 내 블로그에 게시하고 여기에 링크를 게시 할 예정입니다.

0

시도가 stage.stageWidth/높이의 값을 추적 무엇의 출력을 보려면 Flash 추적기와 같은 플러그인을 사용합니다.

Event.ADDED_TO_STAGE/INIT에 대한 이벤트 리스너를 추가하고 해당 리스너 내에서 설정 코드를 실행하기 만하면됩니다.

+0

감사합니다. Alex. 불행히도 flashlog.txt를 찾을 수 없으므로 아직 Flash Tracer를 사용할 수 없습니다. – David

+0

시도해주세요. http://kb2.adobe.com/cps/193/tn_19323.html –