A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: FLV playback wont stop after the page has changed

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    3

    Question FLV playback wont stop after the page has changed

    (Flash ActionScript 3)

    Hi there,

    I'm very new to Flash and i am trying to close a FLVPlayback component from a button in a parenting movieClip

    I have been successful in closing the video using a button from the same movieClip that the component resides.

    I did this using the following AS:

    .................................................. .................................................. ...........


    test_btn.addEventListener(MouseEvent.CLICK, test_btnClickHandler);
    function test_btnClickHandler(event:MouseEvent):void {
    showreel_flv.getVideoPlayer(showreel_flv.activeVid eoPlayerIndex).close();
    MovieClip(parent.parent.parent).allPages.gotoAndPl ay("cv");
    trace("test_btn Button CLicked");
    }


    .................................................. .................................................. .........


    But i am wanting to use a button that is at least a x3 parent of the component.

    This is the hierarchy of my site (all movieClip's):

    entireSite>allPages>showreel_page>showreel_video> (the component).

    the button i want to use is in:

    entireSite>allPages>footer_btns> (the buttons)


    if someone could show me how to direct my command to the component, then quite frankly, you would be my hero!


    Thank you so much

    I'd be very grateful if anyone could even point me in the right direction, and i will help others as much as i can.

  2. #2
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    maybe you can add the actions to the footer from "entireSite":

    PHP Code:
    var btnDir:MovieClip allPages.footer_bnts.test_btn;
    var 
    videoDir:MovieClip allPages.showreel_page.showreel_video;

    btnDir.addEventListener(MouseEvent.CLICK,test_btnClickHandler);

    function 
    test_btnClickHandler(event:MouseEvent):void {
    videoDir.showreel_flv.getVideoPlayer(videoDir.showreel_flv.activeVideoPlayerIndex).close();
    allPages.gotoAndPlay("cv");
    trace("test_btn Button CLicked");

    Not sure if this will work though, cause I don't know how you used the timeline to make your project (one frame with all actions, or one frame with embedded movieclips with each their own actionscript or multiple frames with or without embedded actions inside of movieclips)..
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  3. #3
    Junior Member
    Join Date
    Jul 2009
    Posts
    3

    Question Not working just yet!

    Thank you so much for your quick reply!

    I've been messing around with the script you gave me but unfortunately it's not solved yet.

    It plays with only an error of:

    .................................................. .................................................. .............
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at IndexTests2_fla::entireSite_4/frame1()
    .................................................. .................................................. .............

    when i try to click the button it's as if the button has no script at all and the trace isn't visible.


    the entireSite (movieClip) is one frame with embedded movieclips each with their own actionscript and multiple frames.

    so to break it down further

    entireSite>allPages>showreel_page>showreel_video> (the component).


    scene 1 (2 frames---1.preloader / 2.entireSite movieClip)

    1. entireSite> (one frame)


    2. allPages> (multiple frames with labels)


    3. showreel_page> (15 frame ani) + 3. footer_btns>(ActionScript one frame)


    4. showreel_video> (one frame holding the component)


    5. the component = showreel_flv.



    Thanks again, I'll keep trying variations on your script, and some new google searches.

  4. #4
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    It's probably due to the multiple frames that it won't work..
    But I'm not giving up, so forget my previous post and try this:

    PHP Code:
    test_btn.addEventListener(MouseEvent.CLICKtest_btnClickHandler);

    function 
    test_btnClickHandler(event:MouseEvent):void {
    // in which parent.parent get you up 2 levels from where the btn is:
    // test_btn > footer_btns > allPages
    // and then it digs down again into allPages, but towards your component:
    // allPages (=parent.parent) > showreel_page > showreel_video
    var vidDir:DisplayObject = (parent.parent as MovieClip).showreel_page.showreel_video;

    vidDir.showreel_flv.getVideoPlayer(vidDir.showreel_flv.activeVideoPlayerIndex).close();
    MovieClip(parent.parent.parent).allPages.gotoAndPlay("cv");
    trace("test_btn Button CLicked");

    So this is how you had it in the beginning, with the code on the btn's timeline, but with some parenting methods to get to where the component is.

    And if this doesn't work, then I'm all out of solutions
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  5. #5
    Junior Member
    Join Date
    Jul 2009
    Posts
    3

    Thumbs up No luck! but i have a temporary Fix

    Hi again,

    Thank you for your persistence, it unfortunately did not work. I guess as you said it must be because of the multiple frames. so when i have time i will re-create the site avoiding multiple frames whenever possible.

    I have done a work around for now, where i just added the footer btns to the showreel_video(movieClip) where the component is (only for that one page). I made a seamless transition between the standard buttons and the new page buttons so you can't see them swap.

    not the cleanest job but it works for now

    Thanks again, i'll keep you and everyone who is looking for the same solution posted.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center