Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-04-2010, 12:13 AM   #1
duki
Registered User
 
Join Date: Nov 2010
Posts: 1
Default Casting string as a class

Hi. I have 52 symbols in my library each with class names Symbol1, Symbol2, Symbol3, etc. I want to create an array of these classes which will be used to create a random particle effect. How do I cast the var cardNumbers so that the array looks like this:

cardTypes = [Symbol1, Symbol2, Symbol3, etc]

instead of

cardTypes = ["Symbol1", "Symbol2", "Symbol3", etc]

This is what I have written so far...

var cardTypes:Array=new Array();

for(var i:Number = 0;i<52; i++)
{
var cardNumbers:String = "Symbol"+i;
cardTypes.push(cardNumbers);

}

Any help would be much appreciated.
duki is offline   Reply With Quote
Old 11-04-2010, 11:43 AM   #2
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

push:

getDefinitionByName(cardNumbers)

http://help.adobe.com/en_US/FlashPla...nitionByName()
__________________
(6)
senocular 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 09:05 AM.

///
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.