Home arrow Flash arrow Page 3 - Basic Flash ActionScript for Designers
FLASH

Basic Flash ActionScript for Designers


If you already know the basics of Flash, using tools and creating animations, you may want to add some interactivity to your work. ActionScript, an object oriented programming language built into Flash, is the key to this. Adi Reddy Mora explains the basics of ActionScript.

Author Info:
By: Adi Reddy Mora
Rating: 4 stars4 stars4 stars4 stars4 stars / 193
June 01, 2005
TABLE OF CONTENTS:
  1. · Basic Flash ActionScript for Designers
  2. · Buttons, Movie Clips, and Making them Draggable
  3. · Navigating, URLs, and Loading Images
  4. · Loading External MP3 Files

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Basic Flash ActionScript for Designers - Navigating, URLs, and Loading Images
(Page 3 of 4 )

Navigate between scenes

Scenes in Flash can be used to organize your document into discrete sections. You can control the navigation between scenes through AcrionScript using the scene name and usinggotoAndStop() or gotoAndPlay() methods. Here are a couple examples:

// Sends the playhead to the first frame of “Scene 2”
// and stops
gotoAndStop("Scene 2", 1);

// Sends the playhead to the first frame of “Scene 1”
// and plays
gotoAndPlay ("Scene 1", 1);

Opening a URL from Flash

You can open a URL from a button or on a movie clip using getURL() method. It accepts three parameters: URL, window, and variables sending type.

URL is a valid path to a specific page or web site.

Window is an optional parameter specifying the window or HTML frame into which the document should load. You can enter the name of a specific window or select from the following reserved target names:

_self
specifies the current frame in the current window

_blank
specifies a new window

_parent
specifies the parent of the current frame

_top
specifies the top-level frame in the current window

Variables sending type is the GET or POST method for sending variables. Omit this parameter if there are none. The GET method appends the small numbers or variables to the end of the URL. The POST method sends long strings of variables in a separate HTTP header.

// Opens the site devarticles.com in a new window and sends the variables
// from flash using POST method.

getURL(“http://www.devarticles.com”, “_blank”, “POST”);

Loading an external JPEG/SWF into a movie

You can load JPEG and SWF files into your flash movie at runtime instead of importing them into flash while authoring. There are a couple of ways to do this but the easiest is using the loadMovie() method of the movie clip class. That allows you to control the movie clip to perform actions on the loaded file.

// Loads ani.swf file into anim_mc Movieclip.
anim_mc.loadMovie(“ani.swf”);

// Loads a JPG file.
anim_mc.loadMovie(“ani.jpg”);


blog comments powered by Disqus
FLASH ARTICLES

- More Top Flash Game Tutorials
- Top Flash Game Tutorials
- Best Flash Photo Gallery Tutorials
- The Top Flash Tutorials for Menus
- 7 Great Flash Tutorials
- Adobe Creative Suite 5.5 Now Available
- Critical Flash Vulnerability Heats Up the Web
- More on Nonpersistent Client-Side Remote Sha...
- Nonpersistent Client-Side Remote Shared Obje...
- Using the Decorator Pattern for a Real Web S...
- Using Concrete Decorator Classes
- Delving More Deeply into the Decorator Patte...
- The Decorator Pattern in Action
- A Simple Decorator Pattern Example
- Decorator Pattern

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials