Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

load/add Child MC at runtime question

Status
Not open for further replies.

zdvdla

Technical User
Joined
Apr 28, 2007
Messages
18
Location
US

so how would i load a specific MovieClip without using new?
this of course creates a new instance over and over again.
I simply want the MovieClip to play (loop)...

I created a simple ball animation called ball_mc. set the class to ballClass in the linkage props.

this works but keeps creating new clips over and over...

var myClip:ballClass = new ballClass();
addChild(myClip);
myClip.x = 250;
myClip.y = 250;

I want to add ball_mc only once and have it loop.
I can't get how to set that. I tried:

var myClip:ballClass = ball_mc();
addChild(myClip);
myClip.x = 250;
myClip.y = 250;

I get these errors..........

1046: Type was not found or was not a compile-time constant: ballClass.
1180: Call to a possibly undefined method ball_mc.

I must not have a grip on a simple concept somewhere...
 
If I do this on the main timeline it works fine:
Code:
var mcBall:Ball = new Ball();
var mc:DisplayObject = this.addChild(mcBall);
with (mc) {
	x = 100;
	y = 100;
}


Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top