View Full Version : disabling button in separate swf file
theremylebeau
05-14-2004, 09:37 PM
alrighty, here's (http://www.dutchform.com/_flash_current/hamida/multipleswffiles/home.fla) what i'm working on. in my home.swf file i've got a swf for my main navigation because they've got rollover pictures and an empty movie clip beneath it to load swfs for different categories on it. the links aren't perfect, but they work for now. what i want to know is this: is there a way i can use enabled=false on individual buttons when a certain swf is loaded?
i'm interested in disabling a button when i'm in that category or any of it's subcategories; when the category swf loads, inside it WILL (still working on it!) load a subnav bar beneath the main navigation with links that load into an empty movie clip below, kind of a repeat of the main navigation... so i'm wondering what actionscript to stick where to get things working. any help would be greatly appreciated.
oh yea, the demo site thus far is here (http://www.dutchform.com/_flash_current/hamida/multipleswffiles/index_main.htm) and all the swf/fla files are dumped locally in the same spot if you want to look at my newbie attempts... :rolleyes: i've been browsing for hours and still feel that newbie stamp on my forehead... :o
-daniel
Billy T
05-14-2004, 09:41 PM
see attached
theremylebeau
05-14-2004, 09:45 PM
nice, but... what do i do with it?
"function resetButtons() {
for (j=1; j<10; j++) {
_root["button"+j].gotoAndStop("up");
}
}"
i'm thinking on (rollOver) resetButtons(); or something...
but that file thingy is confusing me!!
Billy T
05-14-2004, 09:50 PM
your main buttons should have instance names of
button1
button2
etc
when you click a button have
on(release){
//move all buts to up state
_root.resetButtons();
//move this button to down state
this.gotoAndStop('down');
//load in an external movie
_root.holder.loadMovie('some.swf');
}
cheers
theremylebeau
05-14-2004, 09:58 PM
heh, i found out more just after i posted that last "huh? i don't get it" crap when i didn't dig into the fla enough... this helps, i'll dig some more into it. thanks billy!
Billy T
05-14-2004, 10:02 PM
no prob
theremylebeau
05-14-2004, 10:27 PM
okee, i got the nav picture to appear in it's down state and stay down till the main nav swf reloads (by clicking on the logo). i'd rather just click through everything in one category, and have it go back to the up state when i go to another category... maybe i'm just sticking the timeline script on the wrong timeline! augh, i'm feeling slow.
but more of a concern - the button does stay down (probably fixed easily enough) but the button is still clickable and keeps reloading the page. so it does look disabled, but the link isn't and i'm lost...
theremylebeau
05-19-2004, 01:51 PM
erg, finally... forgot to label the buttons! i'm absolutely briliiant. here's the latest demo (http://www.dutchform.com/_flash_current/hamida/multipleswffiles/index2.htm), don't kill me about the stupid subnavs not working! i got the main nav working good enough. currently building a new subnav system...
Billy T
05-19-2004, 07:34 PM
well done
theremylebeau
06-01-2004, 01:52 PM
thanks billy! been a little busy building some sort of subnav (http://www.dutchform.com/_flash_current/hamida/multipleswffiles/manu_nav.fla) and other things lately, it looks decent. i've been working for the same off-state button effect for the subnavs so you can't keep clicking on the button, but i'm not doing something right - i've got:
on (release) {
_root.resetButtons1();
this.gotoAndStop('down1');
_parent._parent.contents_data.loadMovie("manu_bioenhanced.swf");
}
on a button embedded in a movie clip in the subnav. i tried to copy/paste the same function with a different name (resetButtons1) on the home (http://www.dutchform.com/_flash_current/hamida/multipleswffiles/home.fla) page and the completed swf is here (http://www.dutchform.com/_flash_current/hamida/multipleswffiles/home.swf). all i want is an off state for the button, no fancy picture junk. any thoughts would help!
Billy T
06-01-2004, 06:02 PM
does resetButtons1() contain the correct paths to all the button want to effect? Does your button mc have a frame label of 'down1'?
probably the best way to do it would be to have 1 function that accepts an array as a parameter
eg
function resetButtons(someArray,whichBut){
for(i=0;i<someArray.length;i++){
someArray[i].gotoAndStop('up');
}
whichBut.gotoAndStop('down');
}
then put your buttons into arrays
eg
sub1Buts=new Array(sub1_mc.but1_btn,sub1_mc.but2_btn,sub1_mc.bu t3_btn);
then from one of those sub buts you just call the function with
_root.resetButtons(_root.sub1Buts,this);
cheers
tat2ed
06-01-2004, 11:57 PM
yyyyoooooooo!!!!!!!!!
see.... this guy have a close browser window button .....thats what i want!!!!!!!!!....
how did you make it work with out showing the warning window??????
please tell me....or i'll shoot my self....!!!!!
theremylebeau
06-04-2004, 12:01 PM
sub1Buts=new Array(sub1_mc.but1_btn,sub1_mc.but2_btn,sub1_mc.bu t3_btn);
i'm pretty sure that i had all the links and labels set up right, but i'll try the array for the buttons - where do i stick the array?
don't mean to steal all your time away, but this thing:
_root.resetButtons(_root.sub1Buts,this);
i don't entirely understand it. you call upon the root function to resetButtons with the root parameter of the array? i'm probably answering my first question anyways on where to put the array, but i still am a little confused... thanks!
how did you make it work with out showing the warning window??????
it closes the window without the warning in a chromeless window i think...
Billy T
06-04-2004, 08:44 PM
um yeah the function and arrays go on the main timeline - _root
so when you want to call the function or target an array from another timeline you need to provide the path
ie
_root.resetButtons
cheers
theremylebeau
07-06-2004, 11:48 PM
well... after a month's worth of other projects i came back to this navigation system and twiddled around, without changing the funtion i stuck the following upon the subnav buttons and it actually worked. i tried working with arrays, got stuck... but i'll keep trying!! thanks billy!
"on (release) {
_parent._parent.contents_data.loadMovie("whatevermovie.swf");
this.gotoAndStop('down');
_parent.sub102.gotoAndStop('up');
_parent.sub103.gotoAndStop('up');
}"
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.