如何访问飞机“子” AS3/Flex/Papervision3D 中的节点
请注意,我可能会这样做完全错误,所以我提前道歉。
我有 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 复合材料制成的平面。我也将这些平面放在链接列表中,我现在想做的是“以某种方式”访问每个单独的 VBox 及其每个单独平面的复合材料。
像这样的东西(显然不起作用!只是一个例子):
linkedList.node.data.VBox.VBox.Text[0]
这样我就可以动态修改参数。或者也许我在这一点上完全错误,我应该拥有与飞机一样多的 Vbox'en,并单独识别每个 Vbox'en。无论如何,我无法弄清楚如何在此 mxml 示例中访问父级的子级。我知道这很琐碎。
Be aware that I might be doing this totally wrong, so I apologize in advance.
I have mxml thingy, for example:
<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>
So, I have a Vbox names isThisVBoxAwesomeOrWhat that contains another VBox that containst two text fields.
Now, further in the code I make a plane out of it so I can make a 3D object out of it, here is the snippet:
[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);
So now I have my scene filled with planes made out of VBox composite as I wanted. I also have those planes in a linkedList, and what I would like to do now is to "SOMEHOW" access each individual VBox and it's composites for each individual plane.
Something like this (obviously doesn't work! Just an example):
linkedList.node.data.VBox.VBox.Text[0]
so I could modify parameters on the fly. Or maybe I'm totally wrong on this and I should have as many Vbox'en as I have planes and id each individually. Whatever the case I can't figure out how to access children of the parent in this mxml example. Trivial, I know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过以下方式访问平面中的 VBox:
(plane.material as MovieMaterial).movie as VBox
。You can access the VBox in the Plane with:
(plane.material as MovieMaterial).movie as VBox
.