[worldKit-dev] split summary and title into separat textboxes and different positions

mik Nix pampas21 at hotmail.com
Mon Feb 5 08:49:20 PST 2007


Hi im splitting up title and summary into two separate textboxes and 
positioning them "title" alongside the annotation marker and "summary" in 
the bottom of the screen alongside the toolbox and this all works fine but 
the problem now is when I zoom in the text box with the summary text gets 
the "wrong" position. i would like to get it to stay positioned in the 
bottom of the screen alongside the toolbar at all times like when you use 
the singletextfield it it is always positioned in the top of the screen and 
the textbox with the title continue to be shown alongside the anotation mark 
..? is this possible with 2 textboxes ?

Br.
/Mikael

    ps. this is the code i use:

     public function makeText():Void {
	if (conf.singletextfield != true) {
	    mc.createEmptyMovieClip(textname, depth+10000); //REVISIT places 10000 
plot limit
	    mc[ textname ].annotation = this;
	    mc[ textname ]._visible = 0;

	    var w = mc.origwidth; var h = mc.origheight;
	    var textx = x; var texty = y;
	    var rescale = (100/interact.scale);
	    var textboxsize = conf.textboxsize;
	    if (precompile) {
		rescale = rescale * (w/conf.h);
		textboxsize = textboxsize * (100/conf.h);
	    }

	    // should maybe try to position this to the right of the point, or 
dynamically dependent on zoom)
	    if (w - x < textboxsize) { textx = x - (textboxsize / interact.scale); 
}
	    if (h - y < 100) { texty = y - (50 / interact.scale); }

	    mc[ textname ]._x = textx; if (textx != x) { mc[textname].leftpos = 
true; }
	    mc[ textname ]._y = texty; if (texty != y) { mc[textname].bottompos = 
true; }

	    mc[textname]._xscale = scale;
	    mc[textname]._yscale = scale;

	    if (photo != "" && photo != undefined) {
		mc[textname].createEmptyMovieClip("image",100000); //REVISIT 100000
		mc[textname].image.loadMovie(photo);
	    } else {
		//var htmlText = "<font color=\"#555555\" face=\"Verdana,Arial,_sans\" 
size=\"" + conf.textsize + "\"><b>" + title + "</b><br>" + summary + 
"</font>";
		var htmlText = "<font color=\"#ffffff\" face=\"Verdana,Arial,_sans\" 
size=\"" + conf.textsize + "\"><b>" + title + "</b></font>";
		var textheight = 100;
		if (conf.textboxsize != 0) {
		    mc[textname].createTextField("text",1,0,0,textboxsize,textheight);
		    mc[textname].text.html = true; //REVISIT this might be trouble with 
non-roman chars
		    mc[textname].text.multiline = true;
		    mc[textname].text.wordWrap = true;
		    mc[textname].text.border = true;
		    mc[textname].text.autoSize ="center";
		    mc[textname].text.background = false;
		    mc[textname].text.backgroundColor = 0xFFFFFF;
		    mc[textname].text.htmlText = htmlText;
		//}

//------------------------------------------------------------------------------
var TextBox2PosW ;
var TextBox2PosH ;
var MoveBox2Right;
var zoomscale;
zoomscale = this.x
//TextBox2PosH = mc.origheight - mc[clipname]._y - 100
//TextBox2PosW =  (mc.origwidth/2) - mc[clipname]._x //conf.w - (conf.w/2)// 
mc[clipname]._x - (conf.w/2) //- this.x
//----------------
MoveBox2Right = w/2
TextBox2PosH =  ( - mc.origheight/20) - mc[clipname]._y + (25 )//- 
zoomscale) // textheight
		if (w - this.x < textboxsize) { TextBox2PosW = ( w - mc[clipname]._x - w + 
textboxsize + MoveBox2Right); //this.x - (textboxsize / this.conf.scale);
			}else{TextBox2PosW = ( w - mc[clipname]._x  - w  + MoveBox2Right)  ;
		}
	    var htmlText2 = "<font color=\"#555555\" face=\"Verdana,Arial,_sans\" 
size=\"" + conf.textsize + "\"><b></b><br>" + summary + "</font>";
	    var textheight2 = 2;

		if (this.conf.textboxsize != 0) {

		mc[textname].createTextField("text2",mc[textname].getNextHighestDepth(),TextBox2PosW 
,TextBox2PosH,200,textheight2);

			//mc[textname].createTextField("text2",mc[textname].getNextHighestDepth(),550 
,550,200,textheight2);
		    mc[textname].text2.html = true;
		    mc[textname].text2.multiline = true;
		    mc[textname].text2.wordWrap = true;
		    mc[textname].text2.border = true;
		    mc[textname].text2.autoSize ="center";
		    mc[textname].text2.background = true;
		    mc[textname].text2.backgroundColor = 0xffffff;
		    mc[textname].text2.htmlText = htmlText2;
			 }

			  }
		//-----------------------------


	    }

_________________________________________________________________
Världen bevakas på MSN http://nyheter.msn.se/




More information about the worldkit-dev mailing list