Im looking into using and customizing FLVPlayback in a project. How to go about this is clear, but I noticed 1 anoying thing. When going fullscreen, first Flash player goes fullscreen and then briefly shows the FLVPlayback component in its original size, before jumping to show the video itself fullscreen.
I noticed on Youtube this doesnt happen. How can I escape this 'flicker' and have the video go fullscreen as the videos do on youtube?
Thanks a lot for any tips!
Marcel
in general FLVPlayback along with most of the components built into flash are junk. You are much better off building your own flv player using the NetConnection and NetStream class. Build it once well and generic enough to edit the control visuals and you have yourself a bullet proof flv player for all your projects.
http://actionscriptexamples.com/2008/02/26/loading-flv-files-in-actionscript-30-using-the-netconnection-and-netstream-classes/
Just to say I've used FLVPlayback on jobs many times, and sure it's buggy, but I've never seen this problem. You can definitely fix it. How are you going fullscreen? I've recently being doing something like this...
import flash.display.*;
import flash.events.*;
import fl.video.*;
import flash.geom.Rectangle;
.
.
.
myFLVPlayback.fullScreenTakeOver = false;
mc.stage.fullScreenSourceRect = new Rectangle(0,0,480,360);
myFullScreenButton.addEventListener(MouseEvent.CLICK, onFullScreenButtonClicked);
private function onFullScreenButtonClicked(e:MouseEvent):void {
mc.stage.displayState = StageDisplayState.FULLSCREEN;
}
(though i appreciate you might be using the fullscreen button in an FLVPlayback skin, so this might not be perfect)
NOTE: I just hammered that code in so it might not be perfect/complete. Hopefully you'll find it useful.
++ i'd make sure you set the size and scale of your flvplayback too, e.g. myflvplayback.setSize(w,h)
++ how about myflvplayback.scaleMode = VideoScaleMode.NO_SCALE;
Related
Heyya, Community!
So, I've been programming in Flash ActionScript 3.0 for a few years, gradually relearning everything. However, I can't figure this out for the life of me -- I've been forced to use inefficient work-arounds since now. And I just needed to know, how can I stop MovieClips added via The Stage consisting through frames?
Code;
Frame 1;
import flash.display.MovieClip;
var block_mc:MovieClip = new Block();
addChild(block_mc);
block_mc.x = 100;
block_mc.y = 100;
And then, on Frame 2...
stop();
How can I stop this issue from happening? If you want a more specific example, you can download the supplied .fla file.
Is there an efficient work-around other than creating for() loops to delete my greater-than 100 MovieClips? Is there no work-around? Please help!
Please note, to open the file you need a version of Adobe Flash Professional; I recommend using Adobe Flash Professional CC if you have it, since I used it.
If you need any more details, just ask! <3
Link to FLA: http://www.mediafire.com/download/tczfyj3jg3sofsj/Problem.fla
To say i am new to actionscript 3.0 is an understatement. But i am still trying to use it anyway. At the moment i am trying to create an interactive movie, with each frame in the main timeline containing a movieclip, and the movieclips containing the choices are the ones with buttons.
The issue here is simple, when the first button comes up the video freezes, and it seems like i can click the button but nothing happens when its clicked.
I have tried searching for a solution but it seems the only thing that comes up are ways to get the player to freeze when a button is clicked, sort of the opposite of what i'm looking for :)
The code at this point is really simple:
import flash.events.MouseEvent;
import flash.display.MovieClip;
this.Choice1R.addEventListener(MouseEvent.CLICK, ButtonHandler1);
function ButtonHandler1(e:MouseEvent){
MovieClip(this.parent as MovieClip).gotoAndPlay(3);
}
A simple stop(); tag is inside every keyframe in the main timeline to allow the movieclips inside to play, and that's about it. Every layer containing a button at this point looks sort of like this. Choice1R is in this case the instance name. If anyone can think of a reason why this would cause the swf file to freeze, any help would be appreciated.
Note: The sound keeps on playing as normal. No idea why.
I'm a total AS3 / Starling newbie, but I'm trying to (programmatically) add an FLV video file to the 'background' of what is essentially a splash screen.
Example code I have found online basically distills to...
var v:Video = new Video(100, 100);
this.addChild(v);
This works in the top-level class that extends flash.display.Sprite, however my Game class (that extends starling.display.Spite) fails, complaining of an "Implicit coercion of a value of type Video to an unrelated type DisplayObject."
Strangely enough, the signature of the addChild function on the Starling Sprite class is the same as that of the Flash Sprite class.
So basically the question is: why do I seem to be unable to add a Video object as a child to a Starling Sprite class (but successfully to a Flash Sprite class)?
I'm sure the answer is ridiculously simple... please let me know if I need to add more code or anything. Or if what I'm doing is totally the wrong way.
Or you could add the video to the Flash layer which sits above Starling:
Starling.current.nativeOverlay.addChild(v);
and
Starling.current.nativeOverlay.removeChild(v);
Bare in mind you are not using Starling GPU drawing with this though.
This is because the Starling framework was designed to mimic the regular Flash DisplayList (not completely recreating all the features though). Concretely, you are trying to pass a reference to an object of type starling.display.DisplayObject instead of flash.display.DisplayObject, which gives the appropriate error.
In order to play a video with Starling, you could upload each frame of the movie to a texture. Have a look at this topic on Starling's forum.
I'm working on a Flash project in CS6 and need to import a sound to my library but I'm having endless problems with it. I'm using external files in Actionscript 3.0 (e.g. I cannot do a URLRequest as it won't work externally, need to import)
I'm using a sound that should work, some errors go in that it can't be over 160kbps, this is only at 32 in the MP3 file. I converted it to an AIFF, no success, a WAV? no success.
If it's an MP3 I simply get "Couldn't import "
If it's a AIFF or WAV I get "One or more files were not imported because there was a problem reading them"
Adobe suggest you need to files under 160kbps, all are set at 32kbps to be safe.
Another suggestion said you needed Quicktime 7.7.1 (or newer) and iTunes 10.5.5.3 (or newer) for this to work with an MP3 file. I have Quick 7.7.3 and iTunes 11.0 so I really have no idea of the problem.
Can anyone help, this project needs finished quickly.
Thanks.
John.
Could be to do with bitrates.
I was running into issues with some mp3 files that I had converted from wav using Audacity. It was a specific few that wouldn't work, so I went back to Audacity and compared the working-mp3-yielding wavs to the non-working. I noticed that the working wavs had a bitrate of 44100Hz the non-working had 48000Hz. Setting the project rate ( bottom left corner ) to 44100Hz before exporting yielded mp3s that imported into flash with no problem.
In short:
48000 Hz = naughty
44100 Hz = nice
This is a weird problem here's a simple code snippet that load and play an MP3 sound AS3 doesn't support WAV natively :
//sound object
var sound:Sound = new Sound(new URLRequest("music.mp3"))
var soundChannel:SoundChannel = sound.play();
Hope this help :)
This post is kind of old but I thought I would post an answer after running into the same problem. I am also using Flash Pro in CS6. What you want to do is to embed the sound into your FLA so that when your SWF is compiled the sound will go with it. Khaled's answer is great but this issue needs a little more TLC.
What worked for me was to get an application that edits sound clips. I downloaded the open source 'Audacity.' In the bottom left corner of Audacity you can edit the project rate. Take it down to about 1600 or lower. Then save the project and export the sound as an mp3.
Finally, make sure that your sound clip is in the same folder as your FLA. Import into your FLA (this should work now) and export your sound for actionscript by right clicking the sound in the library, going to properties. Change the name of the class to whatever you want (at least get rid of the '.mp3' from the class name).
Then use the following code (which is different from the typical URL loader for sounds):
//sound is a constructor variable under your document class
public class DocumentClass extends MovieClip
{
var yourSound:yourSoundClass;
public function DocumentClass()
{
init();
}
function init():void
{
yourSound = new yourSoundClass();
}
}
Then play your sound by using yourSound.play(); This technique will embed your sound within the SWF so it will go wherever the SWF goes. I hope that helps anyone who runs into this.
I made a small game in Actionscript 3.0 and flash.
When the player wins the game or is 'game over' the player should have a option to replay the game.
So my question is: Is there a way to replay the whole movie with Actionscript? I know, i could reset the timeline back to 0, and re-instantiate all the classes, movieclips, var's ect... but i was wondering if anyone knows a easier solution.
Simply do this:
import flash.net.*;
//...
navigateToURL(new URLRequest(stage.loaderInfo.url), "_level0");
You can remove the swfObject and add it again. Look here. This is the swfObject reference.
Reload the page, where you've embedded the swf into, may be the easiest way.
The programmers way would be to encapsulate your whole application into a single class (extending Sprite or MovieClip) which will be attached to the stage. For restarting the game you could simply remove that instance from the stage and add a newly created onto the stage.
Or make a loader swf, that loads your game. Then if the game should be restarted, discard (unload) the instance and load it again.
Its hard to tell you what you can do, if we don't know, how your project is structured.