Loading...

Flash Actionscript Geturl Command

HTML or Hyper Text Markup Language is a markup language for documents on the WWW or World Wide Web. The interesting part of documents on the WWW is that users can jump from one document to another by clicking onto the hot spots. These hot spots serve as hyperlinks to the other locations.

In flash mx as well as flash mx 2004 and flash 8, hyperlink is achievable through getURL() command. The getURL() command provides a mean for the browser to jump from one page to the other. In addition, getURL() can also be used to open an executable application or an email application. Here, I'll show you three different usages of flash getURL() command:

  1. Flash hyperlink to open up another hypertext documents
  2. Flash hyperlink to open an executable file
  3. Flash hyperlink to open an email application
A. Flash hyperlink to open up another hypertext documents

Brief Tutorial Outline: Click the button below to open up a new document. It will link you to www.google.com.

Let's start our flash getURL() tutorial journey here, shall we?

1. Create a new flash movie and change the size to 120px (width) x 70px (height).

2. Choose a rectangular tool by clicking on or press R on your keyboard.

3. Create a small rectangle at the centre of the stage.

4. Choose an arrow tool by click on or press V on your keyboard.

5. Select the rectangle by double click on it.

6. Click 'Insert' > 'Convert to Symbol' > 'Button' for the behavior; Then type 'hyperlink' in the name field and click ok.

image 1

7. Now you have the rectangle as a button instance.

8. With your arrow tool still selected, click on the flash button instance which you have just created.

9. Click 'Window' and choose 'Actions' or press F9 on your keyboard.

10. Make sure you have turned the scripting mode to Expert Mode. You can accomplish this by clicking on the blue arrow on top right corner of Actions Panel and select Expert Mode.

Flash Actionscript getURL Command

11. Type the following actionscript provided below into the white space:

on (release) {
getURL("http://www.google.com");
}

12. Now test your movie by pressing 'Ctrl+Enter'.

B. Flash hyperlink to open an executable file

This is the second part on flash actionscript getURL.

You have seen the power of flash actionscript getURL() command to open up a new hyperlink document, following up, I'll show you how, by using the actionscript getURL() command to open up an executable file. An executable files may have either of these file extentions: .txt .doc .pdf .exe .swf .mp3 .wma.

The actionscript getURL() command to open an executable file will be especially useful under the following situations:

Users may open and save the .doc or .pdf for future use. e.g. your resume. While in situation with the current opened flash application, a .exe or .swf may be opened for an external game application or flash e-cards.

One may also make use of the getURL() to open a .mp3 or .wma file to listen to sound or music files.

Flash actionscript getURL() command to open up an executable file:

on (release) { getURL("C:myFoldermyFile.txt"); }

located in a folder named myFolder which is itself in a C: drive

Note: You may have noticed in this flash getURL() example, there are two backslashes () instead of one backslash (). This is because in window platform you must take care of the escape backslash characters () as part of the file name and location.

C. Flash hyperlink to open an email application

This is the third part on flash actionscript getURL. Okay, let's get started with our flash actionscript getURL for an email application.

Want to have users click on a button or hot text and pop up their default email client e.g. Microsoft Outlook or Outlook express to send email to some email address? If yes, this section of the flash mx actionscript getURL() tutorial could be what you are looking for =)

Flash actionscript getURL() command to for flash email application:

on (release) {
getURL("mailto:[email protected]");
}

There may be time when you wish to enter more than one email address and/or populate the subject area and the body of the email with some pre-defined words. Let's consider a more advance flash email application below:

on (release) {
getURL("mailto:[email protected][email protected]&body=Thank You For Visiting Us ");
}

Note: This flash actionscript email works when we test it in browser. You may test this flash example in browser by pressing Ctrl + F12 or Choose File -> Publish Preview -> HTML.

To recap, we have learnt how to use the flash actionscript getURL() command in three ways:

First, flash actionscript getURL() as a hyperlink to another hypertext document.

Second, flash actionscript getURL() as a hyperlink to open an executable file.

Third, flash actionscript getURL() as a hyperlink to open an email application.

You may download flash getURL() source code here.

Copyright © All Rights Reserved