0 Replies - 1049 Views - Last Post: 28 December 2008 - 09:05 PM

#1 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1469
  • View blog
  • Posts: 8,173
  • Joined: 07-September 06

Simple Hyperlink

Posted 28 December 2008 - 09:05 PM

Description: Add the script to your Flash AS 2.0 file and it should work. Example included. EnjoyThe name says it all, create a simplistic hyperlink that acts like one seen in basic html webpages. There is a bit of added stuff to it, but nothing overly complex
function link(destination:MovieClip, linkName:String, linkStyle:Object, url:String){
	var depth:Number = _root.getNextHighestDepth();
	var mc:MovieClip = _root.createEmptyMovieClip(linkName+""+depth, depth);
		mc.style = linkStyle;
		mc._x = linkStyle.tx;
		mc._y = linkStyle.ty;
		mc.goto = url;
	var link:TextField = mc.createTextField("link", 1, 0, 0, 0, 0);
	link.text = linkName;
	link.textColor = linkStyle.standardColor;
	link.thickness = linkStyle.standardThickness;
	link.autoSize = true;
	mc.onRollOver = function(){
		link.textColor = this.style.overColor;
	}
	mc.onRollOut = function(){
		link.textColor = this.style.standardColor;
	}
	mc.onmousedown = function(){
		link.textColor = this.style.downColor;
	}
	mc.onmouseup = function(){
		this.style.standardColor = this.style.visitedColor;
		this.onRollOut();
		getURL(this.goto);
	}
}

var obj:Object = new Object();
	obj.standardColor = 0x00000000;
	obj.overColor = 0x00ff0000;
	obj.visitedColor = 0x0000ff00;
	obj.downColor = 0x00ff00ff;
	obj.tx = 45;
	obj.ty = 100;
link(_root, "Clicky!", obj, "http://www.google.com");


Is This A Good Question/Topic? 0
  • +

Page 1 of 1