I'm having the exact same type of problem swapping containers in a
TabNavigator using this type of command

main.setChildIndex(main.getChildAt(2),1);

The behind code seems to choke on the getChildAt of the container.


I had the some index problems on other things with this component and for
that one found that using callLater solved part of it. Perhaps you could
give that a try, failing that if you find a simple answer to your problem I’
d be interested in hearing about your solution. I’ll do likewise if I find a
solution to the current index problem.

Anyway Frustrating to say the least.

jason





-----Message d'origine-----
De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] la
part de Ciarán
Envoyé : jeudi 2 novembre 2006 14:29
À : flexcoders@yahoogroups.com
Objet : [flexcoders] AddChild() Exceptions


Hi All,

I'm having a slight problem building a custom component. The basic
idea is a combination of a primary image container, and a Tile()
container providing a selection of images. When selected, each image
would appear as a primary image.

This sounds tediously simple. I'm implementing it upon the principle
that a change event is broadcast when a setter is called, which has a
registered listener that updates the component. It attempts to replace
the at index 0.

The annoying thing is that if I implement this from a vanilla
perspective (blank text file), it works fine (making things much
harder to debug since I can't reproduce the behaviour) - however in
the context of the application I'm developing, it throws an exception:

RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/getChildAt()
at
mx.core::Container/getChildAt()[C:\dev\GMC\sdk\frameworks\mx\core\Container.
as:2384]
at
mx.core::UIComponent/notifyStyleChangeInChildren()[C:\dev\GMC\sdk\frameworks
\mx\core\UIComponent.as:7099]
at
mx.core::Container/mx.core:Container::commitProperties()[C:\dev\GMC\sdk\fram
eworks\mx\core\Container.as:2680]
at
mx.core::UIComponent/validateProperties()[C:\dev\GMC\sdk\frameworks\mx\core\
UIComponent.as:5218]
at
mx.managers::LayoutManager/mx.managers:LayoutManager::validateProperties()[C
:\dev\GMC\sdk\frameworks\mx\managers\LayoutManager.as:517]
at
mx.managers::LayoutManager/mx.managers:LayoutManager::doPhasedInstantiation(
)[C:\dev\GMC\sdk\frameworks\mx\managers\LayoutManager.as:628]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at
mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher2()[C:\dev\GMC\
sdk\frameworks\mx\core\UIComponent.as:7789]
at
mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher()[C:\dev\GMC\s
dk\frameworks\mx\core\UIComponent.as:7732]

This happens when the addChildAt() method gets called. Without
divulging context, is there any obvious reason why I'm getting this
exception? I've been battling this for hours now and it won't yield.
If I'm not doing something incredibly stupid that would cause this,
please let me know.

Intuitively, it seems like the addChild() is triggering something at
the wrong moment in time, giving something similar to an "Array out
of bounds" as it looks for stuff to render. I understand most of the
trace atomically speaking, but on the whole I have no idea how to
remedy it.

Also, I have an annoying problem with Flexbuilder. Breakpoints dont
seem to work for me at all. I can't find any setting that implies this
might've been turned off, so I'm not sure what to do about it. Perhaps
find the checkbox that says "Don't work properly" and untick it.

Any clues would be much appreciated =)

Kind Regards,

Ciarán






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to