Learn to create a customizable pop-up window using Flash CS4.

Need a Website? Contact Us Now!

This entry is part 23 of 32 in the series Flash CS4 Tutorials

We are going to learn how to create pop-up windows in Flash CS4 using Action Script 2.0.

Create a new Flash AS 2.0 document:
File > New > Flash File (ActionScript 2.0)

If you have already created a Flash AS 3.0 file you will need change your publish settings to AS 2.0:
File > Publish Settings > Flash > Script: ActionScript 2.0

Step 1: Create a button symbol and place it on the stage like the one below.
Learn to create a customizable pop-up window using Flash CS4
Step 2: Name the instance of the button “launch.btn”, as seen here
Learn to create a customizable pop-up window using Flash CS4

Step 3: Now we need to create the action script, 

Create another layer and call it actions, your timeline will look like this below
Learn to create a customizable pop-up window using Flash CS4
Let’s now write the action script, so go to actions layer in frame1 and press F9

We will write launch_btn (which is the instance name of the button).onRelease (which on release is going to perform a function as defined).

In the next line getURL (“ “). Now in-between these quotes we are going to call a java script that will publish the swf file and the html file.

In the html file we are going to write a javascript function. So in the getURL function we are going to call the java script function, so in-between the quotes we are going to call a java script function

So type javascript; and type the function we are going to call, lets go and call this function launch, and in brackets we are going to send this function to an URL that its going to take us to, so type bestwebdesignz.com in single quotes, so your action script will look like this below.
Learn to create a customizable pop-up window using Flash CS4

Now save the file by going to the main menu File> Save As>call it popup.fla.
At this point we have finished all that we need to do in flash, we now need to publish the file, so go to the main menu File > Publish Settings, and make sure that the flash (.swf) and the html(.html) boxes are checked and click on publish and click ok like this below.
Learn to create a customizable pop-up window using Flash CS4

Step 4: Now we need to go into our html file and need to add that javascript function. So open the notepad and open the popup.txt file and you need to add a function in between the title and the head as shown below,
Learn to create a customizable pop-up window using Flash CS4

In this script you  are basically calling a function called launch in a new page and this will open an URL as defined in the page function with no toolbars, no menubar, no scrollbars, no location, with width =550 pixels and height =250 pixels and to show from the top=250 and from the left =250 .
Now we need to upload the files to the server and test your movie, so go and save your file and  upload the .swf and html files to the bestwebdesignz server. Having uploaded the swf files and html files, switch to the browser window and type in the name here “bestwebdesignz.com, you will see that button which we designed earlier and when you click on the button, it will call the java script and load the bestwebdesignz.com site for you.

Series Navigation«Learn 3D Art in Flash CS4.How to create a pop up window in flash CS4 using javascript»
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • E-mail this story to a friend!
  • LinkedIn
  • MySpace
  • StumbleUpon
  • Technorati

Tags:
Posted in Flash CS4 Tutorial | No Comments »

Post a Comment