<< Chapter < Page Chapter >> Page >

The programmer is responsible for the display

Generally speaking, when writing code in those other languages, it is up to the programmer to write the code that determines how, if, and when the imagesare displayed on the screen.

While it is not unusual for the programmer to write code to cause images to be displayed in a sequential and repetitive manner in those other languages (see the above note ) , the decision to do that is strictly up to the programmer.

Good news and bad news

It is possible to (almost) prevent the Flash Player from displaying repetitive frames by writing code to set the framerate to 0.01 frames per second. This is not without its problems however.

There are pros and cons to both approaches. The good news is that the behavior of the Flash Player relieves the programmer of the responsibility todisplay images on a sequential and repetitive basis.

The bad news is that the Flash Player deprives the programmer of the opportunity to make decisions in that regard.

Startup considerations

What happens when a swf file is loaded?

It is hard to know exactly what happens when a swf file is loaded into the Flash player. I have searched the web extensively and have been unable to finddefinitive information in that regard.

However, I think I understand what happens, and I will share what I believe to be true with you.

Different ways to write ActionScript 3 programs

You can write ActionScript 3 programs by creating AS3 or ActionScript projects using Adobe's Flex Builder 3 , Adobe's Flash Builder 4 , or using the free open source FlashDevelop software.

There are other ways to write ActionScript 3 projects as well.

A skeleton ActionScript source code file

With all three tools, the creation of an ActionScript project causes a skeleton ActionScript source code file with an extension of .as to be created. This file must contain a public class definition with a class name that matchesthe name of the file exclusive of the extension.

The name of the ActionScript source code file

The default name of the source code file differs for the three development tools, but you can rename it if you wish for all three tools. However, you mustalso be sure to rename the class definition (and its constructor) so that the name of the class matches the name of the source code file.

A release build

In all three cases, when you create a release build for the project, you end up with a folder containing an swf file, an html file, and some otherfolders and files as a minimum.

The name of the swf file

The name of the swf file also varies among the different development tools and it is best not to change it. It is referenced inside the html file and possiblyinside some of the other files as well, so changing the name of the swf file would require you to make corresponding changes in one or more other files.

The name of the html file

The name of the html file also varies among the different development tools but it appears that you can change it with no ill effects.

What happens when the html file is opened in a browser?

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with actionscript. OpenStax CNX. Jun 04, 2010 Download for free at http://cnx.org/content/col11202/1.19
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?

Ask