enter code here
我正在将外部swf加载到组件中。它加载一切都很好,我可以看到在swf中工作的按钮,我可以添加一个movieclip,但我不能访问该movieclip(或不知道如何),它一直告诉我numChildren = null当我尝试追查它。
这被设置为这样的自定义组件:
<cynergy:imageZoom
id="zoomComponent"
borderStyle="solid"
source="{_data.map.@url}"
fadeDuration="1000"
bottom="0" left="0" top="0" right="0"
zoomIncrement="{ options.zoomIncrement }"
imageDoubleClickEnabled="{ options.imageDoubleClickEnabled }"
mouseWheelEnabled="{ options.mouseWheelEnabled }"
mouseFollow="{ options.mouseFollowEnabled }" />
>
</cynergy>
然后在我的imageZoom.mxml中我有这段代码:
<Canvas
visible="{ _source != null && image.percentLoaded < 100 }" horizontalCenter="0" verticalCenter="0"
hideEffect="WipeDown" showEffect="WipeDown" width="210" height="30"
borderStyle="solid" borderThickness="3" borderColor="#000000" backgroundColor="#FFFFFF" backgroundAlpha=".5" cornerRadius="10" >
<Label text="Loading... { Math.floor(image.percentLoaded) }%" fontSize="16" width="100%" textAlign="center">
<filters>
<flash.filters:DropShadowFilter color="0" alpha=".5" />
</filters>
</Label>
</Canvas>
<Image id="image" mask="{ maskCanvas }" source="{ _source }" mouseDown="image.startDrag()" visible="{ _source != null && image.percentLoaded == 100 }"
showEffect="{ fadeInEffect }" complete="imageComplete()" doubleClickEnabled="true" doubleClick="onDoubleClick()" />
有谁能告诉我如何在加载的动画片段中访问孩子?
我试过了
mycomponent.image.getChildAt(2)并返回索引超出范围的错误。
答案 0 :(得分:0)
答案很简单:myComponent.image.content
在完成加载之前也是在调用它。