Skip to content

Instantly share code, notes, and snippets.

View codeinvain's full-sized avatar

Daniel Cohen codeinvain

  • Cloudinary
  • Limassol, Cyprus
View GitHub Profile
<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>
<b2d:SkinnablePhysicsContainer id="worldUIContainer" autoStartPhysicsEngine="false" >
...
</b2d:SkinnablePhysicsContainer>
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
worldUIContainer.parseCompiseteVisualElement(composite,new ComplexShapeParser(ShapeFidality.LOW));
worldUIContainer.initPhysicsEngine();
}
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
<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>
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;
private function onBodiesContact(e:b2ContactEvent):void
{
var b1:UIComponent = e.contact.GetFixtureA().GetBody().GetUserData();
var b2:UIComponent = e.contact.GetFixtureB().GetBody().GetUserData();
if (b1==p1 || b2 ==p1)
{
hitSound.play();
}
else if (b1==p2 || b2== p2)
{
@codeinvain
codeinvain / gist:711441
Created November 23, 2010 08:07
compile qt for vs2010
cd C:\Qt\4.7.1x32\
set PATH += C:\Qt\4.7.1x32\
set PATH += C:\Qt\4.7.1x32\bin
set LIB += C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
set Include += C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
@codeinvain
codeinvain / npm.xmllibjs.log
Created March 31, 2011 05:50
error log while installing libxmljs using npm
npm info it worked if it ends with ok
npm info using npm@0.3.18
npm info using node@v0.4.2
npm info preinstall libxmljs@0.4.1
make: scons: No such file or directory
make: *** [node] Error 1
npm info libxmljs@0.4.1 Failed to exec preinstall script
npm ERR! install failed Error: libxmljs@0.4.1 preinstall: `make node`
npm ERR! install failed `sh "-c" "make node"` failed with 2
npm ERR! install failed at ChildProcess.<anonymous> (/usr/local/lib/node/.npm/npm/0.3.18/package/lib/utils/exec.js:49:20)