Advertisement

[x]
Attachment Details

How to fade in a NetStream object in Flash AS3

Using the NetStream method in Flash ActionScript 3, I am creating a simple SWF file in which I would like an FLV movie to begin playing when the mouse is over a button, pause when it is off the button, resume when it goes back on, and restart if the button is clicked.

I have most of the code correct but have one - probably ridiculously easy - remaining problem: I cannot get the video to fade in and out using the trans_obj method. Is there another approach I can use?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
videoStream.play("Keys fallin.flv");
var metaListener:Object = new Object();
metaListener.onMetaData = onMetaData;
videoStream.client = metaListener;
var video:Video = new Video();
video.attachNetStream(videoStream);
addChild(video);
 
function onMetaData(data:Object):void
{
	play_btn.addEventListener(MouseEvent.MOUSE_OVER, resumeMovie);
	play_btn.addEventListener(MouseEvent.CLICK, playMovie);
	play_btn.addEventListener(MouseEvent.MOUSE_OUT, pauseMovie);
}
 
function playMovie(event:MouseEvent):void
{
	videoStream.play("Keys fallin.flv");
}
 
function stopMovie(event:MouseEvent):void
{
	videoStream.pause();
}
 
function pauseMovie(event:MouseEvent):void
{
	videoStream.pause();
}
 
function resumeMovie(event:MouseEvent):void
{
	videoStream.resume();
}
Related Solutions
Related Solutions
 
Loading Advertisement...
 
Author Comment by peterg77:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Expert Comment by greeneel:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Author Comment by peterg77:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
Loading Advertisement...
20080924-EE-VQP-40 / EE_QW_2_20070628