开发者

ActionScript 3 Trying to access a nested Moviclip and can't get it to work

Im fairly new in Actionscript. That being said, I'm trying to access a nested Movieclip in a MovieClip. My code looks like this

if (ground.hitTestPoint(char.getChildByName("charBox").x, char.getChildByName("charBox").y,true))
    {
        falling = false;
        jumping = false;
     开发者_如何学JAVA   jumpSpeed = 1;
        fallSpeed = 0;
        speed = 15;
}

This is just a snippet of the hitTest. the "charBox" is the Movieclip I'm trying to access in the char Movieclip. So where did I go wrong?


char.charBox.x

Should work to get the x value if you have an instance of a MovieClip inside the parent clip Class like so:

public var charBox:MovieClip = new MovieClip();

Or you have the instance name of that clip set to 'charBox' if you're using the Flash IDE, note the instance name is different than the name in the Flash IDE library.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