Hi, Anthony,

You're totally right - I shouldn't have contradicted you.

I saw a very simple problem in either the start of the index or the limiter
of the index needed to be altered - so in that essence we are saying the
same thing.
I read your email too quickly and I thought you were saying "Jiri, your code
works fine for me" instead of "here's how I modified it to work."

-jonathan


On Fri, Mar 19, 2010 at 12:55 PM, Anthony Pace <anthony.p...@utoronto.ca>wrote:

> Johnathan:
>
> if there are  6 items on the stage, numChildren = 6 but to access the 6th
> item you need to be at position [5]  of the array, so for ease of
> implementation he used:
>
> this.numChildren-1
>
> My test showed that it if he has some screwed up object that does not match
> his regex, it will not show, so that is why it shaved one off when tracing.
>  It still went through the entire array, it just chose not to output what it
> didn't like.
>
> I would also like to point out that I changed the loop conditional
> expression to see if the counter childnum!=-1 , meaning that if there were 6
> items on the stage, that position 5, 4, 3, 2, 1, and 0 would be checked, but
> it would not go further.
>
> So again, the code I tested does work fine, and if you want to be sure, you
> can even trace out the childnum value before or after the if statement in
> the loop, to see how far it goes.
>
>
> On 3/19/2010 9:39 AM, jonathan howe wrote:
>
>> Just so there is no confusion... that is not the only change you would
>> have
>> to make. When you do the getChildAt call you'll need to adjust by one for
>> the index at that time.
>>
>> I could see why Jiri would have to do this technique if he was handed a
>> bunch of Stage-authored content from another party and had to access it
>> somehow.
>>
>> -jonathan
>>
>>
>>
>> On Fri, Mar 19, 2010 at 9:34 AM, jonathan howe<jonathangh...@gmail.com
>> >wrote:
>>
>>
>>
>>> I think Jiri wants all clips, not all but one. You've repro'd the last
>>> one
>>> not showing up.
>>> Jiri, why are you shaving 1 off your numChildren? I'ts a count, not an
>>> index.
>>>
>>> Try
>>>
>>> var childnum:int=this.numChildren;
>>>
>>> instead.
>>>
>>> -jonathan
>>>
>>>
>>> On Thu, Mar 18, 2010 at 8:20 PM, Anthony Pace<anthony.p...@utoronto.ca
>>> >wrote:
>>>
>>>
>>>
>>>> While I really don't understand why you would want to do things this
>>>> way,
>>>> but...
>>>>
>>>> I tested this code below, with several clips on the stage:
>>>> sq_1, sq_12, sq_122, sq_1222a, sq_1212_1212, sq_6dad_12, sq_6d_6d
>>>>
>>>> it worked fine and outputed the obvious results:
>>>> sq_1
>>>> sq_12
>>>> sq_122
>>>> sq_1212_1212
>>>> sq_6dad_12
>>>>
>>>> var childnum:int=this.numChildren-1;
>>>> var pat:RegExp=/_[0-9]+$/;
>>>> var instance:DisplayObject;
>>>> while (childnum!=-1) {
>>>>    instance = this.getChildAt(childnum);
>>>>
>>>>    if (pat.test(instance.name)) {
>>>>        trace(instance.name);
>>>>    }
>>>>    --childnum;
>>>>
>>>> }
>>>>
>>>>
>>>> On 3/18/2010 2:08 PM, Jiri wrote:
>>>>
>>>>
>>>>
>>>>> Hello,
>>>>>
>>>>> i would like some help, because I am confused.
>>>>>
>>>>> If have a Movieclip that holds several sprites some of them have
>>>>> instance
>>>>> names like so
>>>>> frame_<n>  where n is a number.
>>>>>
>>>>> I then loop through every child of the MovieClip and test the instance
>>>>> name using regExp.
>>>>>
>>>>> var childs:int = clip.numChildren-1;
>>>>> var pat:RegExp = /_[0-9]+$/ig;
>>>>>
>>>>> while(childs>= 0){
>>>>>    var instance:DisplayObject = clip.getChildAt( childs );
>>>>>
>>>>>    if( pat.test(instance.name) ){
>>>>>        Logger.debug( "info box frame" , instance.name );
>>>>>    }
>>>>>    childs--
>>>>> }
>>>>>
>>>>> I have three movieclips called 'frame_0' , 'frame_1' and 'frame_2'  for
>>>>> sure, but it when I run the above code, it only show 1 and 0??
>>>>>
>>>>> Anybody has an idea?
>>>>>
>>>>> Jiri
>>>>>
>>>>> On 11/03/2010 22:16, Guest Services, City Concierge wrote:
>>>>>
>>>>>
>>>>>
>>>>>> We're looking for a coder to some small contract work
>>>>>> We're in Los Angeles
>>>>>> Should know action script very well, and be able to get the flash
>>>>>> scripts to
>>>>>> work in .asp and .php and use XML
>>>>>> Ask for Jefferson
>>>>>> 323-874-6610
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Flashcoders mailing list
>>>>>> Flashcoders@chattyfig.figleaf.com
>>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>>
>>>>>> _______________________________________________
>>>>>>
>>>>>>
>>>>> Flashcoders mailing list
>>>>> Flashcoders@chattyfig.figleaf.com
>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> Flashcoders mailing list
>>>> Flashcoders@chattyfig.figleaf.com
>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> -jonathan howe
>>>
>>>
>>>
>>
>>
>>
>>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
-jonathan howe
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to