Tutorial: scripts

Flash Scripting > > > >

Unable to attach script script to the button?

You started working in Flash CS3 - CS5 and suddenly noticed that you are not able to apply your ol' time-proved scripts to your buttons as you used to before? (Usually the 'Actions' field would say 'Current selection cannot have actions applied to it' )

You should go to Publish Settings, select the 'Flash' tab, and change ActionScript Version: (which by default stays at ActionScript 3.0) to ActionScript 2.0, click 'OK'—and voila, your button is now allowing you to have a script over it.

Thank you, Asa for this advice!

JavaScript > > > >

Display random image every time

your viewers come to your website!

If you reload this page (click on the link in the tutorial menue below) you will see that this page is using a script for delivering a random image every time you come to the page.

You could use this script for increasing the interest of your viewers in your website (every time they visit your page, they will see a new image), or you could use this script as the simplest banner rotation system. The images are stored in a folder and are randomly displayed.

The following code will do the trick (paste it directly where you want to see your random image):
<script language="javascript">
var num = Math.round(Math.random()*6)+1;
document.writeln("<img src='random/"+num+".jpg' border='0'>");

The name of your image in our case is either 1.jpg or 2.jpg or.. 7.jpg. These random images are located in the folder named 'random', and we have 6+1 of them (if you have 10 total images, change 6 to 9; if you have 4 images change 6 to 3, etc. Enjoy!

Many thanks for this beautiful and concise JavaScript to Sasha Murzin!

Flash > > > >

Include external Flash movie to play inside your movie

put this code in a script frame where you want the video to play—this creates an empty clip on your stage:
var MC_LoadedSWF: MovieClip = this.createEmptyMovieClip ("MC_LoadedSWF", this.getNextHighestDepth());

this will place the clip on your stage:
MC_LoadedSWF._x = 25;
MC_LoadedSWF._y = 25;

this loads an external movie swf into the empty clip — this external movie swf must be in the same folder and directory as the final/main swf:
MC_LoadedSWF.loadMovie( "YOUR_MOVIE_SWF_HERE.swf");

Copy the above code in the frame you want and all you'll have to do is to change "YOUR_MOVIE_SWF_HERE.swf"to the file name you want to load. Then you will have to adjust the X and Y stage location values until you get it placed where you want it.

Credits and thanks for the code to Mark from www.IntuiCode.com

Contact Us

Fill out the form

For all inquires, please kindly contact us via this form.
We will respond within 24 – 36 hours.


Where We are

Our office is located in South Florida, Boca Raton.
Give us a call today!


Find Us On


We work with many South Florida companies, located in Miami, Fort Lauderdale, Delray Beach, West Palm Beach, Jupiter, as well as with clients from Chicago, Moscow and Paris. Give us a call today!