[worldKit-dev] geowiki mod

Markus Graeser god1 at gmx.net
Wed Mar 1 05:13:36 PST 2006


> > Thanks for the tips regarding worldkit. I had a short look now, and hope
> to
> > try your suggestions next week. However I'm on Linux, and can't really
> test
> > and debug Flash stuff.
> 
> There is a light at the end of this tunnel .. http://osflash.org. 

Thanks, I had a look at it, but as far as I understood, osflash is not
intended as a replacement for Flash development tools, just a collection of
free flash apps.

However, I coded "dry", so Mikel (or someone else with the right app), if
you could include the following code into worldkitInteraction.as, see if it
works, and send me the resulting swf, you'd make me really happy! :)

    public function SetupJavascript():Void {
	_root.JComm = "";
	_root.JSubComm = ""; 
	_root.JLayComm = "";
	_root.JLoadComm = "";
	_root.JRSSComm = "";
	_root.JZoomComm = "";
	_root.JActComm = "";
	_root.JAnnoComm = "";
	_root.JHackComm = "";
	_root.JInputComm = "";
	_root.JGetItemComm = "";
	_root.watch("JComm",worldkitInteraction.onJavascript,this);
	_root.watch("JSubComm", worldkitInteraction.onJavascript,this);
	_root.watch("JLayComm", worldkitInteraction.onJavascript,this);
	_root.watch("JLoadComm", worldkitInteraction.onJavascript,this);
	_root.watch("JRSSComm", worldkitInteraction.onJavascript,this);
	_root.watch("JZoomComm", worldkitInteraction.onJavascript,this);
	_root.watch("JActComm", worldkitInteraction.onJavascript,this);
	_root.watch("JAnnoComm", worldkitInteraction.onJavascript,this);
	_root.watch("JHackComm", worldkitInteraction.onJavascript,this);
	_root.watch("JInputComm", worldkitInteraction.onJavascript,this);
	_root.watch("JGetItemComm", worldkitInteraction.onJavascript,this);
	}


//switch config option <inputonly> to newVal ("true" or "false")
	 public function onJInputComm(newVal) {
	 	var val = false;
	 	if (newVal == "true")
			val = true;
	 	conf.inputonly = val;
		acceptInput = val;
	 }

//looks for an element with uid, if exists calls js function gotItem(item)
//item is a string which contains (title, url, description, tags, coords,
geoType)
//all elements are separated by the string "<separatorTag>"
	 public function onJGetItemComm(uid) {
	 	var item = rss.Points[uid];
		if (item == undefined)
			return;
		var s = "<separatorTag>";
		var cats = item.cats.join(",");
		var coords = item.vector;
		if (item.vtype != "poly" && item.vtype != "line")
			coords = String(item.lat) + "," + String(item.lon);
		var itemString = item.title + s + item.url + s + item.summary + s + cats +
s + coords + s + item.vtype;
		getURL( "javascript:gotItem" + "(\"" + itemString + "\")" );
	 }
	 
	 
SetupJavascript() is already there, I only extended it by two more
variables, JInputComm and JGetItemComm.

onJInputComm(newVal) is new and supposed to trigger the <inputonly> option

onJGetItemComm(uid) is new and supposed to receive a unique id and return
data of the respective item. The data transfer is done by calling
javascript:gotItem (what happens if that doesn't exist?) which receives a
string with some of the item's fields, separated by a separator
"<separatorTag>". It's not very elaborated, but hopefully works.

And it's the first time I look at actionscript, so please excuse any stupid
errors.

Thanks a lot, regards,
Markus


-- 
Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl



More information about the worldkit-dev mailing list