View Full Version : how to create a link in Flash CS4
karmstrn
02-03-2009, 04:30 PM
I downloaded a trial version of Flash CS4 and have been able to find answers to most of my questions online so far, but right now I can't even find how to make a button into a link. All I want to do is be able to put in the page information that I want the button to link to. Can anyone help me with this simple problem?
SrihariCh
02-04-2009, 10:11 AM
First create a Textbox on the stage, Select type of "Dynamic text" from Properties Inspector(which is available from Window menu-> Properties->Properties),create instance for this Textbox. Now open "Actions" panel and add the following code which creates a hyperlink to open the google Homepage:
Suppose we create textbox of DynamicText with instance "textbox1_txt", then
const DOMAIN_URL:String = "http://www.google.com";
var linkTxt:TextField = new TextField(); //Temporary variable
textbox1_txt.addEventListener(TextEvent.LINK, linkHandler);
linkTxt.text = createLink(DOMAIN_URL);
textbox1_txt.htmlText=linkTxt.text;
function createLink(url:String):String
{
var link:String = "";
link = "<font color='#0000FF'><u><b><a href='event:" + url + "'>" + textbox1_txt.text + "</a></b></u></font>";
return link;
}
function linkHandler(e:TextEvent):void
{
var request:URLRequest = new URLRequest(e.text);
navigateToURL(request);
}
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.