To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > General Help > Games

Reply
 
Thread Tools Display Modes
Old 05-23-2008, 08:48 AM   #1
chriserrorplain
Senior Member
 
chriserrorplain's Avatar
 
Join Date: Aug 2002
Location: london village
Posts: 623
[AS3 question] Class from String?

ok...so I don't know if this is possible...but...


let's say I have

stringName = "bigFootball";

is it possible to some how do somehting like this :

var ball:class[stringName] = new class[stringname]

so initialise an instance of a Class from a string of the class type?


danke


Chris x
__________________
kill5
chriserrorplain is offline   Reply With Quote
Old 05-23-2008, 09:10 AM   #2
chriserrorplain
Senior Member
 
chriserrorplain's Avatar
 
Join Date: Aug 2002
Location: london village
Posts: 623
[RESOLVED]

you do ti like this:
PHP Code:
      var ClassReference:Class = getDefinitionByName(gameData.level[game.level].background.backgroundLayer) as Class;
      var
bg = new ClassReference();
__________________
kill5
chriserrorplain is offline   Reply With Quote
Old 05-23-2008, 06:21 PM   #3
Flashkit
FK founder & general loiterer
 
Flashkit's Avatar
 
Join Date: Feb 2000
Location: Sydney
Posts: 1,148
and if it was like a bitmapData you would put in the parameters eg bg = new Classreference(0,0)... or for any class that takes parameters.

This is very very handy!

You can also create classes from loaded swf files which is even cooler, and manipulate, add to the main stage etc etc. You'll need to look for applicationDOmain in the help for that though
__________________
Regards Mark Fennell - Flash Kit Founder, general loiterer
-------------------------------
markfennell.com | original games | world panoramas
Flashkit is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > General Help > Games

Thread Tools
Display Modes

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 -4. The time now is 08:22 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.