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:



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



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:



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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.