万卷书   首页 > 电脑书籍 > Flash > Flash MX 新的闪烁世界(第六天)
 
  Flash MX的正式版(47377KB最主要的感觉就是Action面板的快捷键换掉了,当我习惯性按下F2的时候,结果出现了Output面板,当然我们可以从Window菜单找回Action面板的位置(F9,好像不太方便)。

  Flash MX的文本区的应用我们昨天已经第一次亲密接触了,今天我们再续前缘(言),深入了解一些文本区的属性和方法,并通过TextFormat对象来装修文本的样式。

  在昨天的大米试验中,虽然经测试还是有一些矛盾存在,不过这个方向是对的,我们继续给它添砖加瓦:


// make box

Movieclip.prototype.makeBox = function(x, y, l) {

this.lineto(x, y+l);

this.lineto(x+l, y+l);

this.lineto(x+l, y);

this.lineto(x, y);

};

// prepare scroll template

createEmptyMovieClip("scrollUp",2);

with (scrollUp) {

lineStyle(1,0x999999,50);

moveTo(550,200);

beginFill(0x345678,20);

makeBox(550,200,30);

endfill();

}

// make scroll

duplicateMovieClip(scrollUp, "scrolldown", 3);

scrollUp._y-=60;

// handler method

scrollUp.onPress=function(){txt.scroll--};

scrollDown.onPress=function(){txt.scroll++};

// prepare text

createTextField("txt",1,300,10,100,200);

with (txt) {

type="input";

textcolor=0x333333;

variable="tempcache";

border=wordwrap=1;

restrict="^demons";

}

// custom method

txt.onSetFocus=function(){trace("Ready for loading rice");txt.text=""};

txt.onkillFocus=function(){trace("Gocha...");txt.putRice(200,"::::~")};

txt.putRice = function (count,food) { if (count) {txt.text +=food;arguments.callee(--count,food);}return;};

// start

txt.putRice(200,".");

txt.putRice(200,".");

txt.putRice(200,".");


  其实我用到的一些部分代码基本都是这些天我们所接触的,尤其是MakeBox和我改进后的putRice装米器(经改进现在已经可以装载任何粮食)

 
下一页