开发者

AS3 xml loop shows many times

开发者 https://www.devze.com 2023-01-01 12:23 出处:网络
I have this simple code to play with xml var testXML:XML = <family> <father name1=\"tom\" age=\"5\" ></father>

I have this simple code to play with xml

var testXML:XML = <family>
                  <father name1="tom" age="5" ></father>
                  <mother name1="tomylee" age="55" ></mother>
                                  <sister name1="sister1" age="35" ></sister>
                  </family>;

for each(var element:XML in testXML.elements()) {
                    trace(element.@name1);
                }

It should get only one output like

tom
tomylee
sister1
tom
tomylee
sister1
tom
tomylee
sister1

and many more like that. Looks like it keeps repeating. The croll bar keep开发者_如何转开发s moving down. I think loop is not stopping


Is this code in a frame script? If you have more than one frame on your timeline, flash will play through them in sequence and repeat, by default. You can use the stop() command to stop playback on the current frame, or if you only put a single frame in the timeline, it will only execute once.

0

精彩评论

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