Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

Test Your Work - Page 9

May 22, 2002

Now that you've finished off the code for frame 2, take some time to relax—and make sure you've saved this movie! Now add one more line of code and then you can test the movie. Select the third keyframe in this movie clip and open the Actions panel. Add this line:

gotoAndPlay(2);

Now go back to the main movie (scene 1) and copy and paste your clips until you have about nine clips on the Stage. Remember to edit the TOTAL_CLIPS constant in frame 1 of this movie clip to reflect the proper number of clips. Now test the movie. Is everything working? Fiddle around with some of the other constants and keep testing the movie to see how it reacts.

The three listings that follow show all the code you should have in the three frames of your scrolling list component. Check to make sure you are in sync, and then you will move on to making a real component out of the scrolling list movie clip.

Listing 5.1 Frame 1 ActionScript

this._visible = false;

var CLIP_BASE_NAME = "mc_test_clip";
var TOTAL_CLIPS = 3;
var LIST_ORIENTATION = "vertical";
var MOUSE_BUFFER = 20;
var CLIP_SPACING = 10;
var SCROLL_SPEED = 1;
var LOOPING = true;
var SMOOTH = true;
var FRICTION = 5;

function getClipOffset(clipObj, axis) {
 var tempOffset = 0;
 if (axis == "x") {
 tempOffset = clipObj._x – clipObj.getBounds(_parent).xMin;
 } else if (axis == "y") {
 tempOffset = clipObj._y – clipObj.getBounds(_parent).yMin;
 }
 return tempOffset;
}
function createClipArray(baseName, total) {
 var tempArray = new Array();
 for (var i = 0; i < total; i++) {
 if (null != _parent[baseName + i]) {
  tempArray[i] = _parent[baseName + i];
 }
 }
 return tempArray;
}

var gClipArray = createClipArray(CLIP_BASE_NAME, TOTAL_CLIPS);

var gTopBounds = 0;
var gBottomBounds = 0; 
var gLeftBounds = 0;
var gRightBounds = 0;
if (gClipArray.length > 0) {
 gTopBounds = gClipArray[0].getBounds(_parent).yMin;
 gBottomBounds = gClipArray[0].getBounds(_parent).yMax; 
 gLeftBounds = gClipArray[0].getBounds(_parent).xMin;
 gRightBounds = gClipArray[0].getBounds(_parent).xMax;
}

var tempX = 1;
var tempY = 1;
for (var i = 0; i < gClipArray.length; i++) {

 if (LIST_ORIENTATION == "horizontal") {
 gClipArray[i]._x = tempX + getClipOffset(gClipArray[i], "x");
 tempX = gClipArray[i]._x – getClipOffset(gClipArray[i], "x") +  
gClipArray[i]._width + CLIP_SPACING; } else { gClipArray[i]._y = tempY + getClipOffset(gClipArray[i], "y"); tempY = gClipArray[i]._y - getClipOffset(gClipArray[i], "y") +
gClipArray[i]._height + CLIP_SPACING; } tempTop = gClipArray[i].getBounds(_parent).yMin; if (tempTop < gTopBounds) { gTopBounds = tempTop }; tempBottom = gClipArray[i].getBounds(_parent).yMax; if (tempBottom > gBottomBounds) { gBottomBounds = tempBottom }; tempLeft = gClipArray[i].getBounds(_parent).xMin; if (tempLeft < gLeftBounds) { gLeftBounds = tempLeft }; tempRight = gClipArray[i].getBounds(_parent).xMax; if (tempRight > gRightBounds) { gRightBounds = tempRight }; } gTopBounds -= MOUSE_BUFFER; gBottomBounds += MOUSE_BUFFER; gLeftBounds -= MOUSE_BUFFER; gRightBounds += MOUSE_BUFFER; var gTotalWidth = tempX; var gTotalHeight = tempY; var tempScaleMode = Stage.scaleMode; Stage.scaleMode = "exactFit"; var MOVIE_WIDTH = 550; var MOVIE_HEIGHT = 400; Stage.scaleMode = tempScaleMode; var gMovieCenterX = MOVIE_WIDTH / 2; var gMovieCenterY = MOVIE_HEIGHT / 2; var gMouseDeltaX = 0; var gMouseDeltaY = 0; var gOriginX = 0; var gOriginY = 0; var gFriction = 1 + (FRICTION / 150); var gConstX = (Math.pow(gMovieCenterX, 3) + Math.pow(MOVIE_WIDTH, 3) +
Math.pow(gMovieCenterX, 2) + Math.pow(MOVIE_WIDTH, 2)) / 4; var gConstY = (Math.pow(gMovieCenterY, 3) + Math.pow(MOVIE_HEIGHT, 3) +
Math.pow(gMovieCenterY, 2) + Math.pow(MOVIE_HEIGHT, 2)) / 4;

The Heart of the System - Page 8
Skip Intro: Flash Usability and Interface Design
Test Your Work (Cont.) - Page 10


Up to => Home / Authoring / Flash / SkipIntro




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers