Home Tutorials Forums Articles Blogs Movies Library Employment Press
Prev Previous Post   Next Post Next
Old 07-26-2010, 05:33 PM   #1
Registered User
Join Date: Mar 2010
Posts: 12
Default Creating different variable types from single function?

This is hard to describe in a sentence, so i'll write some false code: (with incorrect syntax, of course)

function placeIcon(varType:String) {
     myIcon:'varType' = new 'varType'();
...where varType would be a String reading "MovieClip", or "Sprite", or the names of custom clips from the library.

Is it possible to do something like this, where I pass the name of the data Type that I want it to create and it does it within the function? And I know that with this simple example it isn't necessary to do it this way, but in the full program this would save some time and make the code more efficient.

I tried searching, but can't come up with the correct key words to find what i'm looking for.

eaclou is offline   Reply With Quote

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.