0

请注意,我可能完全错误地这样做,所以我提前道歉。

我有 mxml 东西,例如:

    <mx:VBox id="isThisVBoxAwesomeOrWhat" width="500" height="500"
    backgroundImage="@Embed('images/500x500.jpg')" verticalAlign="bottom" 
    includeInLayout="false"
    blendMode="{BlendMode.ERASE}"
    x="-1000"
    y="-1000">

    <mx:VBox width="500" height="80" borderStyle="applicationControlBar" horizontalScrollPolicy="off" verticalScrollPolicy="off" styleName="Gradient">
        <mx:Text id="Title" width="500" text="{loremTitle}" height="30" styleName="CompNaslov"/>
        <mx:Text id="CompText" width="500" text="{loremIpsum}" height="40" styleName="CompText"/>           
    </mx:VBox>

</mx:VBox>

所以,我有一个 Vbox 名称 isThisVBoxAwesomeOrWhat 包含另一个包含两个文本字段的 VBox。

现在,在代码的后面,我用它制作了一个平面,这样我就可以用它制作一个 3D 对象,下面是代码片段:

[for i in totalPlanes]
...

var material:MovieMaterial = new MovieMaterial(isThisVBoxAwesomeOrWhat, true, true, true); 
...
plane = new Plane(material, isThisVBoxAwesomeOrWhat.width, isThisVBoxAwesomeOrWhat.height, 10, 10);
...
linkedList.append(plane);
...
basicView.scene.addChild(plane);

所以现在我的场景充满了我想要的由 VBox 复合材料制成的飞机。我在linkedList中也有这些飞机,我现在想做的是“以某种方式”访问每个单独的VBox,它是每个单独飞机的复合材料。

像这样的东西(显然不起作用!只是一个例子):

linkedList.node.data.VBox.VBox.Text[0]

所以我可以即时修改参数。或者也许我在这方面完全错了,我应该拥有和我拥有飞机一样多的 Vbox'en,并且每个人都有自己的身份。无论如何,我无法弄清楚如何在这个 mxml 示例中访问父级的子级。微不足道,我知道。

4

1 回答 1

1

您可以通过以下方式访问平面中的 VBox:

(plane.material as MovieMaterial).movie as VBox.

于 2010-02-23T18:59:50.480 回答