Solved

Video Play Pause (Flash CS3)

Posted on 2009-05-09
18
573 Views
Last Modified: 2013-11-11
Hi,

I hope someone notice this thread. I need help.

I have a video, I import it to Flash CS3. its .avi file. The video is animation page flip (2 minutes length video and 7 pages flip) The video is something like this http://www.youtube.com/watch?v=eQQorNhD2M8&feature=player_embedded
And I want to make next and previous button which can go to page 1 page 2 in the video.
Lets say~
Page 1 is video start/play from 00.00 - 00.20 (this is video time)
Page 2 is video start from 00.20 - 00.30

So If I click next button, the video will play starting from 00.20 (Page 2).
If I click prev button, the video will play starting from 00.00 (Page 1)

Do you guys think its possible to do it in flash?
I just start learning flash so I have no idea how am I going to do this.
Hope someone can help me.
Thanks in advance.

If  you cant understand my question, pls ask me.
Sorry for my poor English as its not my main language.
0
Comment
Question by:seamaster9095
  • 7
  • 7
  • 2
18 Comments
 
LVL 5

Expert Comment

by:Dobromir Yordanov
ID: 24343585
Ignore the timing,what's the general effect you're after?The user is on let's say page 1.He clicks next,the movie plays the part where the book turns from page 1 to page 2,he clicks previous,the movie plays the same in reverse as if he turned back to page 1. Is that it or you want something else? And do you want the pages to stay on screen for a predefined amount of time and then turn to the next one or the only way to turn to be with the buttons?
0
 

Author Comment

by:seamaster9095
ID: 24343621
Yes, I want this effect.
When the user on Page 1, he clicks next button then the movie play the part the book turns from page 1 to 2.
If he clicks previous button, the movie plays the same in reverse as if he turned back to page 1.
Do you this possible?
I am really new on Flash.
0
 
LVL 5

Expert Comment

by:Dobromir Yordanov
ID: 24344163
I'm pretty sure it's doable but I'm writing an article right now and I'll try it when I can.In the meantime,upload a sample video if you want so anyone who wants to help you can try.
0
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!

 

Author Comment

by:seamaster9095
ID: 24344563
I have uploaded the sample video

http://www.megaupload.com/?d=E9F92BJB

Pls help me figure out this. I need this urgent.
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24367348
i might not be understanding what u need, but if you need to skip to a point in a video, use seek()

ns.seek(20);

this assumes u r using netstream

rp / ZA
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24367533

okay, i think i misunderstood how the application was setup...

so you have an embeded video that is now in the timeline, right?


I found an really easy tutorial for you... I assume you are not using AS 3.0...  below is the link, and I have attached the code that was presented...

http://flashmove.com/forum/showthread.php?t=23828


you would use this code and instead of myButton, you would use the instance name of your previous button.  and based on the keyframe that you need to animate backwards to, you can change the value of 15 to the frame you want.


rp / ZA


myButton.onClick=function()
{
	this.onEnterFrame=reverseFrame;
}
this.reverseFrame=function()
{
	if (this._currentframe>15) 
	{
		this.prevFrame();
	} else {
		delete this.onEnterFrame;
	}
}

Open in new window

0
 

Author Comment

by:seamaster9095
ID: 24371500
The animation I import to Flash is not made in Flash.
I made it using 3ds max and import it to Flash. as FLVPlayback (.avi file)

And I only have one frame, how am I going to do it?
Sorry if confused you, I am totally new in flash.
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24375196
you need to re-import the AVI file into the Flash document, and select the embed in file option(last radio button) and then the video will be put in as many frames as needed to play the video with the Flash playhead.

make sure to first change your Frames Per Second number to match the Video frame rate


rp / ZA
0
 

Author Comment

by:seamaster9095
ID: 24383081
Can you explain in details? Like step by step how to do it.
I really don't understand flash at all. x_x
Hope you dont mind.
Thanks
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24385918

sure...

- start with a new document
- make the frames per second equal to your AVI (most likely 24 or 30) in the propertied panel
- then select File > Import to stage
- find the AVI file and select it
- a prompt will come up
- select the very last radio button, which should be labeled something like Embed Video in timeline
- then you just click OK for the rest of the pages
- if it ever asks you if you want to have the timeline expand to the number of frames in the AVI, selct yes

at the end of this you should have a layer with the AVI stretched to the end... and when you movie the playhead, the video will play with it...

Then use the above code to play the video in the way you want...

rp / ZA


0
 

Author Comment

by:seamaster9095
ID: 24396615
Okay, now I don't get the code.
I put the code in button and which one I need to change? xD
Do you have any link to learn this. I am @.@
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24396765
no, you don't put the code "in" or "on" a button, you put it on the timeline (or in a class for best practice).

you basically, need to create a movieclip...  so draw a shape, hit the F8 key, name the symbol, hit okay... then in the properties panel, give it an instance name.

the instance name I chose in the code above is "myButton"


rp / ZA

0
 

Author Comment

by:seamaster9095
ID: 24396875
I see. So the above code is reverse frame?
Where do I put it? And how about go to specific frame script.
I need it for my next page button.
I feel like asking so many questions. Hope u dont mind.
0
 
LVL 22

Accepted Solution

by:
rascalpants earned 500 total points
ID: 24397155

okay...  I assume you are using AS 2.0...  I have cleaned up the code, and posted it below...  

- it should be put into frame 1 in its own layer (top layer) and named "ACTIONS".

- create a new layer below the actions layer and call it "FRAME STOPS".

- then in the first frame and the last frame, create keyframes by hitting the F6 key

- then in the actions panel, type "stop();" in both keyframes

- you layer with the video embedded on the timeline should be below the others

- create two movieclips and give them instance names of "forward_btn" and "reverse_btn"


then you can compile the SWF (run it) and the buttons should make the timeline play forward and backwards.


rp / ZA







 
// import utility class to control scope
import mx.utils.Delegate;
 
 
// assign event handlers for buttons
forward_btn.onRelease = Delegate.create( this, startForward );
reverse_btn.onRelease = Delegate.create( this, startReverse );
 
// event handler for forward_btn
function startForward():Void
{
	play();
}
 
// event handler for reverse_btn
function startReverse():Void
{
	reverse_btn.onEnterFrame = Delegate.create( this, reverseFrame );
}
 
// event handler for onEnterFrame
function reverseFrame():Void
{	
	if (_currentframe > 2) prevFrame();
	else delete reverse_btn.onEnterFrame;
}

Open in new window

0
 

Author Comment

by:seamaster9095
ID: 24397731
So fast respond,  Ty.
So I need to create another layer for buttons?
because I just try nothing happened.
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24436066

yeah, typically your movieclips (buttons) should be on a separate layer.  Actions should be on a layer by itself, typically at the top.

if you start a new document, and do exactly as i stated above, this will work for you.


rp / ZA
0

Featured Post

Independent Software Vendors: 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

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
Viewers will learn how to turn a Live Set into a compressed Live Pack file, and how to install Live Packs. Make: File > Collect All And Save: File > Manage Files: Click Manage Project: Click Create Pack: Select save location: Install: Doub…
Viewers will get an overview of how to make and use Drum Racks in Ableton Live. Load new Drum Rack into empty MIDI track: Fill rack with audio samples: Re-arrange sample slots as necessary: Adjust parameters of each slot to tailor each sound a…

713 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