Send to printer
-by Luka

With the Properties panel still showing that the button is selected, click inside the Actions panel ¡ˇěC inside the area the code is written in. Type the following code:

on (release) {
getURL("http://www.flashexplained.com/", "_blank");
}

You will notice that as soon as you type the first word, followed by a parenthesis:

on (

Flash will pop-up a menu. This menu shows you the various events to which the button can react.

on (release) {

contains the keyword on, followed by the release event. This is followed by a curly brace { .

 

Pay attention to the event you choose. The description of mouse events follows:

- the release event means that the code between the curly braces {} will be executed when the user has clicked AND released the left mouse button. That is a ¡¡ãnormal¡¡À, ¡¡ãstandard¡¡À click. Few users click the mouse and hold on to it, unless they are dragging something,

- if you chose the press event, it means the code will be executed the instant the user clicks the mouse button, before he released it. This may shock some users, because they are used to ¡¡ãnormal¡¡À, that is, ¡¡ãrelease¡¡À clicking. The press event is excellent for Flash games, when something needs to happen immediately ¡ˇěC like a spaceship firing a round, or a character jumping, etc,

- the releaseOutside event happens when the user presses (clicks) the mouse over the button, drags it outside the button area, and releases it,

- the rollOver event happens when the mouse is rolled over the button (can¡¯t be simpler :) ,

- the rollOut event happens when the mouse is moved over the button and withdrawn from the button area,

- the dragOver event happens when the user clicks the mouse when over the button, drags it outside the button area and returns back over the button,

- the dragOut event happens when the user clicks the mouse over the button, and drags the cursor outside it.

The second line of our ActionScript code,

getURL("http://www.flashexplained.com", "_blank");

contains the getURL command, which makes adding hyperlinks possible. The chunks of code between parenthesis are called parameters. They have to be written between quotation marks and be separated by a comma. The first one is the URL (Uniform Resource Locator, if you¡¯ve always wandered what the acronym means), or the place on the web your banner is pointing to (it can be an e-mail address, also). I have put in my tutorials main page URL, you can put whatever you want. The second one tells where the link will open: in our case, _blank indicates that it will open in a new browser window. The other options serve if you have frames on your pages (personally, I NEVER use frames), they are _self if you want the link to open in the same frame your Flash banner is, _parent for opening in the parent frame and _top opens over all frames, and the frameset disappears. There is a third parameter that can be used, for sending data, but that is beyond the scope of this tutorial.

Press CTRL+ENTER to test your movie. Click on the button, it should take you to the URL you specified.

 

Creating content

http://flashexplained.com/banners/creating-a-flash-ad-banner-from-start-to-finish/