简体   繁体   中英

Accessing children of loaded swf in Flex Image component

enter code here I am loading an external swf into an component. It loads everything fine and I can see buttons working in the swf, I can add a movieclip to the but I can't then access that movieclip (or don't know how), and it keeps telling me numChildren = null when I try to trace it out.

This is set up as a custom component like this:

<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>

Then in my imageZoom.mxml I have this code:

<Canvas
    visible="{ _source != null &amp;&amp; image.percentLoaded &lt; 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 &amp;&amp; image.percentLoaded == 100 }"
    showEffect="{ fadeInEffect }" complete="imageComplete()" doubleClickEnabled="true" doubleClick="onDoubleClick()" />

Can anyone tell me how I would access the children in the loaded movieclip?

I have tried

mycomponent.image.getChildAt(2) and it returns and error that the index is out of bounds.

Was an easy answer: myComponent.image.content

Also was calling it before it finished loading.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM