Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-27-2012, 11:55 PM   #1
macdonjo
Registered User
 
Join Date: May 2011
Posts: 42
Default addChild without a class?

I'm working without a class. I seen this code example, but it doesn't work since my project does not use classes.

//create an object of our ship from the Ship class
var ourShip:Ship = new Ship();
//add it to the display list
stage.addChild(ourShip);

How do I add library movieclips to the stage or into a symbol on the stage?
macdonjo is offline   Reply With Quote
Old 04-28-2012, 12:37 AM   #2
macdonjo
Registered User
 
Join Date: May 2011
Posts: 42
Default

Nevermind, I figured it out.

It's

var myChild:MovieClip = new linkageName();
addChild(myChild);

All you got to do is create linkage on the symbol.
macdonjo is offline   Reply With Quote
Old 04-28-2012, 06:10 AM   #3
northmantif
dont Re Member
 
Join Date: May 2009
Location: Poland
Posts: 737
Default

you may be suprised but if you don't create .as file for your class, Flash will do it for you. Click on your linkage symbol in library and right click -> Edit class. You will simply get empty class statement with constructor. If you need add something functionality to the symbol you can simply edit it and save as you named it in library. Very clever and fast.
northmantif is offline   Reply With Quote
Old 04-28-2012, 06:23 PM   #4
macdonjo
Registered User
 
Join Date: May 2011
Posts: 42
Default

Wow, thanks. That's interesting.
macdonjo is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:08 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.