Stick Flash Link (Action Script 3.0)

30.06.2011

Often, when creating a banner, you need not only to do a number of operations for a beautiful graphics animation, but you also need to make a ready-made flash link so that by clicking we can go to any page we need.

Work algorithm:

You need to create two layers:

1 layer named link contains: there will be a transparent rectangle overlaying the entire flush (and assigning a name to the mybanlink instance).

2nd layer named action contains: frame actions (F9).

banner

Code for the second layer.

mybanlink.addEventListener(MouseEvent.CLICK, mybanlinkClickListener);
function mybanlinkClickListener(e:MouseEvent):void {
    var url:String="http://www.web-article.com.ua";
    var urlRequest:URLRequest=new URLRequest(url);
    navigateToURL(urlRequest);
}

The navigateToURL function has 2 parameters:

1. Required, which must match the URLRequest data type

2. An optional parameter that determines whether the link will be opened in a new or current window. More precisely, there are 4 values for the second optional parameter of the URLRequest function:

# _blank - open a new window when clicking on the banner

# _parent - open the link in the same window

# _top - specifies the top-level frame in the current window

# _self - indicates the current frame in the current window


Last in our blog

Internet Marketing
04.11.2019