RE: [flexcoders] eval() function removed in AS 3.0 ??

2006-12-11 Thread Tracy Spratt
Actually, eval() in AS has never been a full eval like in Javascript.  I
has only been able to evaluate a reference to an object.

The direct replacement(was in AS2 as well) is bracket notation, which
is actually more powerful than eval, because it can be used on the left
side of an assignment as well as on the right.

If befor you had:
var oMyObject:Obect = eval(myString + myVar);

Change it to:
var oMyObject:Object = this[myString + myVar].

Tracy

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of {reduxdj}
Sent: Saturday, December 09, 2006 4:05 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] eval() function removed in AS 3.0 ??


from an earlier post about this topic:

You need to roll it on your own. You could split the given path into
its parts and try to evaluate one piece after the other until you come
to the end.

public function eval( scope : Object, path : String ) : Object
{
   if( path == null ) return null;

   var result : Object = scope;
   var parts : Array = path.split('.');
   while( result != null  parts.length  0 )
   {
 var part : String = parts.shift();
 result = result[ part ];
   }
   return result;
}

Untested code, but hopefully you get the point. Maybe you need to add
some exception handling, when you try to access non existing
properties.

Cheers,

Ralf,











pdflibpilot wrote:

 According to the documentation eval() has been removed as function -
 is there an alternative ? I really would like to use this function.

  




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links







Re: [flexcoders] eval() function removed in AS 3.0 ??

2006-12-11 Thread Ben Marchbanks
Thanks Tracy - you are the man - I would never 
have figured that one out !

Works like a charm..


Tracy Spratt wrote:
 Actually, eval() in AS has never been a full eval like in Javascript.  I
 has only been able to evaluate a reference to an object.
 
 The direct replacement(was in AS2 as well) is bracket notation, which
 is actually more powerful than eval, because it can be used on the left
 side of an assignment as well as on the right.
 
 If befor you had:
 var oMyObject:Obect = eval(myString + myVar);
 
 Change it to:
 var oMyObject:Object = this[myString + myVar].
 
 Tracy
 
 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of {reduxdj}
 Sent: Saturday, December 09, 2006 4:05 PM
 To: flexcoders@yahoogroups.com
 Subject: Re: [flexcoders] eval() function removed in AS 3.0 ??
 
 
 from an earlier post about this topic:
 
 You need to roll it on your own. You could split the given path into
 its parts and try to evaluate one piece after the other until you come
 to the end.
 
 public function eval( scope : Object, path : String ) : Object
 {
if( path == null ) return null;
 
var result : Object = scope;
var parts : Array = path.split('.');
while( result != null  parts.length  0 )
{
  var part : String = parts.shift();
  result = result[ part ];
}
return result;
 }
 
 Untested code, but hopefully you get the point. Maybe you need to add
 some exception handling, when you try to access non existing
 properties.
 
 Cheers,
 
 Ralf,
 
 
 
 
 
 
 
 
 
 
 
 pdflibpilot wrote:
 According to the documentation eval() has been removed as function -
 is there an alternative ? I really would like to use this function.

  
 
 
 
 
 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.com 
 Yahoo! Groups Links
 
 
 
 
 
 


Re: [flexcoders] eval() function removed in AS 3.0 ??

2006-12-09 Thread {reduxdj}

from an earlier post about this topic:

You need to roll it on your own. You could split the given path into
its parts and try to evaluate one piece after the other until you come
to the end.

public function eval( scope : Object, path : String ) : Object
{
   if( path == null ) return null;

   var result : Object = scope;
   var parts : Array = path.split('.');
   while( result != null  parts.length  0 )
   {
 var part : String = parts.shift();
 result = result[ part ];
   }
   return result;
}

Untested code, but hopefully you get the point. Maybe you need to add
some exception handling, when you try to access non existing
properties.

Cheers,

Ralf,











pdflibpilot wrote:

 According to the documentation eval() has been removed as function -
 is there an alternative ? I really would like to use this function.

  




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 


Re: [flexcoders] eval gone in AS3, how to get reference to movieclip via target name?

2006-03-06 Thread Abdul Qabiz



eval was gone long back, I mean it was there but most of people stopped using, at least I did after Flash 5 was released. I could use [] or dot (.) to reference things...Much cleaner approach, though eval was little faster...But code clarity matters.
Folks who were not using eval(..) would be happy now, as they don't have to port or change code a lot...-abdulOn 3/6/06, Matt Chotin 
[EMAIL PROTECTED] wrote:

















getClassByBame will return the Class, then
you can use new on it. Make sure you have any class that you'd want to
instantiate linked in by having a typed variable for it though…



Matt











