[worldKit-dev] worldkit-dev Digest, Vol 16, Issue 4

Mikel Maron mikel_maron at yahoo.com
Wed Feb 7 13:13:07 PST 2007


I suggest following the flow for singletextfield. 

-Create a new config option for your case. 

- In worldkitAnnotation.makeText, check if the config option is set, and only add the title to the annotation

- In worldkitAnnotation.showtext and worldkitAnnotation.hidetext, if the config option is set call  your new function in worldkitInteraction.

- In worldkitInteraction, create a new function based on worldkitInteraction.LoadingDialog.


This kind of structure will insure that the text box is placed correctly. 

This is a pretty rough sketch, so ask any questions if you need help filling in the details.

-Mikel

----------------------------------------------------------------------

Message: 1
Date: Mon, 05 Feb 2007 17:49:20 +0100
From: "mik Nix" <pampas21 at hotmail.com>
Subject: [worldKit-dev] split summary and title into separat textboxes
    and    different positions
To: worldkit-dev at lists.brainoff.com
Message-ID: <BAY123-F364397D78DB58BCC83E13FD2980 at phx.gbl>
Content-Type: text/plain; charset=iso-8859-1; format=flowed

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/



------------------------------

_______________________________________________
worldkit-dev mailing list
worldkit-dev at lists.brainoff.com
http://lists.brainoff.com/listinfo.cgi/worldkit-dev-brainoff.com


End of worldkit-dev Digest, Vol 16, Issue 4
*******************************************




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.brainoff.com/pipermail/worldkit-dev-brainoff.com/attachments/20070207/c3ae63b5/attachment-0001.html>


More information about the worldkit-dev mailing list