Procedure:
step 1: Open flash 8
step 2: Select flash document
step 3: select 1st layer, 1st frame on that document and write source code(ImageViewer.fla) on Actions Frame
step 4: Open ActionScript document
step 5: Write the source code(ImageViewer.as) on that document
step 4: To check output press ctrl+enter(test movie)
SourceCode:
1.ImageViewer.as
class ImageViewer
{
private var container_mc:MovieClip;
public function ImageViewer(target:MovieClip,depth:Number,x:Number,y:Number)
{
container_mc=target.createEmptyMovieClip("container_mc"+depth,depth);
container_mc._x=x;
container_mc._y=y;
}
public function loadImage(URL:String):Void
{
container_mc.loadMovie(URL);
}
}
step 1: Open flash 8
step 2: Select flash document
step 3: select 1st layer, 1st frame on that document and write source code(ImageViewer.fla) on Actions Frame
step 4: Open ActionScript document
step 5: Write the source code(ImageViewer.as) on that document
step 4: To check output press ctrl+enter(test movie)
SourceCode:
1.ImageViewer.as
class ImageViewer
{
private var container_mc:MovieClip;
public function ImageViewer(target:MovieClip,depth:Number,x:Number,y:Number)
{
container_mc=target.createEmptyMovieClip("container_mc"+depth,depth);
container_mc._x=x;
container_mc._y=y;
}
public function loadImage(URL:String):Void
{
container_mc.loadMovie(URL);
}
}
2.ImageViewer.fla:
var viewer:ImageViewer=new ImageViewer(this,1,100,100);
viewer.loadImage("Penguins.jpg");
No comments:
Post a Comment