{"id":1842,"date":"2010-11-15T10:24:59","date_gmt":"2010-11-15T10:24:59","guid":{"rendered":"http:\/\/mts-help.nick.php.dev\/after_sale_support\/Working_with_SWISHMax\/article4.html"},"modified":"2020-02-06T10:24:38","modified_gmt":"2020-02-06T15:24:38","slug":"assigning-links","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/assigning-links.html","title":{"rendered":"SwishMax. Assigning Links"},"content":{"rendered":"<p>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.<\/p> <p>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 <span style=\"FONT-WEIGHT: bold\">&#8220;Panels\/Script&#8221;<\/span> from the top menu. If this button item already has the rollover effect, you can see the following script in the actions panel:<\/p> <div class=\"example_code\"> <br \/>on (rollOver) { <br \/>gotoAndPlay(2); <br \/>playSound(&#8220;But.wav&#8221;); <br \/>} <br \/>on (rollOut) { <br \/>gotoAndPlay(18); <br \/>} <br \/> <br \/><\/div> <p>&nbsp;<\/p> <p>If you want to connect this button with an external URL you can use the getURL() script function. If you&#8217;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:<\/p> <div class=\"example_code\"> <br \/>on (rollOver) { <br \/>gotoAndPlay(2); <br \/>playSound(&#8220;But.wav&#8221;); <br \/>} <br \/>on (rollOut) { <br \/>gotoAndPlay(18); <br \/>} <br \/>on (release) { <br \/>getURL(&#8220;http:\/\/www.mywebsite.com&#8221;,&#8221;_self&#8221;,&#8221;GET&#8221;); <br \/>} <br \/> <br \/><\/div> <p>If you don&#8217;t use any rollover effects, you can use the on (release) event without the previous two events:<\/p> <div class=\"example_code\"> <br \/>on (release) { <br \/>getURL(&#8220;http:\/\/www.mywebsite.com&#8221;,&#8221;_self&#8221;,&#8221;GET&#8221;); <br \/>} <br \/> <br \/><\/div> <p>Let\u2019s look at the <span style=\"FONT-WEIGHT: bold\">getURL()<\/span> 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:<\/p> <span style=\"FONT-WEIGHT: bold\">_self<\/span> &#8211; this will open the file in the same frame or window. Note that you\u2019ll get the same effect if you just skip the Window option; <br \/> <span style=\"FONT-WEIGHT: bold\">_blank<\/span> &ndash; this will open a new browser window; <br \/> <span style=\"FONT-WEIGHT: bold\">_parent<\/span> &ndash; this will open the link in the same browser window regardless of frame settings; <br \/> <span style=\"FONT-WEIGHT: bold\">_top<\/span> &ndash; this will open the link in the top level frame. <p>Let&#8217;s check some examples of the getURL() function:<\/p> <div class=\"example_code\"> <br \/>getURL(&#8220;images\/myphoto.jpg&#8221;,&#8221;_blank&#8221;) <br \/> <br \/><\/div> <p>This will open the <span style=\"FONT-WEIGHT: bold\">photo.jpg<\/span> file located in the images folder in the popup window.<\/p> <div class=\"example_code\"> <br \/>getURL(\u201chttp:\/\/www.myfriendswebsite.com\u201d) <br \/> <br \/><\/div> <p>This will open the <span style=\"FONT-WEIGHT: bold\">http:\/\/www.myfriendswebsite.com<\/span> in the same window.<\/p> <div class=\"example_code\"> <br \/>getURL(&#8220;http:\/\/www.mywebsite.com\/mail.php&#8221;,&#8221;_self&#8221;,&#8221;GET&#8221;) <br \/> <br \/><\/div> <br \/>This will call the mail.php script located at the <span style=\"FONT-WEIGHT: bold\">http:\/\/www.mywebsite.com\/mail.php<\/span> and will transfer the variables info using the GET method. <br \/>If you want to connect a button with the JavaScript code, you can use the following function: <br \/> <br \/> <div class=\"example_code\"> <br \/>on (release) { <br \/>javascript(\u201calert(\u2018this is test\u2019)\u201d); <br \/>} <br \/> <br \/><\/div> <p>Quoted javascript() function argument should be the javascript code. The example above will execute the alert() javascript function.<\/p> <p>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:<\/p> <div class=\"example_code\"> <br \/>on (release) { <br \/>mailTo(&#8220;support@company.com&#8221;,&#8221;&#8221;,&#8221;This is the support question&#8221;,&#8221;&#8221;); <br \/>} <br \/> <br \/><\/div> <br \/> <span style=\"FONT-WEIGHT: bold\">See also:<\/span> <br \/> \r\n\r\n<p><a class=\"link3\" href=\"\/help\/wp-content\/uploads\/2011\/03\/SWiSHMax\/how_to_change_assign_link.htm\"><\/a> <\/p>","protected":false},"excerpt":{"rendered":"<p>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. [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[757,278],"tags":[521,574,573],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/1842"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=1842"}],"version-history":[{"count":2,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/1842\/revisions"}],"predecessor-version":[{"id":86431,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/1842\/revisions\/86431"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=1842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=1842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=1842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}