jeudi 28 mai 2015

Children position -index- without loosing functions

I have this action script which works, I can't work out how to move startText on top position any try end up with error (#2025) or the mouse events doesn't works. Thank you.. you can see the project on http://ift.tt/1J8goFw

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


}

Aucun commentaire:

Enregistrer un commentaire