Now: Tutorial for Web and Software Design > Flash > Action Script > Flash Content
> Pass Arguments to Flash Movie [Bookmark it]
Pass Arguments to Flash Movie

This tutorial was written for the Flash Designer software, which allows you to create flash animations in a much easier way than by using Macromedia Flash. You may get Flash Designer here.

To pass parameters use query string after the name of SWF file. In the following example a query string was used:

<PARAM NAME="MOVIE" VALUE="t1039.swf?parameter1=123456789">

and

<EMBED SRC="t1039.swf?parameter1=123456789"
Click to view flash
Click to view flash

To use a parameter in Flash movie follow the steps below:

1. Launch Flash Designer and create a blank document.

2. Set the frame delay to "Stop" ("Frame" > "Frame Delay").

3. Draw a dynamic text box (with the edit field tool), the box should appear as "Edit1"

4. Choose "Frame" > "ActionScript" and enter the code to initialize the box

Edit1 = parameter1;

5. Enter parameters under "Movie" > "Export Options"

image 2

6. Export SWF file and choose "File" > "View HTML Code" to verify if the agrument is visible in the code:

image 3

7. Hit F9 to preview the movie.

8. Choose "File" > "Export HTML Page" to view a sample web page with the movie.

Drive the parameter with ASP or PHP

As you have the HTML code ready you can build the query string dynamically with ASP or PHP.

ASP example:

<PARAM NAME="MOVIE" VALUE="t1039.swf?parameter1=<% =asp_parameter %>">

PHP example:

<PARAM NAME="MOVIE" VALUE="t1039.swf?parameter1=<? print($php_parameter); ?>">

Make the same changes to EMBED part of the Flash tag.

Of course you have to run the HTML page through your web server so it can execute ASP or PHP code.

Download source project t1039.zip


[Bookmark][Print] [Close][To Top]
  • Prev Article-Flash:

  • Next Article-Flash:
  • Related Materias
    Handwriting Flash Movie
    Layers in Flash
    Buttons in Flash
    Symbols in Flash
    Graphics in Flash
    Flash 8 Tutorial - Shape T
    Controlling File Size in F
    Introduction to Flash 8
    My First Flash Animation
    Flash 8 Environment
    Topics
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Graphic Design Tutorial
     

    Coreldraw Tutorial

      Illustrator Tutorial
      3D Graphics Articles
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial&Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial&Articles
     

    XML Style Tutorial

      AJAX Tutorial
      XML Mobile
    Flash Tutorial&Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial&Articles
     

    Linux Tutorial

      Symbian Tutorial
      MacOS Tutorial