- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
SwishMax. Assigning Links
November 15, 2010
During the customization of your SWiSH movie you may need to assign links to the button elements. These links can open new pop pages, surf through the pages of your website, open the image preview or send a contact letter. All these features can be added by assigning the appropriate script to the button element.
Select the button element by clicking it with the Select tool on the Layout panel, or by selecting it from the Outline or Timeline panels. When the appropriate button item is selected you should switch to the Script panel. To open the Script panel you can select “Panels/Script” from the top menu. If this button item already has the rollover effect, you can see the following script in the actions panel:
on (rollOver) {
gotoAndPlay(2);
playSound(“But.wav”);
}
on (rollOut) {
gotoAndPlay(18);
}
If you want to connect this button with an external URL you can use the getURL() script function. If you’re assigning this function to the button you should use the on (release) event. So, the rollover script with the added link will look like this:
on (rollOver) {
gotoAndPlay(2);
playSound(“But.wav”);
}
on (rollOut) {
gotoAndPlay(18);
}
on (release) {
getURL(“http://www.mywebsite.com”,”_self”,”GET”);
}
If you don’t use any rollover effects, you can use the on (release) event without the previous two events:
on (release) {
getURL(“http://www.mywebsite.com”,”_self”,”GET”);
}
Let’s look at the getURL() function closer. The first attribute is the absolute or relative URL of the file to be loaded; the second attribute is the Window. You can specify the target frame name to which you will load the file. Or you can use some of the default window options:
_self – this will open the file in the same frame or window. Note that you’ll get the same effect if you just skip the Window option;_blank – this will open a new browser window;
_parent – this will open the link in the same browser window regardless of frame settings;
_top – this will open the link in the top level frame.
Let’s check some examples of the getURL() function:
getURL(“images/myphoto.jpg”,”_blank”)
This will open the photo.jpg file located in the images folder in the popup window.
getURL(“http://www.myfriendswebsite.com”)
This will open the http://www.myfriendswebsite.com in the same window.
getURL(“http://www.mywebsite.com/mail.php”,”_self”,”GET”)
This will call the mail.php script located at the http://www.mywebsite.com/mail.php and will transfer the variables info using the GET method.
If you want to connect a button with the JavaScript code, you can use the following function:
on (release) {
javascript(“alert(‘this is test’)”);
}
Quoted javascript() function argument should be the javascript code. The example above will execute the alert() javascript function.
If you want to connect your button with an e-mail address, you can use the mailto() function. This function is similar to the mailto link option in the HTML. The following example will call the default mail agent and fill the address and subject fields:
on (release) {
mailTo(“support@company.com”,””,”This is the support question”,””);
}
See also: