A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: [AS2] Class Parameters and eval ()

Threaded View

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    3

    [AS2] Class Parameters and eval ()

    What is happening here? Cuz I hav noooo clue, and been trying to figure it out for hours
    Flash Version 8.0.0
    Code:
    class Tile {
    	public var walkable:Boolean;
    	public var frame:Number
    	static var tile0, tile1, tileF:Object;
    	public function Tile (id:Number) {
    		var tile:Object = tileClass ("tile1");
    		walkable = tile.walkable;
    		frame = tile.frame;
    	        trace(tile) //outputs undefined
    	}
    	static function tileClass (str:String) {
    		tile0 = {walkable:true, frame:1}
    		tile1 = {walkable:false, frame:2}
    		tileF = {walkable:false, frame:20}
    	        trace (eval(str)); //outputs undefined
    	        trace (str); // outputs tile1
    	        trace(str==="tile1");// outputs true
    	        trace (eval("tile1")); // outputs [object][object]
    		return eval(str);
    	}
    }
    Feel free to copy and paste this and try it out, Thanks for any help I can get!
    Last edited by menewb; 04-30-2009 at 09:40 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center