There are several ways to establish, or declare, variables in a Flash movie. You can create them directly with ActionScript (or with Text Fields, as seen in the last section), load them from a text file or CGI (Common Gateway Interface) script, or include them in HTML tags.
Using actions to define variables
The most common way to create a variable is to type the variable’s name and value in the Actions list of the Actions Panel, on a specific timeline’s keyframe, accessed in the Frame Properties or Instance Properties dialog. Most basic variables will have values that are string literals. If you are using Normal Mode in the Actions Panel, then a var action has one option: variables. Note that the var action is used for local variables that only exist for the duration of a function execution.
Loading variables from a predefined source
You can also establish variables by loading them from an external source, such as a text file located on your Web server or even through a database query. By using the loadVariables action, you can load variables in this fashion. There are three primary options for the loadVariables action: URL, Location, and Variables .
The options of the loadVariables action
URL specifies the source of the variables to be loaded. This can be a relative link to the variable source (you don’t need to enter the full path of the resource). You can specify whether this URL value is a literal value or an expression that uses a variable or a combination of variables (serverURL + scriptPath + scriptApp).
The Location option determines where the variables are to be loaded. You can send the name/value pairs to a level or a timeline target. If you want the variables to be available on the Main Timeline, use _root or _level0. You can also specify a Movie Clip target using a relative or absolute address. To load to the current Movie Clip (the one initiating the loadVariables action), use the target this. The last option is Variables, and this drop-down menu specifies whether you are sending and loading (in other words, receiving) variables. If you want to load variables from a static source, like a text file, you should choose Don’t Send. If you are sending a query to a database-driven engine, then you will need to choose either GET or POST.
Note that the use of loadVariables in GET or POST method means that you are sending variables declared on the active timeline to the specified URL, which, in turn, will send name/value pairs back to the Flash movie. The formatting of name/value pairs is standard URL-encoded text. If you want to encode name/values in a text file (or a database), you need to use the following format:variable=value&variable=value...
Basically, in URL-encoded text, name/value pairs are joined by an ampersand (&). To join multiple terms in a value, use the plus (+) symbol, as in:name1=Joe+Smith&name2=Susan+Deboury
Sending variables to URLs
You can also send variables to a URL by using the getURL action. Any name/value pairs that are declared on the active timeline will be sent along with the getURL action, if a variable send method is defined (GET or POST). Note that getURL is only used to send variables out of a Flash movie—it will not retrieve or load any subsequent name/value pairs. If you use a getURL action on a Movie Clip timeline as follows:
The output of the form.cgi script would be opened in a new browser window(“_blank”).
Establishing variables with HTML
You can also send variables to Flash movies in the <EMBED> and <OBJECT> tags that call the Flash movie. In the SRC attribute of <EMBED> or the PARAM NAME=movie subtag of the <OBJECT> tag, attach the name/value pairs to the end of the Flash movie filename, separated by a question mark (?).
Flash Related Interview Questions
|Adv Java Interview Questions||J2EE Interview Questions|
|Adobe Flex 3 Interview Questions||Dreamweaver Interview Questions|
|3D Animation Interview Questions||Adobe Flash CS6 Interview Questions|
|Dreamweaver CS3 Interview Questions||Adobe Flex Interview Questions|
|Adobe Flex Actionscript Interview Questions||Gif Animation Interview Questions|
|Adobe Fireworks Interview Questions|
Understanding The Flash Framework
Exploring The Interface: Panels, Settings, And More
Using Tools For Navigation And Viewing
Working With Selections And The Pen Tool
Working With The Drawing And Painting Tools
Working With Text
Exploring The Timeline
Checking Out The Library: Symbols And Instances
Drawing In Flash
Animating In Flash
Using Bitmaps And Other Media With Flash
Designing Interfaces And Interface Elements
Understanding Sound For Flash
Importing And Editing Sounds In Flash
Optimizing Flash Sound For Export
Understanding Actions And Event Handlers
Navigating Flash Timelines
Controlling Movie Clips
Sharing And Loading Assets
Planning Code Structures
Creating Subroutines And Manipulating Data
Understanding Movie Clips As Complex Objects
Sending Data In And Out Of Flash
Understanding Html And Text Field Functions In Flash
What Is Generator?
Revving Up Generator
Working With Third-party, Server-side Applications
Working With Raster Graphics
Working With Vector Graphics
Working With Audio Applications
Working With 3d Graphics
Working With Quicktime
Working With Realplayer
Creating Full-motion Video With Flash
Creating Cartoon Animation With Flash
Planning Flash Production With Flowcharting Software
Working With Authoring Applications
Publishing Flash Movies
Integrating Flash Content With Html
Using Players, Projectors, And Screensaver Utilities
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.