Skip to main content
Participant
January 17, 2013
Answered

flash button stops working after 1 click

  • January 17, 2013
  • 2 replies
  • 641 views

So i have 3 buttons and when i click neither of them ,the clicked one loads the image that i want and them all of them stops working.

import flash.events.MouseEvent;

import flash.net.URLRequest;

imgbtn1.addEventListener(MouseEvent.CLICK, OnReleaseMyButton1);

function OnReleaseMyButton1(event:MouseEvent):void

{

    infoField.visible = true;

    var imageLoader:Loader = new Loader();

    imageLoader.load(new URLRequest("picture1.png"));

    addChild(imageLoader);

    trace("BUtton1");

}

imgbtn2.addEventListener(MouseEvent.CLICK, OnReleaseMyButton2);

function OnReleaseMyButton2(event:MouseEvent):void

{

    infoField.visible = true;

    var imageLoader:Loader = new Loader();

    imageLoader.load(new URLRequest("picture2.png"));

    addChild(imageLoader);

    trace("BUtton2");

}

imgbtn3.addEventListener(MouseEvent.CLICK, OnReleaseMyButton3);

function OnReleaseMyButton3(event:MouseEvent):void

{

    infoField.visible = true;

    var imageLoader:Loader = new Loader();

    imageLoader.load(new URLRequest("picture3.png"));

    addChild(imageLoader);

    trace("BUtton3");

}

//

/*function startLoading(whichImage)

{

    var imageLoader:Loader = new Loader();

    imageLoader.load(new URLRequest("whichImage"));

    addChild(imageLoader);

} */

Here is a link to the .swf file to see what exactly i mean.http://www.fileconvoy.com/dfl.php?id=gf45387fd831a092a999199587cb570046f7c5cf00

This topic has been closed for replies.
Correct answer

I see you're loading a png - is the png blocking the buttons once you add it? Transparency in the png will block the buttons...

2 replies

Correct answer
January 17, 2013

I see you're loading a png - is the png blocking the buttons once you add it? Transparency in the png will block the buttons...

GenereousAuthor
Participant
January 17, 2013

Oh, i didnt know about that, i will test now.I"ll make the png really small and will see if the buttons are working. OK , thanks for the fast help.Transparency was the problem,hiding the buttons and making them inactive(or unable to click on them).

Ned Murphy
Legend
January 17, 2013

I don't see anything happening in the swf you identified except the buttons reacting to mouse inetraction.   When you test in the IDE do you get the traces that you have in each function?