thanx all for your help!
On Wed, 9 Mar 2005 13:20:18 +0100, Erik Westra <[EMAIL PROTECTED]> wrote: > To instantiate classes via a string I do the folowing: > > I have a class Popups.as: > > class Popups > { > public function Popups() > { > package.className1; > package.className2; > package.className3; > }; > }; > > The above class makes sure the classes are included in the swf. > > Then when I need to access it I can do things like: > > var classString = "package.className3"; > > var classRef = _global; > var class_array = classString.split("."); > for (var i = 0; i < class_array.length; i++) > { > classRef = classRef[class_array[i]]; > }; > > Then u can use classRef to do whatever u want. > > Greetz Erik > > > -----Original Message----- > From: Manish Jethani [mailto:[EMAIL PROTECTED] > Sent: woensdag 9 maart 2005 13:05 > To: flexcoders@yahoogroups.com > Subject: Re: [flexcoders] call popup with string > > > On Wed, 9 Mar 2005 08:29:44 -0300, Fernando Lobos > <[EMAIL PROTECTED]> wrote: > > > yes, i know but , who can instantiate a class via string from > variable? > > Actually that's what UIObject does internally. It does attachMovie() on > the class's symbolName. So, yes, it's possible to create an object from > a string identifying the class. Using the class reference seems to be > the preferred way in Flex. > > If all you have is strings, you can create a mapping from the strings to > their corresponding class references and look up the mapping every time > you need a reference. Maybe there's a better Flash Way (TM) that I'm > not aware of (some sibling of Object.registerClass() ). > > Manish > > > > Yahoo! Groups Links > > > > > > > > > Yahoo! Groups Sponsor > ADVERTISEMENT > > ________________________________ > Yahoo! Groups Links > > To visit your group on the web, go to: > http://groups.yahoo.com/group/flexcoders/ > > To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.