[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

AS3 Fullscreen projector has black screen instead of flvplayback

Posted on 2012-09-12
4
Medium Priority
?
2,834 Views
Last Modified: 2012-12-11
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
Comment
Question by:tomsaunders9
3 Comments
 
LVL 19

Expert Comment

by:quizengine
ID: 38402993
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
 

Accepted Solution

by:
tomsaunders9 earned 0 total points
ID: 38417090
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
 
LVL 37

Expert Comment

by:CyanBlue
ID: 38678655
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question