Forgot to mention.....either create your project with the name 'Main' or create a file in your project as Main.as and paste this code in Main.as file and set that file as default.
-Ravi On Jun 5, 4:07 pm, Ravi Mishra <ravi.achi...@gmail.com> wrote: > Hi Ganesh, > > Create an actionScript project in flex builder and paste this code in > the main ({projectName}.as) file and run :) > > HTH, > > -Ravi > On Jun 5, 12:07 pm, ganesh kumar <kumarganes...@gmail.com> wrote: > > > hi all, > > *package* > > { > > *import *flash.display.Sprite; > > *import *flash.events.Event; > > *public class *Main *extends *Sprite > > { > > *private *var ballOne:Sprite; > > *private *var ballTwo:Sprite; > > > *private *var direction:*int *= 1; > > > *public function *Main() > > { > > ballOne = *new *Sprite(); > > ballOne.graphics.beginFill(0xff0000, 1); > > ballOne.graphics.drawCircle(0, 0, 30); > > ballOne.graphics.endFill(); > > ballTwo = *new *Sprite(); > > ballTwo.graphics.beginFill(0x0000ff, 1); > > ballTwo.graphics.drawCircle(0, 0, 30); > > ballTwo.graphics.endFill(); > > > addChild(ballOne); > > addChild(ballTwo); > > > ballTwo.x = 200; > > ballOne.x = 300; > > ballTwo.y = 5; > > ballOne.y = 5; > > > ballTwo.addEventListener(Event.ENTER_FRAME, bounce); > > ballOne.addEventListener(Event.ENTER_FRAME, bounce); > > } > > > *private function *bounce(event:Event):*void* > > { > > var target:Sprite = event.target as Sprite; > > *try* > > { > > *if *(target.y == 199) > > { > > direction = -1; > > } > > > *if *(target.y == 1) > > { > > direction = 1; > > } > > > *if *(target.y < 200 && target.y > 0) > > { > > trace(target.y + " : " + direction); > > target.y += direction; > > } > > > } *catch*(err:Error) { > > trace("ooops...."); > > } > > } > > > } > > } > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@googlegroups.com To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---