Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Regarding BIG ISSUE #2:</strong></p> <p>I feel like I sort-of understand <code>localToGlobal</code>, but it is recording an <code>x</code> and <code>y</code> for each point that is way off the map. </p> <p>The parent map clip is 760 x 916 pixels (masked @ 400 x 600), however my code output is recording each dot's "<code>localToGlobal</code>" x value between 800 and 1600 – way off of the Stage. </p> <p>OnMouseOver in the Flash movie, each <code>dot._x</code> is recorded between 100 and 300, with the parent clip at 0,0 in the top left corner... So where is the 877 coming from? Is it factoring in that I am dynamically animating the parent clip's <code>_x</code>/<code>_y</code> and increasing the <code>_xscale</code>/<code>_yscale</code> (initially to 140)? </p> <p><strong><em>How does <code>_xscale</code>/<code>_yscale</code> affect localToGlobal x coordinates?</em></strong></p> <p>I added the suggested code where I initiate the dots (simultaneously looping through the XML hierarchy) – there are 2 loops, one for each XML category <code>[i]</code> and listing <code>[g]</code>. Admittedly, my code has gotten complicated. I tried passing Tooltip the same "destX" value I am using to move the map, but that didn't work – probably because I am passing values relative to the map itself, while the Tooltip is on the <code>_root</code>. Is that where <code>localToGlobal</code> is supposed to help?</p> <pre><code> /////* Map.as *///// private function initMap() { // contentArr = XML Array for(var i:Number = 0; i &lt; contentArr.length; i++){ categories = contentArr[i].childNodes; numCategories = categories.length; for(var g:Number = 0; g &lt; numCategories; g++){ dotIDs = categories[g].attributes.id; dot = map_mc[dotIDs]; // link dot movieClips on Stage to each XML listing dot.catNum = i; // category number - Arts [0], Shopping[1], etc. dot.listingNum = g; // each indiv. listing number pt = new Point(); // New code pt = eval('pt_' + i + '_' + g); //Appending cat/list numbers for unique ids ptArray.push(pt); ptArray['pt_' + i + '_' + g] = {x:dot._x, y:dot._y}; dot.localToGlobal(ptArray['pt_' + i + '_' + g]); } } } // ˘˘being called from externalInterface public function showTooltip(bt, catNum, listNum){ var newBT = eval(_root.mapContainer_mc.map_mc + '.' + bt); // so I don't have to use the entire path in HTML goto(newBT, catNum, listNum); } public function goto(bt, catNum, listNum){ // moves map, calls Tooltip.trickTip() destX = 0-(bt._x-(mask_mc._width/3)); destY = 0-(bt._y-(mask_mc._height/3)); if(destX &lt; 10-(map_mc._width-mask_mc._width)) destX = 10-(map_mc._width-mask_mc._width); if(destY &lt; 10-(map_mc._height-mask_mc._height)) destY = 10-(map_mc._height-mask_mc._height); if(destX &gt; 10) destX = 10; if(destY &gt; 10) destY = 10; TweenLite.to(map_mc, 1, {_x:destX, _y:destY, ease:'easeOutQuad', overwrite:3, onUpdate:trickTip, onUpdateParams:[ bt, catNum, listNum, /* theText*/ contentArr[catNum].childNodes[listNum].attributes.name ] }); } /////* Tooltip.as *///// public function trickTip(catNum:Number, listNum:Number, theText:String):Void { theTip._x = ptArray['pt_'+catNum+'_'+listNum].x; //Somewhere way off stage theTip._y = ptArray['pt_'+catNum+'_'+listNum].y; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload