Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating links for my external xml buttons

Status
Not open for further replies.

nightboat1979

Technical User
Aug 5, 2007
5
US
can someone help me, i need to know how to create a link. I have buttons in my site and the graphics are being called into the flash movie through the use of an external xml file. Heres a look at what ive got below for XML, i think its in this file i should be putting the link and cant seem to find out/figure out what i should be doing. Please help me, i really want to get moving on this little project.

<icons>
<icon image="icon1.png" tooltip="Wildlife" />
<icon image="icon2.png" tooltip="Landscapes" />
<icon image="icon3.png" tooltip="Architecture" />
<icon image="icon4.png" tooltip="Experimental" />
<icon image="icon5.png" tooltip="Seascapes" />
<icon image="icon6.png" tooltip="Macro" />
</icons>

heres a link to my page ive created, i simply want to make the pictures clickable to links of my choosing.


If the flash file is required you can download the source from my site at the follwoing address:


if that doesnt work, maybe decompile it with soThink or something. Hope someone has some answers to help me?
 
No need to decompile!

Try these:

1. Add link URL to your XML. So it looks like this:
Code:
...
<icon image="icon1.png" tooltip="Wildlife" [b]link="[URL unfurl="true"]http://www.google.com/"[/URL][/b] />
...
2. In the [tt]for[/tt] loop in your [tt]xml.onLoad[/tt] function, add this line:
Code:
...
_loc2.icon.onRelease = released;
[b]_loc2.link = _loc4[_loc3].attributes.link;[/b]
...
3. Add this new function:
Code:
...
function mover() {
...
}
[b]function released() {
	getURL(this._parent.link);
}[/b]

Kenneth Kawamoto
 
Thanks for the help, i shall try the techniques mentioned above when i get home from work, and failing that i shall send you a zipped file, thank-you very much for helping me on this!
 
I added the code, and it makes it "nearly" work, when i click the buttons it says basically it cannot find the link "make sure path or internet address is correct", even although i am targeting a file that is within the root folder where the parent file is. Here is a look at my entire actionscript

function over()
{
var _loc2 = new Sound();
_loc2.attachSound("sover");
_loc2.start();
home.tooltip.tipText.text = this._parent.toolText;
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height / 2;
home.tooltip.onEnterFrame = mx.utils.Delegate.create(this, moveTip);
home.tooltip._alpha = 100;
} // End of the function
function out()
{
delete home.tooltip.onEnterFrame;
home.tooltip._alpha = 0;
} // End of the function
function moveTip()
{
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y - this._parent._height / 2;
} // End of the function
function mover()
{
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var _loc2 = (this._y - perspective) / (centerY + radiusY - perspective);
this._xscale = this._yscale = _loc2 * 100;
this.angle = this.angle + this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 100);

}

function released() {
getURL(this._parent.link);
}

// End of the function
var numOfItems;
var radiusX = 250;
var radiusY = 50;
var centerX = Stage.width / 2;
var centerY = Stage.height / 2 + 30;
var speed = 1.000000E-003;
var perspective = 150;
var home = this;
theText._alpha = 0;
var tooltip = this.attachMovie("tooltip", "tooltip", 10000);
tooltip._alpha = 0;
var xml = new XML();
xml.ignoreWhite = true;
xml.onLoad = function ()
{
var _loc4 = this.firstChild.childNodes;
numOfItems = _loc4.length;
for (var _loc3 = 0; _loc3 < numOfItems; ++_loc3)
{
var _loc2 = home.attachMovie("item", "item" + _loc3, _loc3 + 1);
_loc2.angle = _loc3 * (6.283185E+000 / numOfItems);
_loc2.onEnterFrame = mover;
_loc2.toolText = _loc4[_loc3].attributes.tooltip;
_loc2.content = _loc4[_loc3].attributes.content;
_loc2.icon.inner.loadMovie(_loc4[_loc3].attributes.image);
_loc2.r.inner.loadMovie(_loc4[_loc3].attributes.image);
_loc2.icon.onRollOver = over;
_loc2.icon.onRollOut = out;
_loc2.icon.onRelease = released;
_loc2.icon.onRelease = released;
_loc2.link = _loc4[_loc3].attributes.link;
} // end of for
};
xml.load("icons.xml");
this.onMouseMove = function ()
{
speed = (this._xmouse - centerX) / 2500;
};


and the file you see here is in the same folder as the other things, it wouldnt even find google when i tried that

<icons>

<icon image="icon1.png" tooltip="Wildlife" link="photos.html" />

<icon image="icon2.png" tooltip="Landscapes" link="photos2.html" />

<icon image="icon3.png" tooltip="Architecture" link="photos3.html" />

<icon image="icon4.png" tooltip="Experimental" link="photos4.html" />

<icon image="icon5.png" tooltip="Seascapes" link="photos5.html" />

<icon image="icon6.png" tooltip="Macro" link="photos6.html" />

</icons>

any ideas, thanks for the help youve given already! I can see definet progress and im even beginning to get a better understanding of this

 
hey guys, its ok, it now seems to "work" weirdly, dont know what i really changed, but if it aint broke, dont fix it, thanks ALOT for all the great help! this is awesome!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top