0
나는 Adobe Flash Professional 용CS5 용 레슨 8 ActionScript 3.0을 완성하려고 시도했지만 몇 가지 어려움을 발견했습니다. 책에 표시된 코드를 모두 입력했지만 결과를 얻지 못하고 문제가 있다고 생각합니다. 어도비 플래시 CS 6, 로 작업하고 있기 때문에 파일의 일부분이 CS 6에서 제대로 열리지 않기 때문입니다. 여기에 8 단원의 코드가 있습니다. 과 강의를 완료하려면 어떻게해야합니까?수업을 완료하는 방법?
import fl.text.TLFTextField;
import fl.controls.UIScrollBar;
var t:TLFTextField = new TLFTextField();
var tf:TextFormat = new TextFormat();
t.width = 500;
t.height = 600;
t.background = true;
t.paddingTop = 20;
t.paddingLeft = 20;
t.paddingRight = 20;
addChild(t);
var textLoad:URLLoader = new URLLoader();
textLoad.addEventListener(Event.COMPLETE, textLoaded);
textLoad.load(new URLRequest("sample.txt"));
function textLoaded(e:Event):void
{
var txt:String = URLLoader(e.target).data as String;
t.text = txt;
tf.color = 0x336633;
tf.font = "Arial";
tf.size = 14;
t.setTextFormat(tf);
}
var formatClip:Formatter = new Formatter();
var showFormat:Boolean = true;
stage.addEventListener(KeyboardEvent.KEY_DOWN, showFormatter);
function showFormatter(e:KeyboardEvent):void
{
if (e.keyCode == 70)
{
if (showFormat)
{
addChild(formatClip);
formatClip.x = t.width;
formatClip.addEventListener(MouseEvent.MOUSE_DOWN, drag);
showFormat = false;
}
else
{
formatClip.removeEventListener(MouseEvent.MOUSE_DOWN, drag);
removeChild(formatClip);
showFormat = true;
}
}
}
function drag(e:Event):void
{
formatClip.startDrag();
formatClip.addEventListener(MouseEvent.MOUSE_UP, noDrag);
}
function noDrag(e:Event):void
{
formatClip.stopDrag();
}
formatClip.fontList.addEventListener(Event.CHANGE, setFont);
formatClip.fontSizer.addEventListener(Event.CHANGE, setFontSize);
formatClip.colorPicker.addEventListener(Event.CHANGE, setColor);
formatClip.columnNum.addEventListener(Event.CHANGE, setColumns);
function setFont(e:Event):void
{
tf.font = e.target.selectedItem.label;
t.setTextFormat(tf);
}
function setFontSize(e:Event):void
{
tf.size = e.target.value;
t.setTextFormat(tf);
}
function setColor(e:Event):void
{
tf.color = e.target.selectedColor;
t.setTextFormat(tf);
}
function setColumns(e:Event):void
{
t.columnCount = e.target.value;
}
var scroller:UIScrollBar = new UIScrollBar();
scroller.move(t.x + t.width, t.y);
scroller.height = t.height;
scroller.scrollTarget = t;
addChild(scroller);
scroller.visible = false;
formatClip.addEventListener(MouseEvent.CLICK, setScrollbar);
function setScrollbar(e:Event):void
{
if (t.textHeight > scroller.height)
{
scroller.visible = true;
}
else
{
scroller.visible = false;
}
t.scrollV = 1;
}
나는이 SWF 얻을 :
을하지만이 SWF 얻을 필요가 : 당신이 여러 줄 텍스트 필드를 사용할 필요가 같은 당신에게 Juozas Vitkus
강의 8? 도서? 너 무슨 소리하는거야?! –