FORUMS: list search recent posts

Making Flash act like a DVD

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mark Allen
Making Flash act like a DVD
on Aug 25, 2009 at 11:15:02 pm

After tutorials and web searches and manual reads, I still can't figure out how to do what I thought would be a simple task;

This is what I'm trying to do and my problem:

I am trying to make an online version of what will be my DVD. I have made the interface i photoshop and imported it into flash. I now simply want to have the selection button have the movie jump to a particular frame where that movie selection will play and then when it's done - jump back. I will add a return to main menu at the bottom as well.

Thus far I have the buttons working (and trace confirms) - and I can even have the button jump to the frame I want and start to play the movie there.

However... when I add any code that suggests that the movie should jump back to the main menu (or really any code at all) on the frame where the selected movie plays... the playback suddenly "breaks" and instead of stopping at the first frame and waiting, the movie plays a constant loop.

Maybe there is an easier way to approach this. I realize the encore will do this as a function/feature - but I don't know how to use encore and would rather learn a little flash than a little encore.


So - in my current file on frame one I use this action:


stop();


intro_btn.addEventListener(MouseEvent.CLICK, playIntroM);

function playIntroM(Event:MouseEvent):void
{
trace("clicked intro");
}

discovery_btn.addEventListener(MouseEvent.CLICK, playDiscoveryM);

function playDiscoveryM(Event:MouseEvent):void
{
gotoAndPlay(50);
};

// The folowing code is something I found on the web and plugged in here because I couldn't figure out where else to put it.... and like all the other code - when I add it, the movie does a weird constant looping.


_videoPlayer.addEventListener(VideoEvent.COMPLETE, onComplete);

function onComplete(evt:Event):void
{
gotoAndStop(1);
};


Any help would be greatly appreciated. Getting flash to act like a DVD didn't seem to be a dramatic task - but I've obviously underestimated it.

I've found this code on the web s well...

stop();

var listenerObject:Object = new Object();
listenerObject.ready = function(eventObject:Object):Void {
onEnterFrame = function () {
if (myFlv.playheadTime == myFlv.totalTime) {
_root.play();
delete onEnterFrame;
}
}
}

myFlv.addEventListener("ready",listenerObject);

but I'm not sure how or where I use use this...



Thank you.



Return to posts index

Aisha Nelson
Re: Making Flash act like a DVD
on Aug 27, 2009 at 2:40:02 pm

Mark,

I am trying to do the same thing. I'm new to flash and am having difficulty getting started. How did you get the button to jump to the frame you want and start to play the movie there?

Did you use the current code you have in your post?


Return to posts index

Mark Allen
Re: Making Flash act like a DVD
on Aug 28, 2009 at 6:27:00 am

I'm afraid it's turning out to be more difficult that I'd expeced. I think the "way it's done now" is that seperate as files are used to hold all the code. Adobe has a jukebox example on their site, but it's more complex thatn what I was intending. To answer your question though - the code for getting a button to jump somewhere is:

with the INSTANCE NAME of the button called discovery_btn

the playDiscoverM is me naming my own function. The gotoAndPlay(50) is telling it to go to and play frame 50.


discovery_btn.addEventListener(MouseEvent.CLICK, playDiscoveryM);

function playDiscoveryM(Event:MouseEvent):void
{
gotoAndPlay(50);
};





Return to posts index


cowcowcowcowcow
demetri tashie
Re: Making Flash act like a DVD
on Aug 28, 2009 at 2:21:32 pm

this should not be that difficult to work out. what i would suggest is that you use FLV Encoder to add event CuePoints at the end of each of your videos.

those will best trigger a function that can 'return' to your 'Main Menu'

here is a quick, 'down and dirty' example using 3 short video clips. if this is what you are trying to accomplish, let me know and i can supply the code and explanation ( there are several ways to approach this...)

ww.demetri-media.com/FlashTalker/DVDmenu.swf



Return to posts index

Aisha Nelson
Re: Making Flash act like a DVD
on Aug 28, 2009 at 2:25:00 pm

Demetri,

That is exactly what I am trying to accomplish. Please help!


Return to posts index

Mark Allen
Re: Making Flash act like a DVD
on Aug 28, 2009 at 8:17:05 pm

This movie you made is EXACTLY what I'm trying to do. Can you provide the code and examples so I can disect it and use?

That would be great. Right now I was in the midst of trying to rewrite the VideoJukebox from adobe and that was just so much extra code to manage.





Return to posts index


Mark Allen
Re: Making Flash act like a DVD
on Jan 24, 2010 at 11:55:06 am

I said I would come back and post the result of this and I never did. Again, I really appreciated demetri tashie's effort on this - he was fantastic.

http://www.markallen.net/demo

(If I did remember and am reposting, I'm sorry, I was here and suddenly thought I had not... but there is the end result.)



Return to posts index

demetri tashie
Re: Making Flash act like a DVD
on Aug 28, 2009 at 3:59:15 pm

sorry - i just re-read your post and want to offer another simple way, which you had a lead on.

as stated earlier, there usually are several different ways to get the same result.

so, using the VideoEvent.COMPLETE is a fine way to do this also.
but you need to add and change a few things. a complete working code for that would be:

import fl.video.VideoEvent;

_videoPlayer.addEventListener(VideoEvent.COMPLETE, onComplete);

function onComplete(evt:VideoEvent):void{
gotoAndStop(1);
}


so i would make sure to first import the VideoEvent class , and then to reference it in the function as "evt:VideoEvent" , and not just "evt:Event" as you had it.
those few changes should make it work like a charm. let us know how it works out for you..



Return to posts index

demetri tashie
Re: Making Flash act like a DVD
on Aug 28, 2009 at 6:08:05 pm

Aisha-

i think i responded without seeing your response.

so - let m eknow if i answered your question, and helped you in my previous post with the code for doing it via 'VideoEvent.COMPLETE" or if you want to do it via CuePoints


Return to posts index


Aisha Nelson
Re: Making Flash act like a DVD
on Aug 28, 2009 at 6:18:14 pm

I think (or hoping) that it will be easier doing cue points. I set cue points in the Encoder. This is the code I'm using to seek the chapters:

function cue4() {
var c= this._parent.my_flvPb.findCuePoint("chapter 3");
this.parent.my_flvPb.seekSeconds (c.time);


}

I'm assuming that where it says (c.time) I am to enter the timecode for the cue points? Would I be right in saying that?

Also, when trying to link the buttons to the in and out points I am using

seek_btn_1.onRollOver = gotoIn;
seek_btn_1.onRollOut = gotoOut;

but its saying that I need an addEventListener handler.
I am new to flash, so this is all foreign to me. I thought I was making some progress, until I started getting errors



Return to posts index

demetri tashie
Re: Making Flash act like a DVD (AS3 response)
on Aug 28, 2009 at 7:42:12 pm

are you using AS3 or AS2 ? this will make a huge difference.

my original file was set up( in AS3) as 3 separate videos to choose from from the main menu., each video which when finished, links back to the main menu.

you seem to be trying to use the buttons to choose chapters from a single stream ? if so that is handled a little different.

besides the EVENT type of CuePoint that you will put on the end of the video ( to trigger the function to get you back to the main menu), you will also need NAVIGATION typr of CuePoints that will act as 'chapter markers' . then and only then can you click a button and get to a specific point in a video ( and then, only if it has at least loaded up to that point)

if you are only using 1 video, with multiple chapters, not so bad - we will actually have that video loading while just the menu is showing. if you are having several videos with their own individual chapters, it needs to be worked differently, to get over the need to have the video (pre)loaded at least up to the point of the Cue Points for them to work and not throw out errors.

also as far as the code you have written- i would be using very different code to accomplish that ( much simpler than what you have wriiten)

hope that makes sense. but first let me know that you are using AS3 and then i can further code it for you.


Return to posts index

Aisha Nelson
Re: Making Flash act like a DVD (AS3 response)
on Aug 28, 2009 at 7:54:40 pm

I am using AS3.

I am trying to use the buttons to choose chapters from a single stream. It's one video and I have to use the buttons to go to a specific cue point in the video


Return to posts index


Mark Allen
Re: Making Flash act like a DVD (AS3 response)
on Aug 28, 2009 at 8:19:36 pm

I'm not sure about Aisha but I (the OP) am using AS3.

If I could get your fla file to dissect that would be fabulous as one of my problems seems to be an uncertainty with how to lay this out.

Thanks again for coming to my rescue.



Return to posts index

demetri tashie
Re: Making Flash act like a DVD (AS3 response)
on Aug 29, 2009 at 12:42:54 pm

hi mark, hi aisha,

hang in there just a while longer - i am writing up how to do this ( both ways ) so others can also learn from this.

i will post soon

-demetri-


Return to posts index


cowcowcowcowcow
demetri tashie
Re: Making Flash act like a DVD (AS3 response)
on Aug 30, 2009 at 2:27:45 pm

hi mark - i posted a long explanation, and the code to make it all work, her:
ww.demetri-media.com/FlashTalker/VideoEvent.html

i trust you can work it out from that. if you still have any questions- feel free to ask!

aisha - i will post your version shortly....


Return to posts index


demetri tashie
Re: Making Flash act like a DVD (AS3 response)
on Aug 30, 2009 at 4:05:04 pm

aisha-
here is the detailed explanation, and working code for what you want to do.

i hope this helps. feel free to ask if you have more questions.

ww.demetri-media.com/FlashTalker/CuePoints.html


Return to posts index

Aisha Nelson
Re: Making Flash act like a DVD (AS3 response)
on Aug 31, 2009 at 3:24:29 pm

Everything seemed to be going well, but I received this output error message:

VideoError: 1003: Invalid seek
at fl.video::FLVPlayback/seekToNavCuePoint()
at USPTATechCD_menu_fla::MainTimeline/movie1()


Return to posts index

Aisha Nelson
Re: Making Flash act like a DVD (AS3 response)
on Aug 31, 2009 at 3:31:20 pm

Ok, so I fixed that error, however when press ctrl+enter my video along with the buttons disappear. I can hear the change in the audio (which indicates the chapters are changing) but there's no video and my buttons disappear.


Return to posts index


demetri tashie
Re: Making Flash act like a DVD (AS3 response)
on Aug 31, 2009 at 4:17:06 pm

aisha-
the error message ( which you say you fixed already) was happening because you were trying to access the cue point before the movie had loaded up to that point. i hope you understand that concept ( and limitation ) of this method. as stated , the code could be elaborated on to take all of that into account.


i am not sure what you mean by control+return - are you talking about when testing the movie in the Flash environment, or once published?

the other issues i imagine are just a matter of being clear as to the logic of your choices. first off- i am assuming you are keeping the 1-frame swf model, and not projecting the project out into the timeline?

the logic goes like this- turn on the visibility of the items you want visible for each circumstance, and turn off what you don't want.

if you elaborate your question, and give more of an idea as to how you have it set up ( code examples too ) then we'd be glad to further help out.


Return to posts index

Aisha Nelson
Re: Making Flash act like a DVD (AS3 response)
on Aug 31, 2009 at 4:24:21 pm

Finally!!! I got it! Thanks so much! I did have to adjust thee visibility and it worked fine. Once again thank you. Please let me know if you have any other tutorials that I could subscribe to. It was a big help!

Aisha


Return to posts index

Mark Allen
Re: Making Flash act like a DVD (AS3 response)
on Aug 30, 2009 at 9:10:38 pm

Thank you so much!!!! I will post my finished project after successfully building the DVD - hopefully in the next day or so.

I suspect many people will find your tutorial helpful.

Thanks again.



Return to posts index

Mark Allen
Re: Making Flash act like a DVD (AS3 response)
on Oct 9, 2009 at 12:27:58 am

okay - so I'm just about done (had to take a work break before I could continue) but I'm finding one thing which is stumbling me and I'm wondering if there is a solution:

Some of my movie files need to play another movie right when they finish. For example - one category is just the name of a client and I have 4 different clips meant to go for that button. Also - i would ideally have a play all button.

Now, I COULD just edit these movies together except for one problem: Different frame rates. Is there any reasonably simple way to have these buttons trigger a play list of movies?

Thanks.





Return to posts index

Mark Allen
Re: Making Flash act like a DVD
on Aug 29, 2009 at 1:13:11 am

I tried it unsuccessfully - I think my problem might be the overall structure. If I could get your sample file I am confident I could adapt that. thanks!



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]