EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 246

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
246 Classes
To use the Picture and PictureClass classes in a FLA file:
1. Select File > New and then select ActionScript File. Save the document as Picture.as and
then click OK.
You write your custom Picture class in this document.
2. Type the following ActionScript code into the Script window:
/**
Picture class
author: John Doe
version: 0.53
modified: 6/24/2005
copyright: Macromedia, Inc.
The Picture class is used as a container for an image and its URL.
*/
class Picture {
private var __infoObj:Object;
public function Picture(src:String) {
this.__infoObj = new Object();
this.__infoObj.src = src;
}
public function showInfo():Void {
trace(this.toString());
}
private function toString():String {
return "[Picture src=" + this.__infoObj.src + "]";
}
public function get src():String {
return this.__infoObj.src;
}
public function set src(value:String):Void {
this.__infoObj.src = value;
}
}
3.
Save the ActionScript file.
4. Select File > New and then select Flash Document to create a new FLA file. Save it as
picture_test.fla in the same directory as you saved the Picture class file.

Table of Contents

Related product manuals