Skip to content

Instantly share code, notes, and snippets.

View codeinvain's full-sized avatar

Daniel Cohen codeinvain

  • Cloudinary
  • Limassol, Cyprus
View GitHub Profile
protected function application1_initializeHandler(event:FlexEvent):void
{
setupWorldPhysics();
}
private function setupWorldPhysics():void
{
worldUIContainer.parseCompiseteVisualElement(ball,new ComplexShapeParser(ShapeFidality.LOW));
var p1FixD:b2FixtureDef = new b2FixtureDef();
p1FixD.friction=0;
protected function application1_initializeHandler(event:FlexEvent):void
{
setupWorldPhysics();
}
private function setupWorldPhysics():void
{
worldUIContainer.parseCompiseteVisualElement(ball,new ComplexShapeParser(ShapeFidality.LOW));
var p1FixD:b2FixtureDef = new b2FixtureDef();
p1FixD.friction=0;
<s:BorderContainer verticalCenter="0" horizontalCenter="0" borderColor="0x99ffcc" width="800" height="400" borderWeight="3" backgroundColor="0x1a1a1a" cornerRadius="8" id="border" mouseMove="world_mouseMoveHandler(event)" >
<b2d:SkinnablePhysicsContainer width="794" height="394" setBoundries="true" debugInFront="true" debug="false" id="worldUIContainer" autoStartPhysicsEngine="true" >
<s:BorderContainer id="p1" borderColor="0x99ffcc" width="30" height="80" borderWeight="3" backgroundColor="0x99ffcc" cornerRadius="3" x="30" y="170" >
</s:BorderContainer>
<s:BorderContainer id="p2" borderColor="0x99ffcc" width="30" height="80" borderWeight="3" backgroundColor="0x99ffcc" cornerRadius="3" x="740" y="170" mouseDown="p2_mouseDownHandler(event)" mouseUp="p2_mouseUpHandler(event)" >
<s:Label text="DRAG ME" rotation="90" x="15" y="9"/>
</s:BorderContainer>
package net.codeinvain.data
{
import flash.events.TimerEvent;
import flash.utils.Dictionary;
import flash.utils.Timer;
import mx.collections.ArrayCollection;
import mx.collections.ArrayList;
public class IndexedArrayCollection extends ArrayCollection
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
worldUIContainer.parseCompiseteVisualElement(composite,new ComplexShapeParser(ShapeFidality.LOW));
worldUIContainer.initPhysicsEngine();
}
<b2d:SkinnablePhysicsContainer id="worldUIContainer" autoStartPhysicsEngine="false" >
...
</b2d:SkinnablePhysicsContainer>
<s:Graphic x="100" id="composite" >
<s:Ellipse width="73" height="66" x="13" y="1">
<s:fill>
<s:SolidColor color="#ff00ff" alpha="1"/>
</s:fill>
</s:Ellipse>
<s:Rect width="9" height="50" rotation="45" x="36" y="79">
<s:fill>
<s:SolidColor color="#ff0000" alpha="1"/>
</s:fill>
<s:HSlider id="xGravitySlider" minimum="-10" maximum="10" value="0" width="170"/>
<s:HSlider id="yGravitySlider" minimum="-10" maximum="10" value="0" width="170"/>
<s:ToggleButton id="debugButton" content="Show Debug" color="0x000000"/>
<b2d:SkinnablePhysicsContainer ... yGravity="{yGravitySlider.value}" xGravity="{xGravitySlider.value}" debug="{debugButton.selected}" >
...
</b2d:SkinnablePhysicsContainer>
<b2d:SkinnablePhysicsContainer id="physicsContainer" width="640" height="480" backgroundColor="0x222222" x="200" y="30" setBoundries="true" autoStartPhysicsEngine="true" >
<s:Label color="white" text="This is a label field" x="0" y="0" fontSize="32"/>
<s:Button content="Click me to resize ! " x="50" y="50" click="button1_clickHandler(event)" id="btn"/>
<mx:Button label="standard MX button" x="100" y="100"/>
<s:TextInput text="standard text input you can edit me !" x="300" y="300"/>
</b2d:SkinnablePhysicsContainer>