简体   繁体   English

获取ID不活动脚本/ flex

[英]get id inactionscript/flex

How to get all child ids of myCanvas1.Also for a specific mxml tag say <mx:Move /> how to get its id from action script 如何获取myCanvas1的所有子ID。对于特定的mxml标签,请说<mx:Move />如何从动作脚本获取其ID

<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute" xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
    [Bindable("__NoChangeEvent__")]
    [Embed(source="fruits.jpg")]
    private var fruitImageClass:Class;

    public function clickhandler(event:Event):void
    {
     //How to get all childs of myCanvas1
    }
]]>
</mx:Script>
<mx:Canvas backgroundColor="#A9C0E7" borderStyle="solid" height="300" id="myCanvas1" width="300">
 <mx:Move id="fruitAnimation1" target="{fruitImage}" xTo="100" yTo="10" />
<mx:Move id="fruitAnimation2" target="{fruitImage2}" xTo="100" yTo="10" />
</mx:Canvas>


<mx:Canvas backgroundColor="#A9C0E7" borderStyle="solid" height="800" id="myCanvas" width="800">
    <mx:Image height="50" id="fruitImage" source="{fruitImageClass}" width="50" x="250" y="10" />
    <mx:Image height="50" id="fruitImage2" source="{fruitImageClass}" width="50" x="250" y="10" />


</mx:Canvas>
<mx:Button click="clickhandler(event)" label="Generate" x="100" y="316" />
</mx:Application>

The problem of your code is children of myCanvas1 are not visual components and this declaration has no sense. 您的代码的问题是myCanvas1的子级不是可视组件,并且此声明没有意义。 You shouldn't put your animations, effects and transitions into visual container. 您不应该将动画,效果和转场放入视觉容器。 That's all what I can say about your question :) 关于您的问题,我能说的就是这么多:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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