儿童位置-index-没有失去功能

时间:2015-05-28 15:57:21

标签: actionscript-3 indexing position addchild

我有这个动作脚本可以工作,我无法弄清楚如何将startText移动到顶部位置任何尝试最终都会出错(#2025)或者鼠标事件不起作用。 谢谢..你可以在http://portfolio.countrylifeartist.com/pater-noster/

上看到该项目
import flash.display.*;
import flash.events.*;

stop();


var container:Sprite = new Sprite();
addChild(container);


var startText = new StartText();
startText.x = 317.10;
startText.y = 367.75;
//container.addChild(startText);
container.addChildAt(startText,0);
//trace(container.getChildAt(0) == startText); // true
//setChildIndex(startText, numChildren -1);


//stage.setChildIndex(startText, 0);
startText.addEventListener(MouseEvent.MOUSE_OVER,removeText);
function removeText(event:MouseEvent): void {
    container.removeChild(startText);

    trace('removed');
}
var wife = new Wife();;

wife.x = 419.45;
wife.y = 916.10;
container.addChild(wife);
container.addChildAt(wife,1);
var pater;
pater.useHandCursor = true; // <---- doesn't work?
pater.mouseChildren=false;
pater.buttonMode = true;
container.addChild(pater);



pater.addEventListener(MouseEvent.CLICK, _click);
function _click(e:MouseEvent):void
{
    trace('click');
    pater.play();
    this.pater.box1.play();
    this.pater.box2.play();
    this.pater.box3.play();
    this.pater.box4.play();
    this.pater.box5.play();
    this.pater.box6.play();
    this.pater.box7.play();
    this.pater.box8.play();

}

var middle;


var bl;
bl.useHandCursor = true; // <---- doesn't work?
bl.buttonMode = true;
addChild(bl);
bl.addEventListener(MouseEvent.CLICK, _openbl);
function _openbl(e:MouseEvent):void
{
    trace('open or shut');
    bl.play();


}
var br;
br.useHandCursor = true; // <---- doesn't work?
br.buttonMode = true;
addChild(br);
br.addEventListener(MouseEvent.CLICK, _openbr);
function _openbr(e:MouseEvent):void
{
    trace('open or shut');
    br.play();


}

middle.useHandCursor = true; // <---- doesn't work?
middle.buttonMode = true;
addChild(middle);
middle.addEventListener(MouseEvent.CLICK, _open);
function _open(e:MouseEvent):void
{
    trace('open the cupboard');
    middle.play();


}


var tl;
tl.useHandCursor = true; // <---- doesn't work?
tl.buttonMode = true;
addChild(tl);
tl.addEventListener(MouseEvent.CLICK, _opentl);
function _opentl(e:MouseEvent):void
{
    trace('open or shut');
    tl.play();


}
var tr;
tr.useHandCursor = true; // <---- doesn't work?
tr.buttonMode = true;
addChild(tr);
tr.addEventListener(MouseEvent.CLICK, _opentr);
function _opentr(e:MouseEvent):void
{
    trace('open or shut');
    tr.play();


}

0 个答案:

没有答案