| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| (cs3,as2) I was wondering if there's an easier way of getting these functions to work for about 150 different buttons? I just put three of the blocks of code in here to show you what it looks like across more than one. On the gotoAndStop actions, the name is a frame label on a seperate swf file. the name used everywhere else is an instance name on a dynamic textbox located inside a movieclip. All this script is located in an external .as file. Thanks so much for reading. aaronkotowski.fade.person.text = "Aaron Kotowski"; aaronkotowski.onRollOver = function() { gotoAndStop("aaronkotowski"); aaronkotowski.fade.person.textColor = 0x666666; }; aaronkotowski.onRelease = function() { getURL("http://www.aaronkotowski.com", "_blank"); }; aaronkotowski.onRollOut = function() { aaronkotowski.fade.person.textColor = 0xffffff; }; albertnormandin.fade.person.text = "Albert Normandin"; albertnormandin.onRollOver = function() { gotoAndStop("albertnormandin"); albertnormandin.fade.person.textColor = 0x666666; }; albertnormandin.onRelease = function() { getURL("http://www.albertnormandin.com", "_blank"); }; albertnormandin.onRollOut = function() { albertnormandin.fade.person.textColor = 0xffffff; }; aliciarose.fade.person.text = "Alicia Rose"; aliciarose.onRollOver = function() { gotoAndStop("aliciarose"); aaronkotowski.fade.person.textColor = 0x666666; }; aliciarose.onRelease = function() { getURL("http://www.aliciajrosephotography.com/", "_blank"); }; aliciarose.onRollOut = function() { aliciarose.fade.person.textColor = 0xffffff; }; Someone gave me this code below to try but it makes the button have the same name over and over? What am I doing wrong? myArray_array=[{mcName:"aaronkotowski", url:"http://www.aaronkotowski.com"},{mcName:"albertnormandin", url:"http://www.albertnormandin.com"},{mcName:"aliciarose", url:"http://www.aliciajrosephotography.com"}]; for(var i=0; i<myArray_array.length; i++){ var myMc = this[myArray_array[i].mcName]; myMc.fade.person.text = "Alicia Rose"; myMc.myRoot = this; myMc .index= i; myMc.onRollOver = function() { gotoAndStop(this.myRoot.myArray_array[this.index].mcName); this.fade.person.textColor = 0x666666; }; myMc.onRelease = function() { getURL(this.myRoot.myArray_array[this.index].url, "_blank"); }; myMc.onRollOut = function() { this.fade.person.textColor = 0xffffff; }; } |
|
#2
| |||
| |||
| the code looks... well... ok - but the line: myMc.fade.person.text = "Alicia rose"; is the problem. this is assigning the same text to all instances, you can change this by adding a new propertiy to each Object within the Array, something like - mcText:"Alicia Rose", (differnet for each object of course) and then use that prop to assign the field, similar to the other methods used in there - eg. myMc.fade.person.text = this[myArray_array[i].mcText]; |
|
#3
| |||
| |||
| myArray_array=[ {mcName:"aaronkotowski", mcText:"Aaron Kotowski", url:"http://www.aaronkotowski.com"} So when I add that extra mcText portion to the array, how do I go about declaring the mcText, you said this, myMc.fade.person.text = this[myArray_array.mcText]; but that seems to make the output undefined, so I must be not declaring it correctly elsewhere...Thanks! |
|
#4
| |||
| |||
| I'm sorry - I should have used the 'attach code' button - the line I used contains an ' i ' variable used in the loop as the index value - this is also the BB code for 'italics' in the forum post sooo.... it should have been: myMc.fade.person.text = this[myArray_array[i].mcText]; |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.