Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


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

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


More Variables

March 8, 2000

Okay, so we've set up the conditional, but where will the variable get its value? We'll do it a couple of ways.

First we'll do it the easy way - by defining it within the movie itself. Double click on frame 1 (a keyframe by default in each layer in a movie) in the actions layer. On the actions tab, click the plus to add an action. Select "Set Variable".

In the variable section just type "n", and in the value section type "1". Click OK.

Check your movie to see if it works. Even with the player set to "loop", the penguin should stop after one round. Change n to another value in frame 1 and watch the penguin go round and round. If you get confused or mistype something, download pengoo_in_02.fla to see how it looks in the raw.

Now we'll get tricky. We'll load the variable "n" from a .txt file instead of just typing it into the movie like a moron.

Caution: this is tricky stuff. You have to have all your t's crossed and all your i's dotted or it won't work. (It's almost like real web development)!

Create a .txt file in the same directory as pengoo_in_02.fla and call it "electric_boogaloo.txt". This file must read exactly as follows (without the quotation marks): "n=1".

Next we'll change the action in frame 1 of the actions layer to load the variable n from the .txt file.

Double click in frame 1 of the actions layer to open the frame properties dialogue. Use the minus sign button to remove the set variable action.

Next we will add the Load Variable action as follows:

Click the plus sign to add the action. Select Load/Unload Movie from the drop down menu. In the right hand window select Load Variables into Location. Note the "Load Movie" changes to "Load Variables".

Take note of the location section of this dialogue. We will use level 0 as the location into which we will load the variable "n". Level 0 is the main timeline of the movie. Level 1 would be a movie clip within the movie (like the penguin movie clip). Level 2 would be the level above that - in our example the scarf movie clip, (and so on).

Click OK and check your movie. Don't forget to select Control | Enable Frames Actions from the file menu bar. If it is not selected you will not get the expected results. Change "n" to another number in electric_boogaloo.txt and verify that you get a different result.

The implications of this kind of power are obvious. What we have just put together is a high - quality animation that is controlled by not only user interaction in real time (via the buttons we created), but also by a variable obtained from a remote source.

Currently there are multiple products available that are designed specifically as middleware for Flash. These apps reside on a server for the manipulation of Flash movies. You have probably already heard about Macromedia's Generator. You should also be aware that geeks all over the world are developing applications to extend the practical applications of Flash, (witness Swift Generator - see Open SWF project).

I have personally used Flash successfully in conjunction with the free PERL script EZDB to create dynamically generated Flash content. This site also uses Flash with PERL to maintain a butt-simple bulletin board and a mailing list.

Be sure to come back next week for the final installment when we'll learn how to publish our movie for viewing in a web browser.

Variables
0 to 60 in Flash
Publishing


Up to => Home / Authoring / Flash / 0to60




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, & Permissions, Privacy Policy.

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