Henryk

Cannot access children of group

Recommended Posts

Hi there,

 

In the "group" tutorial (http://mightyfingers.com/tutorials/display/group/) it seems super easy to acces group elements, but for me it doesn't work.

 

I have a simple project here:

http://mightyeditor.mightyfingers.com/#p266r

 

If you look in the play.js you can see the code. It's basically like this:

        
        this.playScreen = mt.create("Game"); // create Game Group
        
        this.gPig = this.playScreen.Pig; // but cannot get the children
        
        console.log("pig:" + this.gPig); // undefined -  But Why?

 

 

Any advise what the problem might be?

Share this post


Link to post
Share on other sites

Hi,

 

sorry - seems that tutorials are a little bit outdated.

 

Everything related to MightyEditor now is under mt property for any object created by mt.create:

 

e.g.

this.playScreen = mt.create("Game");// check out mt objectconsole.log(this.playScreen.mt);// pig is herethis.pig = this.playScreen.mt.children.Pig;

mt structure:

{

self: reference to phaser sprite/group ( phaser object )

data: reference to data object used for object caonstruction

children: map of all children - if you want array ( self.children - has been provided by phaser )

movies: list of defined movies - to fill this you should call mt.createTweens(myGroup)

}

 

basically the reason of this is that we wanted to return pure phaser object - before it was abstract object for groups and rised unneeded misuderstandings

 

I'll make seperate page for mt helper docs.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.