Quantcast
Channel: Adobe Community : All Content - Adobe Animate CC - General
Viewing all articles
Browse latest Browse all 13519

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

$
0
0

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();

          }

     }

}


Viewing all articles
Browse latest Browse all 13519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>