How to create play and pause in SWF Format? - html

I am beginner to Flash.
I am having a SWF Format, I have to keep that in my html page like a video. I need a play and pause button in that video.
Thank you.

SWF file is time line based, even if you convert a movie from AVI to SWF generally there is some sort of key frames.your converting program will offer the properties of this inside the software
Easier way to control a SWF movie would be to embed your FLV into the SWF, than add key frames manually. then you can control from a parent SWF with timeline control
If your just playing a movie file in flash , it may be better to use "net-stream" this will allow you to have also full control over the movie file using cue points, this has other advantages ....quicker loading times, as the whole file would not have to be downloaded first as it allows streaming / Buffering. Using cue points has the same ability as key frames.
so your pause and play button is dependent on how you implement your video

Related

Flash Video Loading Issue

Please click on the below link
http://hpecp.vmokshagroup.com/videobook/html/homepage.html
When we click on "What is VideoBook" link we got some blank screen before starting the swf file due to video fetching from the server. We have to avoid blank screen.
We are facing a problem of fetching the video clips from the hosting server. I added two video clips in Flash (.swf)... one is from the beginning, another one is at the ending and in between some text animations.
While we are playing/calling .swf file in browser from hosting server, initially getting blank screen. It takes some time to fetching the video clip from server due to size. Starting of first video clip duration is about 3-6 seconds. While video is being loaded.. text animation is starting without playing first video clip. Same problem we are facing in second video at the ending.
Is there any option to incorporate video clips internally in Flash (.swf file) rather than calling from external server or external file path?
Any help would be appreciated.
This happens because of the JavaScript that you use - it actually makes the swf files (in)visible depending on the situation. What this does is that it actually loads the .swf files each time. You can check that in the Network tab of your debugger (I'm using Chrome).
So it first loads Video-01d.swf, or Video-02.swf. They take time to load, and just when the main file is loaded, it starts to load the video file (video1.flv).
All that causes delay, and it's pretty normal as you have all that things in separate files. If you want to, you can merge them into one - just import the flv inside your .swf file and it will work out well..
Of course, you will need to change all your logic for the flash files that you are playing. You will also need to change the JavaScript to call Flash functions in order to tell it to go to another "scene".
I will advise you to add a simple gif loader image (like this), put it as a background-image of the div, and put some color into that div. What the user will see is that the movie disappears, there is a black background with a loading symbol inside, and then the new video begins. It's a normal thing to see online - preloaders :) Good luck!

Create SWF video of images through Adobe Flex

I don't know whether it's the right place to put this up. But I've been trying from past 12 hours and haven't found anything related.
I'm creating a Adobe AIR project (which'll run on desktop), it'll ask for image locations on the local pc.
After the user is done selecting images. I want to output a SWF video (slideshow) of the selected images.
How to do the second step. Please guide. I want to create an output file (SWF) from my AIR Flex Desktop Application.
Check out https://github.com/claus/as3swf to compile SWFs at runtime...
This individual seems to have had a similar issue AS3 to Generate Dynamic SWF?
You can try following options from SWFtools
JPEG2SWF Takes one or more JPEG pictures and generates a SWF slideshow from them. Supports motion estimation compression (h.263) for better compression of video sequences.
PNG2SWF Like JPEG2SWF, only for PNGs.
GIF2SWF Converts GIFs to SWF. Also able to handle animated gifs.
Here is what I did :
Install the as3 compiler (mxmlc)
Run the command mxmlc.exe sample.as3 using NativeProcess

SWF file seek information

Is it possible to get and set seek position of a swf file (either in ActionScript 2/3 or ActiveX API of Flash Player) ?
I tried to use frame number at first (to determine which part of the movie is being played) however sometimes whole animation has 2 frames and it does not help.
Any ideas?
Thanks.
if your loaded SWF contains all animation on the stage timeline ( i mean the top level ) then the progress you are seeking is:
var progress:Number = swf.currentFrame / swf.totalFrames;
if you want to set seek:
swf.gotoAndPlay ( progress * swf.totalFrames )
Also it can be that the all animation is not on the top level, but in the movieClip, which address you know, i mean stage.getChildByName ( 'something ).getChildeByName ('something )...
but if you have an swf where are multiple movieclips, and they are playing independantly, then nothing i can help....
Not without coding something in to the SWF as far as I know. Because animations in Flash can be in embedded MovieClips, or entirely scripted in a single frame, there is no easy way to detect the total playing time or how far an animation has progressed. Any get/seek functionality, or even a progress broadcast, would have to be scripted in the SWF and accessed through ExternalInterface.
Please be more specific about your problem. If your swf file is only 2 frames, then what is it that you are trying to seek through? Does your swf load a video, for example, and this is what you are trying to seek through? (In which case you can get properties of a video object's playback position and state).
Without more information, it's hard to provide a clear answer.

FLV video tagging using ActionScript 3

I would like to tag some parts on screen (like tagging people's head in photos in Facebook) in video (in certain second). Videos are in FLV format, video on demand. Is there any library that I can use to tag the video? or I can only use a cue point?
Environment:
Flash Media Server
Flash CS4 (ActionScript 3)
Other information can be further given. Ask me.
I don't know if there is a library (which doesn't mean there isn't any), but you could do it with cuepoints:
Create cuepoints in your video (either on encoding, or put them in on runtime via actionscript cuepoints) that have x, y, width, height as params, maybe also a duration and description.
Type for encoding cuepoints probably would be navigation, so you can get the nearest Cuepoint on seeking.
Then you need actionscript to listen for your cuepoints, and then draw those rectangles as an overlay over the video.
There is NO direct solution of this issue. I end up have to record the time in a Flash embedding the movie player and make tagging actions there.

In as3 can we dynamically load .swf movies in any player(in web) like flv player?

I want to dynamically load .swf file in a player(like FLV player of as3) in as3.When I shall click on an image the corresponding video will be played on the player on right side(like you tube). Is there something (like FLV player) for .swf files with play, pause, resume, scrubber options to play in web?
You can start with AS3's Loader Class, which will allow you to load and place SWF files in your application.
Controlling the loaded swf's position is going to be a bit trickier, and you may need to have a Movie Clip with a specific linkage name in the .swf, from which you can create an instance in your code and control with the standard MovieClip timeline commands. You should be able to create some controls that work with gotoAndPlay/gotoAndStop/etc
There are a lot of AS3 video players out there. Here is a tutorial that lets you create one. Once you create your FLVPlayer, you can load it using a Loader object.
I think this does what you are looking for.
var SWFLoader:Loader=new Loader();
screen_mc.addChild(SWFLoader);
function loadSWF(evt:MouseEvent):void{
if (evt.target==one_btn){
SWFLoader.load(new URLRequest("one.swf"));
}
else if (evt.target==two_btn){
SWFLoader.load(new URLRequest("two.swf"));
}
}
one_btn.addEventListener(MouseEvent.CLICK,loadSWF);
two_btn.addEventListener(MouseEvent.CLICK,loadSWF);