Skip to main content
Participating Frequently
November 20, 2013
Answered

buttons stop working randomly

  • November 20, 2013
  • 1 reply
  • 670 views

Hi Im doing a youtube masthead banner with multiple video players. the problem that I have is that on certain times the buttons from the right side stop working, and sometimes also the ones from the left, I dont know what can be creating that.

This is the code that I use with the video, and the buttons. And here is the swf so u can try and see the error http://alejuu.com/demo/vice/banner/YT_Masthead_970x250_parent.swf

import flash.events.MouseEvent;

import com.google.ads.studio.events.StudioEvent;

stop();

Security.allowDomain("www.youtube.com");

var videoPlayer:Object;

var loader:Loader = new Loader();

     loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);

     loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));

function onLoaderInit(event:Event):void {

     addChild(loader);

     loader.content.addEventListener("onReady", onPlayerReady);

}

function onPlayerReady(event:Event):void {

     trace("Ready");

     videoPlayer = loader.content;

     videoPlayer.setSize(230, 172); //PUT THE DIMENSIONS OF YOUR VIDEO IN THIS LINE

     videoPlayer.loadVideoByUrl("http://www.youtube.com/v/Eo9V0FrKGu8", 0);//PUT YOUR VIDEO URL IN THIS LINE

     videoPlayer.x = stage.stageWidth/2.0 - videoPlayer.width/2.0;

     videoPlayer.y = stage.stageHeight/1.60 - videoPlayer.height/1.60;

}

function  playRockabilly(event:MouseEvent)

{

    gotoAndStop(3);

}

rockabilly.buttonMode = true;

rockabilly.useHandCursor = true;

rockabilly.addEventListener(MouseEvent.MOUSE_OVER, playRockabilly);

function  playBiker(event:MouseEvent)

{

    gotoAndStop(4);

}

biker.buttonMode = true;

biker.useHandCursor = true;

biker.addEventListener(MouseEvent.MOUSE_OVER, playBiker);

function  playHiphop(event:MouseEvent)

{

    gotoAndStop(5);

}

hiphop.buttonMode = true;

hiphop.useHandCursor = true;

hiphop.addEventListener(MouseEvent.MOUSE_OVER, playHiphop);

function  playCholo(event:MouseEvent)

{

    gotoAndStop(6);

}

cholo.buttonMode = true;

cholo.useHandCursor = true;

cholo.addEventListener(MouseEvent.MOUSE_OVER, playCholo);

function  playSurf(event:MouseEvent)

{

    gotoAndStop(7);

}

surf.buttonMode = true;

surf.useHandCursor = true;

surf.addEventListener(MouseEvent.MOUSE_OVER, playSurf);

function  playRock(event:MouseEvent)

{

    gotoAndStop(8);

}

rock.buttonMode = true;

rock.useHandCursor = true;

rock.addEventListener(MouseEvent.MOUSE_OVER, playRock);

function  playOtaku(event:MouseEvent)

{

    gotoAndStop(9);

}

otaku.buttonMode = true;

otaku.useHandCursor = true;

otaku.addEventListener(MouseEvent.MOUSE_OVER, playOtaku);

function  playSkate(event:MouseEvent)

{

    gotoAndStop(10);

}

skate.buttonMode = true;

skate.useHandCursor = true;

skate.addEventListener(MouseEvent.MOUSE_OVER, playSkate);

function  playHinrgy(event:MouseEvent)

{

    gotoAndStop(11);

}

hinrgy.buttonMode = true;

hinrgy.useHandCursor = true;

hinrgy.addEventListener(MouseEvent.MOUSE_OVER, playHinrgy);

This topic has been closed for replies.
Correct answer kglad

you have so many null object errors it's hard to believe you could publish that swf without seeing the errors.  there are dozens of functions with null object errors.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
November 20, 2013

you have so many null object errors it's hard to believe you could publish that swf without seeing the errors.  there are dozens of functions with null object errors.

Participating Frequently
November 20, 2013

Sorry, Im a newby in as3 how can I fix these null onject problem?