• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Structure Problem

Participant ,
Dec 29, 2008 Dec 29, 2008

Copy link to clipboard

Copied

I think this is a structure problem and I am new to OOP and I am not sure how to over come it. I have a Main class that sets up a web page. At the end of the set up it calls a FLVPlayer class. The FLVPlayer class displays the video and some text on the page. That is all working great. When the video finishes I want to go back to the Main class and have Main call another class to display some buttons. My problem is I do not know how to get back to the Main class from the FLVPlayer after the video has finished. I can call the buttons class from the FLVPlayer but then it becomes a child of the FLVPlayer class and I do not want that. I can also call another instance of the Main class from the FLVPlayer but I don't think that is good practice.

I hope I have explained that satisfactorily. Any help appreciated.
TOPICS
ActionScript

Views

444

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 29, 2008 Dec 29, 2008

Copy link to clipboard

Copied

Is FLVPlayer a class that you wrote or is it FLVPlayback component?

In any case you perhaps need to add an event listener in Main class to FLVPlayer that captures end of the video and then do what you need.

Is Main a document class?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 29, 2008 Dec 29, 2008

Copy link to clipboard

Copied

Great idea thanks, I will try that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 30, 2008 Dec 30, 2008

Copy link to clipboard

Copied

OK, I think this is the right idea but I can't get it to work. To answer your questions, the FLVPlayer is my own class I wrote and it displays the FLVPlayback component with a text field. On completion of the video it removes the FLVPlayback component and the text field to leave a blank page ready for the buttons to come on.
I put the Listener in the Main class, which is the Document Class, like this:

//This adds the video from the Main class
var introVid:FLVPlayer=new FLVPlayer("FLV/introFLV.flv",360,240);//FLVPlayer my class
introVid.x=30;
introVid.y=330;
addChild(introVid);

introVid.addEventListener(VideoEvent.COMPLETE,mainBtns);//don't think this is the right thing to listen for

function mainBtns():void {
trace("Got Here");//This would be the code to bring on the buttons.
}

I'm not sure what I should be listening for, video complete, FLVPlayback component removed from the display list or the FLVPlayer class finished. Could you give me some code ideas?
Thanks again.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 30, 2008 Dec 30, 2008

Copy link to clipboard

Copied

LATEST
Don't have time right now to get into all the details of your code.

Try:

introVid.addEventListener(VideoEvent.COMPLETE,mainBtns, true); - note third parameter "true".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines