RE: [Flashcoders] toString(aArray[i]) ?? does this work

2007-09-13 Thread Hal Leonard
You're right, of course. I wasn't thinking correctly. The MovieClip object
has a toString() method which should return the name of the MovieClip
Object. I guess I was specifically thinking about the v2 Components, which
return [object Object] unless you also include the ._name property. Sorry
for the confusion.

Hal 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Andy Herrman
Sent: Wednesday, September 12, 2007 6:31 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] toString(aArray[i]) ?? does this work

You say [object Object] is the correct output if the object is a
movie clip.  This isn't the behavior I see.  Any time I trace a movie
clip I get the clip's name (level0.foo.bar.whatever), not the generic
object results.

  -Andy

On 9/11/07, Hal Leonard [EMAIL PROTECTED] wrote:
 Try toString(aArray[i]._name) instead I'm not 100% sure what you're
 storing in your array, but it sounds like you're storing movieClip objects
 in there, in which case the result [object Object] would be the correct
 output.

 Hal

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of
 [EMAIL PROTECTED]
 Sent: Monday, September 10, 2007 8:30 PM
 To: Flash Coders
 Subject: [Flashcoders] toString(aArray[i]) ?? does this work


 Quick question, can I toString an array element.
 ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the
 increment.

 I am having an issue with this.  when I trace myStr it traces [object
 object]
 instead of what I intended/expected mcMovieClipName14 as a string.

 Any insite would be appreciated.

 Thanks in advance,

 Paul V.
 ___
 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] toString(aArray[i]) ?? does this work SOLVED

2007-09-13 Thread paul
Thanks,
Thanks all who answered this post
I ended up using

var varName:String = this._name;
var varNumber:Stirng = substr(2);
var varNum:Number = parseInt(varNumber);

trace(varNum);  //traces 1,2,3 etc. as type -Number.

Thanks again,
Paul V.




- Original Message - 
From: Andy Herrman [EMAIL PROTECTED]
To: flashcoders@chattyfig.figleaf.com
Sent: Wednesday, September 12, 2007 8:30 AM
Subject: Re: [Flashcoders] toString(aArray[i]) ?? does this work


 You say [object Object] is the correct output if the object is a
 movie clip.  This isn't the behavior I see.  Any time I trace a movie
 clip I get the clip's name (level0.foo.bar.whatever), not the generic
 object results.

   -Andy

 On 9/11/07, Hal Leonard [EMAIL PROTECTED] wrote:
  Try toString(aArray[i]._name) instead I'm not 100% sure what you're
  storing in your array, but it sounds like you're storing movieClip
objects
  in there, in which case the result [object Object] would be the correct
  output.
 
  Hal
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of
  [EMAIL PROTECTED]
  Sent: Monday, September 10, 2007 8:30 PM
  To: Flash Coders
  Subject: [Flashcoders] toString(aArray[i]) ?? does this work
 
 
  Quick question, can I toString an array element.
  ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the
  increment.
 
  I am having an issue with this.  when I trace myStr it traces [object
  object]
  instead of what I intended/expected mcMovieClipName14 as a string.
 
  Any insite would be appreciated.
 
  Thanks in advance,
 
  Paul V.
  ___
  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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Muzak
What is stored in the Array?

- Original Message - 
From: [EMAIL PROTECTED]
To: Flash Coders flashcoders@chattyfig.figleaf.com
Sent: Tuesday, September 11, 2007 5:30 AM
Subject: [Flashcoders] toString(aArray[i]) ?? does this work



Quick question, can I toString an array element.
ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the 
increment.

I am having an issue with this.  when I trace myStr it traces [object object]
instead of what I intended/expected mcMovieClipName14 as a string.

Any insite would be appreciated.

Thanks in advance,

Paul V.


___
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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Hal Leonard
Try toString(aArray[i]._name) instead I'm not 100% sure what you're
storing in your array, but it sounds like you're storing movieClip objects
in there, in which case the result [object Object] would be the correct
output.

Hal

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, September 10, 2007 8:30 PM
To: Flash Coders
Subject: [Flashcoders] toString(aArray[i]) ?? does this work


Quick question, can I toString an array element.  
ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the
increment.

I am having an issue with this.  when I trace myStr it traces [object
object] 
instead of what I intended/expected mcMovieClipName14 as a string.

Any insite would be appreciated.

Thanks in advance,

Paul V.
___
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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Jesse Graupmann
Maybe try;


var myStr:String  =  String( aArray[i] );

or

var myStr:String  =  aArray[i].toString();



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, September 10, 2007 8:30 PM
To: Flash Coders
Subject: [Flashcoders] toString(aArray[i]) ?? does this work


Quick question, can I toString an array element.  
ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the
increment.

I am having an issue with this.  when I trace myStr it traces [object
object] 
instead of what I intended/expected mcMovieClipName14 as a string.

Any insite would be appreciated.

Thanks in advance,

Paul V.

___
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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Steven Sacks

You're using toString wrong.  toString is a native method of objects.

Use:

aArray[i].toString()

or

String(aArray[i])


___
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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Jamie S
toString() is a method of the Object class and it doesn't have any
arguments. So while every object in Flash has a toString method, by
default it returns [object Object]. From your code it looks like
what you're actually doing is calling this.toString(), you probably
want to do something like myStr:String  =  aArray[i].toString(); but
that still might not give you what you're looking for. If the items in
the array are references to movieclips and you want the instance names
of those clips, you should try aArray[i]._name (AS2) or aArray[i].name
(AS3)

Jamie

On 9/10/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Quick question, can I toString an array element.
 ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the 
 increment.

 I am having an issue with this.  when I trace myStr it traces [object object]
 instead of what I intended/expected mcMovieClipName14 as a string.

 Any insite would be appreciated.

 Thanks in advance,

 Paul V.
 ___
 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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Andy Herrman
Ah, since the local scope is the object in the array then just using
`toString()` without any arguments would work (just doing
`this.toString()` basically).

Can you provide the code where you populate the array?  It's possible
you're adding something other than the movie clips to the array (or
maybe some type info is being lost).

I'm actually not sure how the `i` variable is handled in this case.
If you're always getting 126 then Flash might be keeping a reference
to the variable and evaluating it when the function runs, instead of
evaluating it when creating the function.  This might be how things
work, I really don't know.  A different way to handle it would be to
do this:

aArray[i].myArrayIndex = i;
aArray[i].onPress = function() { ... }

and then within the function use `this.myArrayIndex` instead of `i`.
This way you're storing the index for the object within the object
itself, so you can query it whenever you want without worrying about
the scope chain.

One other thing, just as a sanity check.  You said you did this:

setInterval(rollOvers,10);  //calls function 100/second to

If that's the actual code then you're going to have problems.  That
will run your rollOvers function every 10 milliseconds.  You probably
only want it run once (no point in changing the onPress functions when
they've already been assigned).  You're going to want to store the
interval's ID and then clear it:

var rollOversInterval:Number = setINterval(rollOvers, 10);

function rollOvers() {
  clearInterval(rollOversInterval);
  /* rest of the function */
}

If for some reason you do need to update the onPress functions you
should really only do it when an event occurs that would require it,
instead of constantly doing so.

  -Andy

On 9/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Andy,
   I see what you are saying, I think.  That the .toString() has to be used
 as a method directly being addressed by the object.  Like I said that what I
 think you are saying.  How ever it seems I still can not get the string
 myMCinArray1 or  myMCinArray2 or myMCinArray3 etc  when I use the
 toString on an array Element.

 By the way, the scope in this case is actually  the Array
 lement(MovieClip)  -see coded snippet

 setInterval(rollOvers,10);  //calls function 100/second to

 function rollOvers(){
 for (i=0; iaArray.length; i++) {

 aArray[i].onPress = function() {
var myStr:String = aArray[i].toString();   //* THIS LINE
trace(myStr);// still traces [object object]
trace(i);  //gives me 126 .which is the array length. if I
 could get this to give me the value of the Array element clicked I would
 fine too.
 };
 }
 }

 Again any follow up on this post would be appreciated.


 Paul V.


 - Original Message -
 From: Andy Herrman [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; flashcoders@chattyfig.figleaf.com
 Sent: Tuesday, September 11, 2007 12:00 PM
 Subject: Re: [Flashcoders] toString(aArray[i]) ?? does this work


  I think what you really want is this:
 
  var myStr:String = aArray[i].toString();
 
  I don't know of any global toString() function.  What's probably
  happening is that you're doing the equivalent of
  `this.toString(aArray[i])`.  The scope object's toString function
  ignores all arguments and gives you the string representation of
  itself (which will be what you said you're seeing unless it has a
  custom toString() implementation).
 
-Andy
 
  On 9/10/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  
   Quick question, can I toString an array element.
   ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the
 increment.
  
   I am having an issue with this.  when I trace myStr it traces [object
 object]
   instead of what I intended/expected mcMovieClipName14 as a string.
  
   Any insite would be appreciated.
  
   Thanks in advance,
  
   Paul V.
   ___
   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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Mark Winterhalder
var  myStr:String  =  aArray[i].toString();

HTH,
Mark


On 9/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Quick question, can I toString an array element.
 ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the 
 increment.

 I am having an issue with this.  when I trace myStr it traces [object object]
 instead of what I intended/expected mcMovieClipName14 as a string.

 Any insite would be appreciated.

 Thanks in advance,

 Paul V.
 ___
 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] toString(aArray[i]) ?? does this work

2007-09-12 Thread James Marsden

try

var myStr:String = String(aArray[i]);// where 'i' is the increment.

J




Muzak wrote:

What is stored in the Array?

- Original Message - 
From: [EMAIL PROTECTED]

To: Flash Coders flashcoders@chattyfig.figleaf.com
Sent: Tuesday, September 11, 2007 5:30 AM
Subject: [Flashcoders] toString(aArray[i]) ?? does this work



Quick question, can I toString an array element.
ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the 
increment.

I am having an issue with this.  when I trace myStr it traces [object object]
instead of what I intended/expected mcMovieClipName14 as a string.

Any insite would be appreciated.

Thanks in advance,

Paul V.


___
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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Andy Herrman
You say [object Object] is the correct output if the object is a
movie clip.  This isn't the behavior I see.  Any time I trace a movie
clip I get the clip's name (level0.foo.bar.whatever), not the generic
object results.

  -Andy

On 9/11/07, Hal Leonard [EMAIL PROTECTED] wrote:
 Try toString(aArray[i]._name) instead I'm not 100% sure what you're
 storing in your array, but it sounds like you're storing movieClip objects
 in there, in which case the result [object Object] would be the correct
 output.

 Hal

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of
 [EMAIL PROTECTED]
 Sent: Monday, September 10, 2007 8:30 PM
 To: Flash Coders
 Subject: [Flashcoders] toString(aArray[i]) ?? does this work


 Quick question, can I toString an array element.
 ie:   var  myStr:String  =  toString(aArray[i]);// where 'i' is the
 increment.

 I am having an issue with this.  when I trace myStr it traces [object
 object]
 instead of what I intended/expected mcMovieClipName14 as a string.

 Any insite would be appreciated.

 Thanks in advance,

 Paul V.
 ___
 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] toString(aArray[i]) ?? does this work

2007-09-12 Thread Danny Kodicek
  Andy,
   I see what you are saying, I think.  That the .toString() 
 has to be used as a method directly being addressed by the 
 object.  Like I said that what I think you are saying.  How 
 ever it seems I still can not get the string myMCinArray1 
 or  myMCinArray2 or myMCinArray3 etc  when I use the 
 toString on an array Element.
 
 By the way, the scope in this case is actually  the Array
 lement(MovieClip)  -see coded snippet
 
 setInterval(rollOvers,10);  //calls function 100/second to
 
 function rollOvers(){
 for (i=0; iaArray.length; i++) {
 
 aArray[i].onPress = function() {
var myStr:String = aArray[i].toString();   
 //* THIS LINE
trace(myStr);// still traces [object object]
trace(i);  //gives me 126 .which is the array 
 length. if I could get this to give me the value of the Array 
 element clicked I would fine too.
 };

It's nothing to do with the fact that it's in an array. toString() always
gives [Object object] for movieClips. Try it: make a vanilla movie, put in a
single movieclip called 'wossname' then put 'trace(wossName.toString()' in
the first frame.

If you want to get its name, put aArray[i]._name, as suggested previously. 

Danny

___
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