Copy link to clipboard
Copied
Hi
In an HTML5 canvas, I've managed to create an instance of a movie clip (a ball) and I've used the .name property to give it an instance name, but when I try to use that instance name to play the timeline inside that movie clip, it says 'can't find variable' or 'undefined is not an object' if I add root.
If I don't name it and just use'ball', when I try ball.play(), it loops through all the different movie clips in the library.
What am I doing wrong?
var ball = new lib.ball()
ball.name = "ball1_mc"
ball.scaleX = 0.3
ball.scaleY = 0.3
ball.regX = ball.getBounds().width / 2
ball.regY = ball.getBounds().height
ball.x = this.shelfB4_x
ball.y = this.shelfB_y
this.addChild(ball)
ball.on("click", clickBall)
function clickBall() {
ball1_mc.play()
}
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now