• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2945
  • Last Modified:

AS3 Fullscreen projector has black screen instead of flvplayback

Hi All,

I'm having difficulty getting this to work. Basically I'm putting together a CD Rom which will play full screen.

Parts of the CD Rom have videos in. I don't want these to play full screen but just play in a box in the middle.

The problem I'm having is that it works fine until I export a Macintosh Projector file. When I go to the scene with the movie, it just goes black. Filling the screen with black, and when I press escape, it goes back to the scene but the movie hasn't started playing.

I'm also using cue points so that it can go to the next video at the end. I'm not a very good programmer yet, as you may see from my code...

The fullscreen code I'm using is on the previous scene:
import flash.system.fscommand;

fscommand("fullscreen", "true");
fscommand("allowscale", "false");

Open in new window

On the next scene, with the video on it, I've tried
 IntroMovie.fullScreenTakeOver = false; 

Open in new window

but it doesn't work. I've tried going through all of my code and now I've ended up here. Please could somebody attempt to help?

My full code is:

Intro Scene
import fl.video.VideoEvent;
import fl.video.MetadataEvent;
import flash.system.fscommand;

fscommand("fullscreen", "true");
fscommand("allowscale", "false");

ADTStartBtn.addEventListener(MouseEvent.CLICK, gotointrovideo);

	function gotointrovideo(event:Event):void 
	{
	trace("Intro Video");
	gotoAndPlay("IntroPlay", "Intro");
//This is where there's a transition for the "out" of intro. It doesn't have an end frame command to go to the next scene as it's automatic.
	}

Open in new window

Code for Intro Video Scene:
import fl.video.FLVPlayback;
import flash.system.fscommand;
import flash.events.MouseEvent;

IntroMovie.fullScreenTakeOver = false;
trace(IntroMovie.source);

//Initiates the Cue Point
IntroMovie.addEventListener(MetadataEvent.CUE_POINT,cp_listener);
IntroMovie.play();

function cp_listener(event:MetadataEvent):void
{
// Traces cue points for info
trace("Elapsed time in seconds: " + IntroMovie.playheadTime);
trace("Cue point name is: " + event.info.name);
trace("Cue point type is: " + event.info.type);

// Code for going to next scene automatically at the end of the video
if (event.info.name == "Intro End") {
IntroMovie.getVideoPlayer(IntroMovie.activeVideoPlayerIndex).close();
this.nextScene();
	}
}

// Code for "Next" button
next_btn.addEventListener(MouseEvent.MOUSE_DOWN, stopflv);
function stopflv(event:MouseEvent):void {
IntroMovie.getVideoPlayer(0).close();
//IntroMovie.getVideoPlayer(IntroMovie.activeVideoPlayerIndex).close();
this.nextScene();
}

// Code for "Pause" button
pause_btn.addEventListener(MouseEvent.MOUSE_DOWN, intro_pauseflv);
function intro_pauseflv(event:MouseEvent):void {
IntroMovie.stop();  
}

// Code for "Play" button
play_btn.addEventListener(MouseEvent.MOUSE_DOWN, intro_playflv);
function intro_playflv(event:MouseEvent):void {
IntroMovie.play();  
}

// Code for "Scene Selection" button
menubtn.addEventListener(MouseEvent.CLICK, gotomenu);

	function gotomenu(event:Event):void 
	{
	trace("Game Menu");
	IntroMovie.getVideoPlayer(IntroMovie.activeVideoPlayerIndex).close();
	gotoAndPlay(1, "Game Menu");
	}

stop();

Open in new window

Many thanks,

Tom
0
tomsaunders9
Asked:
tomsaunders9
1 Solution
 
quizengineCommented:
I'm not sure if this will help, but it sounds like it may be related

http://reviews.cnet.com/8301-13727_7-10425683-263.html

Also, since the author of that piece says this only works with videos encoded in the flv format, one other possible solution may be (if you are using flv videos yourself) is to re-encode the videos using a *different* video codec (e.g. using Adobe Media Encoder and choosing, say, the H264 video codec).
0
 
tomsaunders9Author Commented:
Thanks for the reply, quizengine.

Actually it turned out to be an issue that when the screen goes black it's actually crashing:
ReferenceError: Error #1056: Cannot create property IntroMovie on flash.display.Stage.

It's processing the code before it's had chance to add all the elements to the display list. I'm referencing "IntroMovie" but it doesn't exist yet.
 
A simple solution is to delete the video from the stage in the timeline, and instantiate the FLVPlayback instance with code:
 
var IntroMovie:FLVPlayback = new FLVPlayback();

//Then set up the properties like this:

IntroMovie.source = "Videos/1_Intro.mp4";
IntroMovie.fullScreenTakeOver = false;

// change these as appropriate

IntroMovie.x =100;  //in pixels
IntroMovie.y= 100;
IntroMovie.width = 800;
IntroMovie.height= 400;
//add this newly created object to the stage
addChild(IntroMovie);

Open in new window

There's also a COMPLETE event that I used instead of adding cue points. Much better.

Anyway, that should solve the problem for most people, and the MP4s work just fine.

Tom
0
 
CyanBlueCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now