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

2 functions to one button click

New Here ,
Nov 13, 2013 Nov 13, 2013

Hi im creating a banner using the youtube api. What i want is that when you press the button to go to the another video also it apused. Ialready make it work but when i do the same to the other buttons it start creating errors and not working

function  playRockabillyon(event:MouseEvent)

{

    gotoAndStop(12);

    videoPlayer.pauseVideo();

}

rockabillyon.buttonMode = true;

rockabillyon.useHandCursor = true;

rockabillyon.addEventListener(MouseEvent.CLICK, playRockabillyon);

TOPICS
ActionScript
747
Translate
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

correct answers 1 Correct answer

LEGEND , Nov 14, 2013 Nov 14, 2013

I have to assume that the errors are pointing at the lines where you are targeting the different players.  The 1009 error indicates that an object you are targeting does not exist as far as the code sees it - it looks like that's true for a number of the players you target.  If those players are not present in the frame where that code executes you will get that error.

You should go into your Flash Publish Settings and select the option to Permit Debugging.  That won't solve the problem but it wi

...
Translate
LEGEND ,
Nov 13, 2013 Nov 13, 2013

I am not able to understand your problem, nor what you are trying to do that involves two functions with one click.  If yoiu mean the two lines inside the playRockabillyon function, they should not be a problem, though I would change the order of them so that the change of frames is not commanded until the video is paused

What errors are you getting?

Translate
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
New Here ,
Nov 14, 2013 Nov 14, 2013

Hi the problem is that im trying to do a masthead with many youtube players, and when one start and u open another it keep running, so what i want is, that when you press the button to bring you to the other player it stop the video that is runing also. and it works but when im start adding more than one lines inside the playRockabillyon it work sometimes and sometimes no. Right now im changing the way of doing this I thought that is better if all players stop when u go to the frame of an specific player but I have the same problem it works at the beggining with one line but affter adding more it stop working, it only pause the videoPlayer.pauseVideo

stage.addEventListener(Event.ENTER_FRAME, onFrameEnter);

function onFrameEnter(e:Event)

{

    videoPlayer.pauseVideo();

     videoPlayer2.pauseVideo();

    videoPlayer3.pauseVideo();

    videoPlayer4.pauseVideo();

    videoPlayer5.pauseVideo();

    videoPlayer6.pauseVideo();

    videoPlayer7.pauseVideo();

    videoPlayer8.pauseVideo();

    videoPlayer9.pauseVideo();

    videoPlayer10.pauseVideo();

}

Translate
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
New Here ,
Nov 14, 2013 Nov 14, 2013

These is the error that appear

TypeError: Error #1009: Cannot access a property or method of a null object reference.

    at YT_Masthead_970x250_child_fla::MainTimeline/onFrameEnter()

TypeError: Error #1009: Cannot access a property or method of a null object reference.

    at YT_Masthead_970x250_child_fla::MainTimeline/onFrameEnter()

TypeError: Error #1009: Cannot access a property or method of a null object reference.

    at YT_Masthead_970x250_child_fla::MainTimeline/onFrameEnter()

TypeError: Error #1009: Cannot access a property or method of a null object reference.

    at YT_Masthead_970x250_child_fla::MainTimeline/onFrameEnter()

TypeError: Error #1009: Cannot access a property or method of a null object reference.

    at YT_Masthead_970x250_child_fla::MainTimeline/onFrameEnter()

Translate
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 ,
Nov 14, 2013 Nov 14, 2013

I have to assume that the errors are pointing at the lines where you are targeting the different players.  The 1009 error indicates that an object you are targeting does not exist as far as the code sees it - it looks like that's true for a number of the players you target.  If those players are not present in the frame where that code executes you will get that error.

You should go into your Flash Publish Settings and select the option to Permit Debugging.  That won't solve the problem but it will enhance the error messages to include the line numbers where the errors are occuring

Translate
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
New Here ,
Nov 20, 2013 Nov 20, 2013
LATEST

Thanks I solve it

Translate
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