Copy link to clipboard
Copied
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
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...
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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).
Find more inspiration, events, and resources on the new Adobe Community
Explore Now