LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-12-2002, 02:44 AM
MixMatch's Avatar
MixMatch MixMatch is offline

Hyper Moderator
 
Join Date: Aug 2001
Location: Heidelberg, Germany
Posts: 1,789
Rep Power: 13
MixMatch is on a distinguished road
Lightbulb More intuitive "List Variables"

Hey all, if you ever wondered how to build your own "list variables", heres an example in action... note that my testing is limited and I have not seen how it performs with xml, loadvars, nor movies loaded into different levels of the movie. With that said, feel free to try it out and give me feedback:
Actionscript:
//global version of the function
_global.gListObjects = function(myTabs, myType) {
	if (this._name.length == 0 && typeof this == "movieclip") {
		trace("_root");
		myTabs = "\t";
	}
	for (var counter in this) {
		var myType = typeof this[counter];
		if (myType == "string") {
			trace(myTabs+counter+"=\""+this[counter]+"\"");
		} else if (myType == "number" || myType == "boolean") {
			trace(myTabs+counter+"="+this[counter]);
		} else if (myType == "function") {
			if (counter == "listObjects") {
				//this is invisible cuz I don't want it to always show
			} else {
				trace(myTabs+"function "+counter);
			}
		} else {
			trace(myTabs+myType+" "+counter);
			this[counter].listObjects(myTabs + "\t", myType);
		}
	}
};
//
//global function being attatched to all necessary objects
movieclip.prototype.listObjects = _global.gListObjects;
array.prototype.listObjects = _global.gListObjects;
object.prototype.listObjects = _global.gListObjects;
loadvars.prototype.listObjects = _global.gListObjects;
xml.prototype.listObjects = _global.gListObjects;
//
//setting a bunch of variables
this.time = 50;
this.createEmptyMovieClip("mc1", 1);
this.mc1.createTextField("textFiel", 1, 5, 5, 30, 10);
this.mc1.myArray = new Array(5, "TOM");
//
//actual function call
listObjects();
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question for a champion : "Global and local variables" onlytoine Flash 5 Actionscript 3 02-07-2002 10:05 AM




All times are GMT. The time now is 09:31 PM.