From: 
flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] 
On Behalf Of Tom Bray
Sent: Saturday, March 04, 2006
5:22 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] eval
gone in AS3, how to get reference to movieclip via target name?





I have a question that's
almost related.

In AS3, how can I instantiate a class, com.foo.MyClass, using the string
com.foo.MyClass? The reason I ask is that I'd like to load an
XML file and use it to dynamically create components at runtime.
Something like this: 

components
 component className=com.foo.MyClass x=100
y=100/
 component className=com.foo.MyClass x=100
y=100/ 
/components

Thanks,

Tom



On 3/3/06, Gordon Smith 
[EMAIL PROTECTED] wrote:






Whoa not only is there no eval(), there's no _target, no
_level0, and no _global! Plus, you should almost always use Sprite instead of
MovieClip.



So what are you really trying to do? Are you using Flex or
just pure AS3? Where are you getting a string like
sprite1.sprite2.sprite3 from? Why do you have to transform it back
into a Sprite reference? Could you have just kept the reference instead of the
string?



- Gordon











From: 
flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On Behalf Of Boon Chew
Sent: Friday, March 03, 2006 3:41
PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] eval gone in
AS3, how to get reference to movieclip via target name?









Hi all,

With the _eval being gone in AS3, does anyone know how to get to the reference
of a movieclip (via the target name string) without using _eval (e.g.
_level0.mc1.mc2.mc3) ? I know we can instantiate an object
from a class name string via the _global namespace but not positive about mc's.

Thanks.

- boon







Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze. 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt

Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








SPONSORED
LINKS 





 
  
  
Web site design development 
  
  
  
Computer software development 
  
  
  
Software design and development 
  
 
 
  
  
Macromedia flex 
  
  
  
Software development best practice 
  
  
  
  
 










YAHOO!
GROUPS LINKS





 Visit your group 
flexcoders
 on the web.
  
 To unsubscribe from this group, send an
 email to:
  [EMAIL PROTECTED]

 
 Your use of Yahoo! Groups is subject to the
 Yahoo! Terms
 of Service .

























--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt

Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com









  
  
SPONSORED LINKS
  
  
  


Web site design development
  
  

Computer software development
  
  

Software design and development
  
  



Macromedia flex
  
  

Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group flexcoders
 on the web.
  To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
.



  

















--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  









Re: [flexcoders] eval gone in AS3, how to get reference to movieclip via target name?

2006-03-05 Thread Tom Bray



I have a question that's almost related.In AS3, how can I instantiate a class, com.foo.MyClass, using the string com.foo.MyClass? The reason I ask is that I'd like to load an XML file and use it to dynamically create components at runtime. Something like this:
components component className=com.foo.MyClass x=100 y=100/ component className=com.foo.MyClass x=100 y=100/
/componentsThanks,TomOn 3/3/06, Gordon Smith [EMAIL PROTECTED] wrote:

















Whoa not only is there no eval(),
there's no _target, no _level0, and no _global! Plus, you should almost always
use Sprite instead of MovieClip.



So what are you really trying to do? Are
you using Flex or just pure AS3? Where are you getting a string like sprite1.sprite2.sprite3
from? Why do you have to transform it back into a Sprite reference? Could you have
just kept the reference instead of the string?



- Gordon











From: 
flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] 
On Behalf Of Boon Chew
Sent: Friday, March 03, 2006 3:41
PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] eval gone in
AS3, how to get reference to movieclip via target name?





Hi all,

With the _eval being gone in AS3, does anyone know how to get to the reference
of a movieclip (via the target name string) without using _eval (e.g.
_level0.mc1.mc2.mc3) ? I know we can instantiate an object
from a class name string via the _global namespace but not positive about mc's.

Thanks.

- boon







Yahoo! Mail
Bring photos to life! New
PhotoMail makes sharing a breeze. 







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt

Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com









  
  
SPONSORED LINKS
  
  
  


Web site design development
  
  

Computer software development
  
  

Software design and development
  
  



Macromedia flex
  
  

Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group flexcoders on the web.

  To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
.



  

















--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  









RE: [flexcoders] eval gone in AS3, how to get reference to movieclip via target name?

2006-03-05 Thread Matt Chotin










getClassByBame will return the Class, then
you can use new on it. Make sure you have any class that youd want to
instantiate linked in by having a typed variable for it though



Matt











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tom Bray
Sent: Saturday, March 04, 2006
5:22 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] eval
gone in AS3, how to get reference to movieclip via target name?





I have a question that's
almost related.

In AS3, how can I instantiate a class, com.foo.MyClass, using the string
com.foo.MyClass? The reason I ask is that I'd like to load an
XML file and use it to dynamically create components at runtime.
Something like this: 

