21 Replies Latest reply on Sep 23, 2013 12:38 PM by inbound spot thoughts

    Does anyone see the green ball with this code in Flash Pro CC?

    inbound spot thoughts Level 1

      If you can see the green ball at the top let me know what you did, thanks. I have Windows 8 PhotoShop CC.  I am very new when I only have the code below open in Flash saved as a ".as" when I press CTRL+ENTER nothing happens. The problem I believe is when I open another new document or ".fla" file and when it allows me to preview the screen after pressing CTRL+ENTER there should be a green ball at the top of the page, but there isn't

       

      P.S. WHen I click F-9 to bring up the code and then CTRL+ENTER its just a blank screen with #333333 as the stage color size 640 X 480 and 30 Frame Rate

       

      package{

           import flash.display.Sprite;

           import flash.events.Event;

           import Box2D.Dynamics.*;

           import Box2D.Collision.*;

           import Box2D.Collision.Shapes.*;

           import Box2D.Common.Math.*;

           public class Main extends Sprite{

                private var world:b2world;

                private var worldScale:Number=30

                public function Main(){

                     world =new b2World(new b2Vec2(o,9.81),true);

                     var bodyDef:b2BodyDef=new b2BodyDef();

                     bodyDef.position.Set(320/worldScale,30/worldScale);

                     var circleShape:b2CircleSHape;

                     circleShape=new b2CircleShape(25/worldScale);

                     var fixtureDef:b2FixtureDef = new b2FixtureDef();

                     fixtureDef.shape=circleShape;

                     var theBall:b2Body=world.CreateBody(bodyDef);

                     theBall.CreateFixture(fixtureDef);

                     var debugDraw:b2DebugDraw=new b2DebugDraw();

                     var debugSprite:Sprite=new Sprite();

                     addChild(debugSprite);

                     debugDraw.SetSprite(debugSprite);

                     debugDraw.SetDrawScale(worldScale);

                     debugDraw.SetFlags(b2DebugDraw.e_shapeBit);

                     debugDraw.SetFillAlpha(0.5);

                     world.SetDebugDraw(debugDraw);

                     addEventListener(Event.ENTER_FRAME,updateWorld);

                }

                private function updateWorld(e:Event):void {

                     world.Step(1/30,10,10);

                     world.ClearForces();

                     world.DrawDebugData();

                }

           }

      }