Hello, I am attempting to make a flash website, and have 5 buttons on my menu. I made 5 pages in a movieclip called "content". I want to know how I can link those buttons to go to those pages (actionscript and where to put it).
I have seen flash website templates, and see only ONE button, but when I looked at it in an .swf, it shows all buttons with their specific text label.
Any other actionscripting that i might need or would be useful for my website, please let me know.
Also, if anyone can help me making a basic preloader, that will be a great help!
Sorry if these are stupid questions, but i'm still learning!
The button tutorial didn't fix my problem though. I was looking for a way to make my MovieClip buttons link to my pages (the pages are on individual frames in a movieclip called "content"
Well, can't say that I'll do it for you, but I will try to guide you through. First off, give the content symbol of the content layer an instance name (I used "content"). Next, add a stop(); action to the last frame of the main timeline. Next give the buttons on the main timeline instant names as well. I used the typical naming convention of "btn1", "btn2" etc.
Next go into your content mc clip and add a stop(); action to each frame (to prohibit the mc from looping, or advancing to some other frame). After that, go back to the main timeline and next add some code for the buttons. So underneath the stop action add this code.
PHP Code:
btn1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown, false, 0, true); btn2.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown, false, 0, true); // add for each button
function mouseDown(e:MouseEvent):void { var numFrame:int = e.currentTarget.name.substr(3); //this takes the instance name of the button selected and isolates the the 4 character, ie on btn1 - isolates the 1, then goes to the corresponding frame of the content mc content.gotoAndStop(numFrame); }
It looks great! Just one problem,
in the complier errors it says:
Access of undefined property btn1
Access of undefined property btn2
Access of undefined property btn3
Access of undefined property btn4
Access of undefined property btn5
also, The stop(); command doesnt work for some reason. it doesnt stop when i look at it through Ctrl+Enter (exported), but it stops if I look at it in the main timeline when I just press Enter.
Not sure what's wrong, I didn't receive any errors when I did it. Do the buttons work? And if the stop(); does not seem to be working what is actually looping, the main timeline or the content mc?
Hmmm, I didn't get that error. I did however notice a few things. Put your actions on its' own layer, much easier to edit when it doesn't reside on the same layer as objects/artwork. I didn't see any code for the buttons, and I noticed that your content symbol on the stage did not have an instance name associated with it.
Yeah, I get an error (1009) which to say the least is quite ambiguous. Even googling the error doesn't give one much to go on. And I noticed as well that there is something very suspicious with the contact button. Once pressed, disables buttons 1, 2 and 3... leaving only button 4 as operational. However, press button 4 and the remaining buttons become active again. If it were me I'd probably start over... creating something functional before creating something graphical. But hey, that's just my approach.