Re: [Flashcoders] incrementing a target?
Thanks Glen, This worked perfectly... Bill - Original Message - From: "Glen Pike" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Thursday, October 19, 2006 6:10 PM Subject: Re: [Flashcoders] incrementing a target? Aha! Your text fields on stage are named "txtField0", "txtField1", etc. But you are trying to index them as ["textField" + i] Sorry that is partly my fault as my original answer said "text..." not "txt.." as your code does. so to clarify.. _root.mainMC.auto.subMC["txtField" + i].text = turbo.attributes.name; Should work. A tip that might help: If you are trying to find out stuff like this, then you can use a trace to make sure you are referencing something correctly - I used: trace(_root.mainMC.auto.subMC["textField" + i]); Which kept returning undefined, so I then used this to find out what was in the _root.mainMC.auto.subMC movie clip. for(obj in _root.mainMC.auto.subMC) { trace(obj + " = " + _root.mainMC.auto.subMC[obj]); } You can also use the "debugger" and put a breakpoint in your code - then expand the movie clips to see what you have got at that point in time. Good luck. Glen ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] incrementing a target?
try the Flashnewbie mailing list http://chattyfig.figleaf.com/mailman/listinfo/flashnewbie - Original Message - From: "Bill Pelon" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Friday, October 20, 2006 12:07 AM Subject: Re: [Flashcoders] incrementing a target? > This seems to work great on the right hand side and comes back with the > correct data when traced but I need to use that value as > my target. I may be missing something completely obvious as I'm a total > newbie on the coding so forgive me if I'm overlooking > something simple. > > I have uploaded my fla and the xml I'm using here if anyone wants to check it > out. I have commented out the section I'm having > trouble with. > > http://www.billpelon.com/mainFeature.zip > > > The code I'm stuck on is ClipEvent(load) of the MC on layer 2. > > Thanks again, > Bill ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] incrementing a target?
Aha! Your text fields on stage are named "txtField0", "txtField1", etc. But you are trying to index them as ["textField" + i] Sorry that is partly my fault as my original answer said "text..." not "txt.." as your code does. so to clarify.. _root.mainMC.auto.subMC["txtField" + i].text = turbo.attributes.name; Should work. A tip that might help: If you are trying to find out stuff like this, then you can use a trace to make sure you are referencing something correctly - I used: trace(_root.mainMC.auto.subMC["textField" + i]); Which kept returning undefined, so I then used this to find out what was in the _root.mainMC.auto.subMC movie clip. for(obj in _root.mainMC.auto.subMC) { trace(obj + " = " + _root.mainMC.auto.subMC[obj]); } You can also use the "debugger" and put a breakpoint in your code - then expand the movie clips to see what you have got at that point in time. Good luck. Glen ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] incrementing a target?
Yes, this was just recently an issue I ran up against. I could not figure out why I could not get a trace on an event. I finally figured it out. Good post Steve, I am sure it will save someone A LOT of time. Victor "The issue you might have is that you cannot assign functions and certain properties to a movieclip you are going to loadMovie on because as soon as the movie is loaded, it overwrites all the methods and properties you assigned to it except for certain things like _x/_y/_alpha, etc." - Original Message - From: "Steven Sacks | BLITZ" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Thursday, October 19, 2006 2:45 PM Subject: RE: [Flashcoders] incrementing a target? var mc = this["btn" + i]; mc is your target. mc.onRollOver = function() {}; The issue you might have is that you cannot assign functions and certain properties to a movieclip you are going to loadMovie on because as soon as the movie is loaded, it overwrites all the methods and properties you assigned to it except for certain things like _x/_y/_alpha, etc. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] incrementing a target?
var mc = this["btn" + i]; mc is your target. mc.onRollOver = function() {}; The issue you might have is that you cannot assign functions and certain properties to a movieclip you are going to loadMovie on because as soon as the movie is loaded, it overwrites all the methods and properties you assigned to it except for certain things like _x/_y/_alpha, etc. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] incrementing a target?
This seems to work great on the right hand side and comes back with the correct data when traced but I need to use that value as my target. I may be missing something completely obvious as I'm a total newbie on the coding so forgive me if I'm overlooking something simple. I have uploaded my fla and the xml I'm using here if anyone wants to check it out. I have commented out the section I'm having trouble with. http://www.billpelon.com/mainFeature.zip The code I'm stuck on is ClipEvent(load) of the MC on layer 2. Thanks again, Bill - Original Message - From: "Glen Pike" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Thursday, October 19, 2006 3:40 PM Subject: Re: [Flashcoders] incrementing a target? Hi, There maybe a typo in your code? it should say subMC["textField" + i] There should be no (dot) "." before the (square bracket) [ Basically you treat the movieclip subMC like an array. It contains some text fields "textField0", "textField1", etc. so you can index the array with to get the contents of it. You can do the same with your other bit of code rather than using eval: //instead of but = eval("but"+i); //Try this - not sure if you need to use the "this" operator, but it makes things clearer. but = this["but" + i] Bill Pelon wrote: Seems to jumble me up a bit, I get this error. Expected a field name after '.' operator. _root.mainMC.auto.subMC.["textField"+i].text = turbo.attributes.name; thanks though... - Original Message ----- From: "Glen Pike" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Thursday, October 19, 2006 3:16 PM Subject: Re: [Flashcoders] incrementing a target? Erm, I think you might want to try _root.mainMC.auto.subMC["textField" + i].text Not sure. Bill Pelon wrote: Hello, I'm having problems figuring out how to grab an array value and use that when targeting. This is my fucntion below. What I am wanting to do is take the [i]value and be able to use that when trying to write to my textfields function ExpandData(turbo){ var turboItem = turbo.firstChild.childNodes; for (var i = 0; i < turboItem.length; i++){ but = eval("but"+i); var turbo = turboItem[i]; _root.mainMC.auto.subMC.txtField+i.text = turbo.attributes.name; } } /// Thanks, Bill ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] incrementing a target?
Yes... _root.mainMC.auto.subMC["textField" + i].text and u wrote _root.mainMC.auto.subMC.["textField" + i].text note the dot after subMC greetz JC On 10/19/06, Bill Pelon <[EMAIL PROTECTED]> wrote: Seems to jumble me up a bit, I get this error. Expected a field name after '.' operator. _root.mainMC.auto.subMC.["textField"+i].text = turbo.attributes.name ; thanks though... - Original Message - From: "Glen Pike" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Thursday, October 19, 2006 3:16 PM Subject: Re: [Flashcoders] incrementing a target? > Erm, I think you might want to try > > _root.mainMC.auto.subMC["textField" + i].text > > Not sure. > > Bill Pelon wrote: >> Hello, >> >> I'm having problems figuring out how to grab an array value and use that >> when targeting. >> >> This is my fucntion below. What I am wanting to do is take the [i]value >> and be able to use that when trying to write to my textfields >> >> >> function ExpandData(turbo){ >> >> var turboItem = turbo.firstChild.childNodes; >> for (var i = 0; i < turboItem.length; i++){ >> but = eval("but"+i); >> var turbo = turboItem[i]; >> >> _root.mainMC.auto.subMC.txtField+i.text = turbo.attributes.name; >> >> } >> >> } >> /// >> >> Thanks, >> Bill >> >> >> ___ >> Flashcoders@chattyfig.figleaf.com >> To change your subscription options or search the archive: >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> Brought to you by Fig Leaf Software >> Premier Authorized Adobe Consulting and Training >> http://www.figleaf.com >> http://training.figleaf.com >> >> > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] incrementing a target?
Get rid of the extra period >>_root.mainMC.auto.subMC.["textField"+i].text = ^ ^ >>_root.mainMC.auto.subMC["textField"+i].text = >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:flashcoders- >> [EMAIL PROTECTED] On Behalf Of Bill Pelon >> Sent: Thursday, October 19, 2006 5:33 PM >> To: Flashcoders mailing list >> Subject: Re: [Flashcoders] incrementing a target? >> >> Seems to jumble me up a bit, I get this error. >> >> Expected a field name after '.' operator. >>_root.mainMC.auto.subMC.["textField"+i].text = >> turbo.attributes.name; >> >> thanks though... >> >> >> >> - Original Message - >> From: "Glen Pike" <[EMAIL PROTECTED]> >> To: "Flashcoders mailing list" >> Sent: Thursday, October 19, 2006 3:16 PM >> Subject: Re: [Flashcoders] incrementing a target? >> >> >> > Erm, I think you might want to try >> > >> > _root.mainMC.auto.subMC["textField" + i].text >> > >> > Not sure. >> > >> > Bill Pelon wrote: >> >> Hello, >> >> >> >> I'm having problems figuring out how to grab an array value and use >> that >> >> when targeting. >> >> >> >> This is my fucntion below. What I am wanting to do is take the >> [i]value >> >> and be able to use that when trying to write to my textfields >> >> >> >> >> / >> /// >> >> function ExpandData(turbo){ >> >> >> >> var turboItem = turbo.firstChild.childNodes; >> >> for (var i = 0; i < turboItem.length; i++){ >> >> but = eval("but"+i); >> >> var turbo = turboItem[i]; >> >> >> >> _root.mainMC.auto.subMC.txtField+i.text = turbo.attributes.name; >> >> >> >> } >> >> >> >> } >> >> >> / >> // >> >> >> >> Thanks, >> >> Bill >> >> >> >> >> >> ___ >> >> Flashcoders@chattyfig.figleaf.com >> >> To change your subscription options or search the archive: >> >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> >> >> Brought to you by Fig Leaf Software >> >> Premier Authorized Adobe Consulting and Training >> >> http://www.figleaf.com >> >> http://training.figleaf.com >> >> >> >> >> > ___ >> > Flashcoders@chattyfig.figleaf.com >> > To change your subscription options or search the archive: >> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> > >> > Brought to you by Fig Leaf Software >> > Premier Authorized Adobe Consulting and Training >> > http://www.figleaf.com >> > http://training.figleaf.com >> >> ___ >> Flashcoders@chattyfig.figleaf.com >> To change your subscription options or search the archive: >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> Brought to you by Fig Leaf Software >> Premier Authorized Adobe Consulting and Training >> http://www.figleaf.com >> http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] incrementing a target?
Hi, There maybe a typo in your code? it should say subMC["textField" + i] There should be no (dot) "." before the (square bracket) [ Basically you treat the movieclip subMC like an array. It contains some text fields "textField0", "textField1", etc. so you can index the array with to get the contents of it. You can do the same with your other bit of code rather than using eval: //instead of but = eval("but"+i); //Try this - not sure if you need to use the "this" operator, but it makes things clearer. but = this["but" + i] Bill Pelon wrote: Seems to jumble me up a bit, I get this error. Expected a field name after '.' operator. _root.mainMC.auto.subMC.["textField"+i].text = turbo.attributes.name; thanks though... - Original Message - From: "Glen Pike" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Thursday, October 19, 2006 3:16 PM Subject: Re: [Flashcoders] incrementing a target? Erm, I think you might want to try _root.mainMC.auto.subMC["textField" + i].text Not sure. Bill Pelon wrote: Hello, I'm having problems figuring out how to grab an array value and use that when targeting. This is my fucntion below. What I am wanting to do is take the [i]value and be able to use that when trying to write to my textfields function ExpandData(turbo){ var turboItem = turbo.firstChild.childNodes; for (var i = 0; i < turboItem.length; i++){ but = eval("but"+i); var turbo = turboItem[i]; _root.mainMC.auto.subMC.txtField+i.text = turbo.attributes.name; } } /// Thanks, Bill ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] incrementing a target?
Seems to jumble me up a bit, I get this error. Expected a field name after '.' operator. _root.mainMC.auto.subMC.["textField"+i].text = turbo.attributes.name; thanks though... - Original Message - From: "Glen Pike" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Thursday, October 19, 2006 3:16 PM Subject: Re: [Flashcoders] incrementing a target? Erm, I think you might want to try _root.mainMC.auto.subMC["textField" + i].text Not sure. Bill Pelon wrote: Hello, I'm having problems figuring out how to grab an array value and use that when targeting. This is my fucntion below. What I am wanting to do is take the [i]value and be able to use that when trying to write to my textfields function ExpandData(turbo){ var turboItem = turbo.firstChild.childNodes; for (var i = 0; i < turboItem.length; i++){ but = eval("but"+i); var turbo = turboItem[i]; _root.mainMC.auto.subMC.txtField+i.text = turbo.attributes.name; } } /// Thanks, Bill ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] incrementing a target?
Erm, I think you might want to try _root.mainMC.auto.subMC["textField" + i].text Not sure. Bill Pelon wrote: Hello, I'm having problems figuring out how to grab an array value and use that when targeting. This is my fucntion below. What I am wanting to do is take the [i]value and be able to use that when trying to write to my textfields function ExpandData(turbo){ var turboItem = turbo.firstChild.childNodes; for (var i = 0; i < turboItem.length; i++){ but = eval("but"+i); var turbo = turboItem[i]; _root.mainMC.auto.subMC.txtField+i.text = turbo.attributes.name; } } /// Thanks, Bill ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] incrementing a target?
Hello, I'm having problems figuring out how to grab an array value and use that when targeting. This is my fucntion below. What I am wanting to do is take the [i]value and be able to use that when trying to write to my textfields function ExpandData(turbo){ var turboItem = turbo.firstChild.childNodes; for (var i = 0; i < turboItem.length; i++){ but = eval("but"+i); var turbo = turboItem[i]; _root.mainMC.auto.subMC.txtField+i.text = turbo.attributes.name; } } /// Thanks, Bill ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com