开发者

AS3 Dynamic Sprites/Movie Clips

Im having a hard time putting in my head on how would i go at making flash read a xml file (this part I have it going smooth) and then fromt hat elements put on the stage a sprite or a movieclip that is interactive.

To make it clear I want to load and display an image that when you press it it just creates another square beneath it with some text.

I believe I have to interate the xml and then use each of the elements with a class and gettin that object onto the stage.

Im using flash builder and as3 and im looking just for pointing in the rigth direction, of course I apreciate any more elaborate though some head clearing is just as good.

Thank yo开发者_如何学Pythonu.


You can iterate on the XML content using the methods as described at http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/XML.html

You would need something like:

for (elem in xml.elements("NODULO")) {
    var url: String = elem.IMGURL.text();
    var text: String = elem.TEXT.text();

    var s = new Sprite();
    var ldr = new Loader();
    ldr.load(new URLRequest(url));
    s.addChild(ldr)
    // create TextField, add as child, etc
    root.addChild(s)
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