3 Replies Latest reply on Dec 14, 2010 6:16 AM by Ned Murphy

    How to  randomly create variable from XML

    harshnsweet

      Hi guys,

      Need your help.

      I want to create random objects on to the stage through and xml.

       

      If u refer the image attached. each circle represents a data from the XML.

      test.jpg

      i want these to get generated on to the screen randomly with easing animation.

       

      note: circles should have random 3-4 colors as mentioned.

       

      thenx in advance.

      --Harsh

        • 1. Re: How to  randomly create variable from XML
          Ned Murphy Adobe Community Professional & MVP

          What have you tried so far and what is not working for you?

          • 2. Re: How to  randomly create variable from XML
            harshnsweet Level 1

            in first frame of mail fla.

             

            import fl.motion.Color;

            import flash.geom.ColorTransform;

             

            var numberOfParticles:Number=20;

            var particlesArray:Array = new Array();

             

            var numberOfExplosionParticles:uint=10;

             

            for (var i=0; i < numberOfParticles; i++) {

             

            var particle:Particle = new Particle();

             

            particle.speedX=0;

            particle.speedY=0;

             

            particle.y=Math.random()*stage.stageWidth;

            particle.x=Math.random()*stage.stageHeight;

             

            addChild(particle);

            particlesArray.push(particle);

            }

             

             

             

            particle.as file:

             

             

            package {

             

            import flash.display.MovieClip;

             

            public class Particle extends MovieClip {

             

            public var speedX:Number;

            public var speedY:Number;

            public var partOfExplosion:Boolean=false;

             

            function Particle():void {

             

            }

            }

            }

             

             

            by this i was able to get random particles on stage.

            i am trying to create each particle representing a data in xml.

             

            --Harsh

            • 3. Re: How to  randomly create variable from XML
              Ned Murphy Adobe Community Professional & MVP

              That is all AS3 code, not AS2.  You need to repost in the AS3 forum... and include what you have tried and describe what is not working for you.