[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Triangle Information

Posted on 2003-11-13
1
Medium Priority
?
301 Views
Last Modified: 2010-04-03
Continuing from http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_20793393.html

I need to put a mouse over the triangle and somewhere URL should be shown, or some infor about triangle taken from trinagles.xml
0
Comment
Question by:valentin_v
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 27

Accepted Solution

by:
negatyve earned 2000 total points
ID: 9743569
try this:


BOXES.XML
============================================
<?xml version="1.0" encoding="UTF-8"?>
<boxes>
      <item
            thickness="1" rgb="002040" alpha="100"
            mx="140" my="10"
            x1="160" y1="10"
            x2="160" y2="100"
            x3="140" y3="100"
            x4="140" y4="10" />
      <item
            thickness="1" rgb="002040" alpha="100"
            mx="180" my="10"
            x1="260" y1="10"
            x2="260" y2="100"
            x3="180" y3="100"
            x4="180" y4="10" />
</boxes>
============================================


TRIANGLES.XML
============================================
<?xml version="1.0" encoding="UTF-8"?>
<triangles>
      <item
            link="http://www.altavista.com/" target="_blank"
            info="wow!, nice portal"
            thickness="1" rgb="002040" alpha="100"
            mx="100" my="130"
            x1="358" y1="130"
            x2="358" y2="260"
            x3="100" y3="130" />
      <item
            link="http://www.yahoo.com/" target="_self"
            info="yeah, what a good (sic) search engine!"
            thickness="2" rgb="FFCC00" alpha="20"
            mx="400" my="130"
            x1="663" y1="130"
            x2="400" y2="232"
            x3="400" y3="130" />
</triangles>
============================================


FLASH MOVIE
============================================
triangles_xml = new XML();
triangles_xml.path = this;
triangles_xml.ignoreWhite = true;
triangles_xml.onLoad = function(ok)
{
      if (ok) {
            this.triangles = this.firstChild.childNodes;
            this.drawTriangles();
            clearInterval(this.loadID);
            this.loadID = setInterval(this, "updateData", 5000);
      } else {
            trace("XML FILE NOT FOUND");
      }
};
triangles_xml.updateData = function()
{
      for (var i = 0; i < this.triangles.length; i++)this.path["tre" + i].removeMovieClip();
      delete this.triangles;
      this.load("triangles.xml");
};
triangles_xml.drawTriangles = function()
{
      for (var i = 0; i < this.triangles.length; i++) {
            var pen = this.path.createEmptyMovieClip("tre" + i, i);
            var attributes = this.triangles[i].attributes;
            pen.lineStyle(attributes.thickness, parseInt(attributes.rgb, 16), attributes.alpha);
            pen.moveTo(attributes.mx, attributes.my);
            pen.beginFill(parseInt(attributes.rgb, 16), attributes.alpha);
            for (var j = 1; j < 4; j++)pen.lineTo(attributes["x" + j], attributes["y" + j]);
            pen.endFill();
            pen.__target = attributes.target;
            pen.__link = attributes.link;
            // --- ADDED CODE ----------------------
            pen.__info = attributes.info;
            // -------------------------------------
            pen.onRelease = function()
            {
                  this.getURL(this.__link, this.__target);
            };
            // --- ADDED CODE ----------------------
            pen.onRollOver = function()
            {
                  this._parent.info_txt.text = this.__info;
                  this._parent.info_txt._visible = true;
            };
            pen.onRollOut = function()
            {
                  this._parent.info_txt.text = "";
                  this._parent.info_txt._visible = false;
            };
            // -------------------------------------
      }
};
triangles_xml.load("triangles.xml");
boxes_xml = new XML();
boxes_xml.path = this;
boxes_xml.ignoreWhite = true;
boxes_xml.onLoad = function(ok)
{
      if (ok) {
            this.boxes = this.firstChild.childNodes;
            this.drawBoxes();
            clearInterval(this.loadID);
            this.loadID = setInterval(this, "updateData", 5000);
      } else {
            trace("XML FILE NOT FOUND");
      }
};
boxes_xml.updateData = function()
{
      for (var i = 0; i < this.boxes.length; i++)this.path["box" + i].removeMovieClip();
      delete this.boxes;
      this.load("boxes.xml");
};
boxes_xml.drawBoxes = function()
{
      for (var i = 0; i < this.boxes.length; i++) {
            var pen = this.path.createEmptyMovieClip("box" + i, i + 1000);
            var attributes = this.boxes[i].attributes;
            pen.lineStyle(attributes.thickness, parseInt(attributes.rgb, 16), attributes.alpha);
            pen.moveTo(attributes.mx, attributes.my);
            for (var j = 1; j < 5; j++)pen.lineTo(attributes["x" + j], attributes["y" + j]);
      }
};
boxes_xml.load("boxes.xml");

// --- ADDED CODE ----------------------
function createsMyText()
{
      this.createTextField("info_txt", 10000, 0, 0, 200, 1)
      this.info_txt.border = this.info_txt.background = true;
      this.info_txt.autoSize = true;
      this.info_txt._visible = false;
}
createsMyText()
// -------------------------------------
============================================
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question