Skip to main content
Benjamin Waller
Known Participant
March 11, 2010
Answered

How can I display a Movie clip from library on stage in AS3?

  • March 11, 2010
  • 1 reply
  • 1249 views

Hi,

I have a movie clip in my library and I would like to display it on the stage using AS3.

do I have to define it as a variable?Do  I need to use this code:  addchild(movieclip);

can I use the 'x' and 'y' to position it?

What would the code look like?

Ben.

This topic has been closed for replies.
Correct answer spvr

Steps:

  1. Right-click Moviclip from library and choose: Linkage...
  2. Select the checkbox to Export for ActionScript.
  3. Give the class "mov_clip"
var movie:mov_clip = new mov_clip;
movie.x = 50;
movie.y = 50;
addChild:(movie);

1 reply

spvr
spvrCorrect answer
Inspiring
March 11, 2010

Steps:

  1. Right-click Moviclip from library and choose: Linkage...
  2. Select the checkbox to Export for ActionScript.
  3. Give the class "mov_clip"
var movie:mov_clip = new mov_clip;
movie.x = 50;
movie.y = 50;
addChild:(movie);
Inspiring
March 11, 2010

Typo: no colon in addChild

Inspiring
March 11, 2010

Ok..

But I guess the problem I have is that I want this one moive clip to be in two different places at the same time! I have two different buttons but I want to display the same movie clip when both buttons are pressed independently so the move clip will have to be at two different locations!


Why not create two instances of that movie clip class?

var mc1:YourMcInLibrary = new YourMcInLibrary();

var mc2:YourMcInLibrary = new YourMcInLibrary();

mc1.x = 50;

mc1.y = 50;

mc2.x = 150;

mc2.y = 150;

addChild(mc1);

addChild(mc2);