actionscript 3 - Flex 3: Adding a sprite to a Container's "rawChildren" sometimes adds it to the content children instead -



actionscript 3 - Flex 3: Adding a sprite to a Container's "rawChildren" sometimes adds it to the content children instead -

the basic problem i'm trying solve have mix of flex & flash components, , have generic function adding progress spinner component regardless. if component container, add together rawchildren, otherwise add together normally.

however, i'm running problem component inherits vbox. call

cont.rawchildren.addchildat(spinner, cont.rawchildren.numchildren);

but when trace children, spinner shows in cont.getchildren(), , comp.numchildren increases one. , other containers seem work properly, other vbox controls.

i walked through flex framework code , can't find explain why happen, either via inheritance or timing.

has seen similar or can explain why rawchildren might not predictable in case?

thanks.

function:

var bcu:number = u.numchildren; var bce:number = el.numchildren; el.addchildat(s, ((pos > -1)?pos : el.numchildren)); trace("add new spinner", u, el, el.numchildren, u.numchildren, bce, bcu);

where el either displayobject or rawchildren object of container, , u original object spinner beingness attached to.

output:

add new spinner blockmovepopup1734 [object containerrawchildrenlist] 6 5 5 4

and then:

[fault] exception, information=typeerror: error #1034: type coercion failed: cannot convert com.misc::sbspinner@57970a1 mx.core.iuicomponent.

the output shows el correctly set containerrawchildrenlist (the rawchildren object vbox) , numchildren [6,5] vs [5,4] prior call. means sprite beingness added content children rather rawchildren.

that fun. found quirk. think maybe rawchildren.addchildat function bit buggy. found block of text in container class:

container assumes content children contiguous, , non-content children come before or after content children. in order words, container partitions displayobjectcontainer's index range 3 parts: b c d e f g h 0 1 2 3 4 5 6 7 8 <- index children 0 1 2 3 <- index content children content partition contains content children d e f g. pre-content partition contains non-content children b c remain before content children. post-content partition contains non-content children h remain after content children.

if used rawchildren.addchild works fine now. in both cases, spinner beingness added lastly child, addchild correctly.

actionscript-3 flex flex3

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -