Skip to content

a_11. MovieClip Example

fahimc edited this page Mar 6, 2013 · 3 revisions

#Demo
click here for a demo

Video Tutorial

Create a MovieClip

#Add a Spritesheet Create a horizontal spritesheet and then create an image with the source.

#Build a MovieClip Create an instance of MovieClip and apply the width and height of your frames. Attach the image.

#Example Code In this example I have called 'gotoAndPlay' which will start the animation from frame 0 to 4 and will continuously loop.

	var bird = new Image();
	bird.src = "images/bird.png";

	test = new MovieClip();
	test.width(184);
	test.height(163);
	test.build();
	test.setStyle();
	test.x(100);
	test.y(100);
	document.body.appendChild(test.display);
	test.arrange();

	test.attach(bird);
	test.gotoAndPlay(0, 4, true);
Clone this wiki locally