fredag 20. november 2009

How to set Perspective angle and Vanishing point dynamically

How to set different vanishing points and perspective angles on different movieclips:

mc1_mc.transform.perspectiveProjection = new PerspectiveProjection();

mc1_mc.transform.perspectiveProjection.fieldOfView = 60;

mc1_mc.transform.perspectiveProjection.projectionCenter = new Point(100,100);


mc2_mc.transform.perspectiveProjection = new PerspectiveProjection();

mc2_mc.transform.perspectiveProjection.fieldOfView = 100;

mc2_mc.transform.perspectiveProjection.projectionCenter = new Point(200,200);

onsdag 11. november 2009

How to close streaming - FLVPlayback

If you remove a FLVPlayback component from the stage it will keep downloading the flv-file if it's not completed yet. One way to stop the netstream is to use the FLVPlayback's closeVideoPlayer method.

Closes NetStream and deletes the video player specified by the index parameter. If the closed video player is the active or visible video player, the FLVPlayback instance sets the active and or visible video player to the default player (with index 0). You cannot close the default player, and trying to do so causes the component to throw an error.

So we need to set the index to 1:

myFLVplayer.source = "video.flv";

myFLVplayer.activeVideoPlayerIndex = 1;

myFLVplayer.visibleVideoPlayerIndex = 1;


The source must be set before the index is set. Close the stream with this code:

myFLVplayer.closeVideoPlayer(1);

Another way is to access the VideoPlayer's close method:

var myVideoPlayer:VideoPlayer = myFLVplayer.getVideoPlayer(0);

myVideoPlayer.close();