components
 component className=com.foo.MyClass x=100
y=100/
 component className=com.foo.MyClass x=100
y=100/ 
/components

Thanks,

Tom



On 3/3/06, Gordon Smith [EMAIL PROTECTED] wrote:






Whoa not only is there no eval(), there's no _target, no
_level0, and no _global! Plus, you should almost always use Sprite instead of
MovieClip.



So what are you really trying to do? Are you using Flex or
just pure AS3? Where are you getting a string like
sprite1.sprite2.sprite3 from? Why do you have to transform it back
into a Sprite reference? Could you have just kept the reference instead of the
string?



- Gordon











From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On Behalf Of Boon Chew
Sent: Friday, March 03, 2006 3:41
PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] eval gone in
AS3, how to get reference to movieclip via target name?









Hi all,

With the _eval being gone in AS3, does anyone know how to get to the reference
of a movieclip (via the target name string) without using _eval (e.g.
_level0.mc1.mc2.mc3) ? I know we can instantiate an object
from a class name string via the _global namespace but not positive about mc's.

Thanks.

- boon







Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze. 


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com







SPONSORED
LINKS 




 
  
  Web site design development 
  
  
  Computer software development 
  
  
  Software design and development 
  
 
 
  
  Macromedia flex 
  
  
  Software development best practice 
  
  
  
  
 










YAHOO!
GROUPS LINKS





 Visit your group flexcoders
 on the web.
  
 To unsubscribe from this group, send an
 email to:
  [EMAIL PROTECTED]
 
 Your use of Yahoo! Groups is subject to the
 Yahoo! Terms
 of Service .

























--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











RE: [flexcoders] eval gone in AS3, how to get reference to movieclip via target name?

2006-03-04 Thread Boon Chew



I am not using Flex, I am mostly curious what I would have to do to my existing Flash actionscript code when AS3 is out for Flash.Gordon Smith [EMAIL PROTECTED] wrote:Whoa not only is there no eval(),  there's no _target, no _level0, and no _global! Plus, you should almost always  use Sprite instead of MovieClip.So what are you really trying to do? Are  you using Flex or just pure AS3? Where are you getting a string like "sprite1.sprite2.sprite3"  from? Why do you have to transform it back into a Sprite reference? Could you have  just kept the reference instead of the string?- GordonFrom: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Boon Chew  Sent: Friday, March 03, 2006 3:41  PM  To: flexcoders@yahoogroups.com  Subject: [flexcoders] eval gone in  AS3, how to get reference to movieclip via target name?Hi all,With the _eval being gone in AS3, does anyone know how to get to the reference  of a movieclip (via the target name string) without using _eval (e.g.  "_level0.mc1.mc2.mc3") ? I know we can instantiate an object  from a class name string via the _global namespace but not positive about mc's.Thanks.- boonYahoo! Mail  Bring photos to life! New  PhotoMail makes sharing a breeze.   
		Brings words and photos together (easily) with 
PhotoMail  - it's free and works with Yahoo! Mail.





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





  




  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  









RE: [flexcoders] eval gone in AS3, how to get reference to movieclip via target name?

2006-03-03 Thread Gordon Smith










Whoa not only is there no eval(),
there's no _target, no _level0, and no _global! Plus, you should almost always
use Sprite instead of MovieClip.



So what are you really trying to do? Are
you using Flex or just pure AS3? Where are you getting a string like sprite1.sprite2.sprite3
from? Why do you have to transform it back into a Sprite reference? Could you have
just kept the reference instead of the string?



- Gordon











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Boon Chew
Sent: Friday, March 03, 2006 3:41
PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] eval gone in
AS3, how to get reference to movieclip via target name?





Hi all,

With the _eval being gone in AS3, does anyone know how to get to the reference
of a movieclip (via the target name string) without using _eval (e.g.
_level0.mc1.mc2.mc3) ? I know we can instantiate an object
from a class name string via the _global namespace but not positive about mc's.

Thanks.

- boon







Yahoo! Mail
Bring photos to life! New
PhotoMail makes sharing a breeze. 







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











RE: [flexcoders] eval()

2005-11-22 Thread Merrill, Jason










Yeah, [].



And good riddance to eval().



Jason
Merrill | E-Learning Solutions |
icfconsulting.com 






















From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Philippe Maegerman
Sent: Tuesday, November 22, 2005
4:22 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] eval()





I see in the doc that eval() has been removed in AS3, is there any
equivalent ?
//Philippe
















NOTICE:
This message is for the designated recipient only and may 
contain privileged or confidential information. If you have received it in 
error, please notify the sender immediately and delete the original.Any 
other use of this e-mail by you is prohibited.






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.