PDA

View Full Version : Crazy button has a mind of its own!



aligray
June 12th, 2008, 10:45 AM
Hi guys hope someone can help. Ive just got a simple button, on mouse over it clanges colour which all works fine and on the hit state i want to embed a movie clip that makes the button slide up like a tab. ive embedded a working movie clip but it doesnt work when the button is clicked. any ideas? im going crazy here! its in AS3 by the way

tizbo1423
June 12th, 2008, 10:56 AM
i'm not sure how to fix that, but i have a question for you if you don't mind. how do you make buttons work with AS3?! I make the buttons. The roll over works (i don't even know how to make it roll up like a tab.. how do you do that?). But, i can't add actions to it, so when the button is clicked, it will never go anywhere. do you know how to make them clickable with AS3??

aligray
June 12th, 2008, 11:02 AM
yeah its all about as3. you need to put in the timeline of where the button is some code. Something like this:

var yourbuttonLoader:Loader = new Loader();
yourbuttonLoader.contentLoaderInfo.addEventListene r(Event.COMPLETE, youbuttonLoaded);
yourButton.addEventListener(MouseEvent.CLICK, yourbuttonClickHandler);
function armsClickHandler(event:MouseEvent):void
{
yourbuttonLoader.load(new URLRequest("pageYouWantToLoad.swf"));
}
function yourbuttonLoaded(event:Event):void
{
addChild(yourbuttonLoader);
}

where you give the button an instance name and replace the corresponding text. this will open a swf in the current document but if yo get to grips with this you can tell it to do anything.

tizbo1423
June 12th, 2008, 11:10 AM
yeaaaaaa i definitely don't understand any of that stuff, haha. thanks a lot, i'll just have to learn AS i guess. i just wish flash had like a button for everything instead of having to know AS.