…bit stuck on something here and hoping that someone will be able to answer this question.
i have a gallery generated via xml - i have three text fields on the stage that display the title and description of the thumbnail item.
tn_title.text = "";
tn_desc.text = "";
tn_url.text = "";
I want to make the textfields into a ‘tooltip’ as opposed to appearing in the same place everytime - ideally within a few pixels of the thumbnail or the mouse. the latter might be the easier.
so i have put the three text fields into an MC and called it tip.
tip.tn_title.text = "";
tip.tn_desc.text = "";
tip.tn_url.text = "";
this works ok when the MC ‘tip’ is sitting on the stage. But the question is how do i get the MC to appear next to the thumbnail/mouse when a thumbnail is moused over?
here is the full shabang i highlighted the rows that i think are the relevant ones…
*/
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.Sprite;
import flash.events.MouseEvent;
var container:Sprite = new Sprite();
container.x = 400;
container.y = 300;
addChild(container);
var scene:Scene3D = new MovieScene3D(container);
var cam:Camera3D = new Camera3D();
cam.zoom = 6;
**tip.tn_title.text = "";
tip.tn_desc.text = "";
tip.tn_url.text = "";**
var p_dict:Dictionary=new Dictionary();
var pc:Plane = new Plane();
pc.visible = false;
cam.target = pc;
var numOfRotations:Number = 3;
var yPos:Number = 0;
var angle:Number = 0;
var filename_list = new Array();
var url_list = new Array();
var url_target_list:Array = new Array();
var rel_list:Array = new Array();
var title_list = new Array();
var description_list = new Array();
var folder:String = "thumbnails/";
var i:Number;
var j:Number = 0;
var k:Number = 0;
var l:Number = 0;
var m:Number = 0;
var total:Number;
var flashmo_xml:XML = new XML();
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("thumbnail_list_3.xml"));
loader.addEventListener(Event.COMPLETE, create_thumbnail);
function create_thumbnail(e:Event):void
{
flashmo_xml = XML(e.target.data);
total = flashmo_xml.thumbnail.length();
var anglePer:Number = ((Math.PI*2) * numOfRotations) / total;
** for( i = 0; i < total; i++ )
{
url_list.push( flashmo_xml.thumbnail*.@url.toString() );
url_target_list.push( flashmo_xml.thumbnail*.@target.toString() );
rel_list.push( flashmo_xml.thumbnail*.@rel.toString() );
title_list.push( flashmo_xml.thumbnail*.@title.toString() );
description_list.push( flashmo_xml.thumbnail*.@description.toString() );
var bfm:BitmapFileMaterial = new BitmapFileMaterial(
folder + flashmo_xml.thumbnail*.@filename.toString());
bfm.oneSide = false;
bfm.smooth = true;
var p:Plane = new Plane(bfm, 140, 105, 2, 2);
scene.addChild(p);
var p_container:Sprite = p.container;
p_container.name = "flashmo_" + i;
p_dict[p_container] = p;
p_container.buttonMode = true;
p_container.addEventListener( MouseEvent.ROLL_OVER, p_rollover );
p_container.addEventListener( MouseEvent.ROLL_OUT, p_rollout );
p_container.addEventListener( MouseEvent.CLICK, p_click );
p.rotationY = (-i*anglePer) * (180/Math.PI) + 90;
p.x = Math.cos(i * anglePer) * 480;
p.z = Math.sin(i * anglePer) * 480;
p.y = yPos;
if( (i+1) % 20 == 0 )
{
yPos += 115;
}
}
}
function p_rollover(me:MouseEvent)
{
var sp:Sprite = me.target as Sprite;
var tw:Tween = new Tween(sp, 'alpha', Strong.easeOut, 1, 0.5, 0.6, true);
var s_no:Number = parseInt(sp.name.slice(8,10));
tip.tn_title.text = title_list[s_no];
tip.tn_desc.text = description_list[s_no];
tip.tn_url.text = url_list[s_no];
}
function p_rollout(me:MouseEvent)
{
var sp:Sprite = me.target as Sprite;
var tw:Tween = new Tween(sp, 'alpha', Strong.easeOut, 0.5, 1, 0.6, true);
tip.tn_title.text = "";
tip.tn_desc.text = "";
tip.tn_url.text = "";
}**
var script:XML =
<script>
<![CDATA[
function(url, title_list, description_list, rel_list)
{
myLightWindow.activateWindow({href: url,
title: title_list});
}
]]>
</script>;
function p_click(me:MouseEvent)
{
var sp:Sprite = me.target as Sprite;
var s_no:Number = parseInt(sp.name.slice(8,10));
trace("rel is '"+rel_list[s_no]+"'");ExternalInterface.call(script, url_list[s_no], title_list[s_no], description_list[s_no], rel_list[s_no]);
}
addEventListener(Event.ENTER_FRAME, render);
function render(e:Event):void
{
var dist2:Number = ((stage.mouseX) - 400) * 0.0001;
angle += dist2;
cam.x = - Math.cos(angle) * 150;
cam.z = Math.sin(angle) * 150;
var new_zoom = 5;
cam.zoom += ( new_zoom - cam.zoom ) * 0.06;
scene.renderCamera(cam);
}
not quite sure of the best/easiest way is to do it - call from the library and attach to mouse or something along those lines?
anyone ideas anyone??