diff --git a/development/flash/lib-swc/preload.swc b/development/flash/lib-swc/preload.swc new file mode 100644 index 0000000..cef5a66 Binary files /dev/null and b/development/flash/lib-swc/preload.swc differ diff --git a/development/flash/lib-swc/preload.swf b/development/flash/lib-swc/preload.swf index 49742eb..37a7dbe 100644 Binary files a/development/flash/lib-swc/preload.swf and b/development/flash/lib-swc/preload.swf differ diff --git a/development/flash/src/Wrapper.as b/development/flash/src/Wrapper.as index ab7debd..5426ce7 100644 --- a/development/flash/src/Wrapper.as +++ b/development/flash/src/Wrapper.as @@ -27,7 +27,7 @@ package { [Embed(source="../lib-swc/preload.swf", symbol="LoadingScreenAsset")] private var LoadingScreenAsset:Class; - [Embed(source="../assets/images/Title Loading Bar Screen.png")] + [Embed(source="/../assets/images/Title Loading Bar Screen.png")] private var LoadBarBitmap:Class; private var _loader:Loader; diff --git a/development/flash/src/com/away3d/gloop/gameobjects/GoalWall.as b/development/flash/src/com/away3d/gloop/gameobjects/GoalWall.as index 91c757b..7c319c1 100644 --- a/development/flash/src/com/away3d/gloop/gameobjects/GoalWall.as +++ b/development/flash/src/com/away3d/gloop/gameobjects/GoalWall.as @@ -36,6 +36,7 @@ package com.away3d.gloop.gameobjects { _width = width; _physics = new GoalWallPhysicsComponent(this, offsetX, offsetY, width, height); _physics.enableReportBeginContact(); + _physics.enableReportEndContact(); super(offsetX, offsetY, width, height, worldX, worldY); initVisual(); @@ -64,8 +65,9 @@ package com.away3d.gloop.gameobjects { _splatDistance = 1; } - override public function onCollidingWithGloopStart( gloop:Gloop, event:ContactEvent = null ):void { - super.onCollidingWithGloopStart(gloop); + override public function onCollidingWithGloopEnd( gloop:Gloop, event:ContactEvent = null ):void { + + super.onCollidingWithGloopEnd(gloop); var gloopCenter:V2 = gloop.physics.b2body.GetWorldCenter(); var wallCenter:V2 = this.physics.b2body.GetWorldCenter(); diff --git a/development/flash/src/com/away3d/gloop/input/MouseManager.as b/development/flash/src/com/away3d/gloop/input/MouseManager.as index 3e1cb71..d79054a 100644 --- a/development/flash/src/com/away3d/gloop/input/MouseManager.as +++ b/development/flash/src/com/away3d/gloop/input/MouseManager.as @@ -3,6 +3,8 @@ package com.away3d.gloop.input import away3d.containers.View3D; + import com.away3d.gloop.utils.PlatformUtil; + import flash.events.Event; import flash.events.MouseEvent; import flash.geom.Point; @@ -20,6 +22,8 @@ package com.away3d.gloop.input protected var _view:View3D; protected var _mouseDown:Boolean = false; + private var _mouseIsOut:Boolean; + private var _needMouseLeaveHack:Boolean; public const PLANE_POSITION:Vector3D = new Vector3D( 0, 0, 0 ); @@ -29,18 +33,34 @@ package com.away3d.gloop.input _planeD = -_planeNormal.dotProduct( PLANE_POSITION ); _intersection = new Vector3D(); _intersectionPoint = new Point(); + + // need mouse leave hack? + if( !PlatformUtil.isRunningOnMobile() ) { + if( PlatformUtil.isRunningOnSafari() ) { + _needMouseLeaveHack = true; + } + } + } public function activate():void { _view.addEventListener( MouseEvent.MOUSE_DOWN, onViewMouseDown ); _view.stage.addEventListener( MouseEvent.MOUSE_UP, onViewMouseUp ); - _view.addEventListener( Event.MOUSE_LEAVE, onViewMouseUp ); + + if( _needMouseLeaveHack ) { + _view.stage.addEventListener( MouseEvent.MOUSE_MOVE, updateMouseLeave ); + } + _view.stage.addEventListener( Event.MOUSE_LEAVE, onViewMouseUp ); } public function deactivate():void { _view.removeEventListener( MouseEvent.MOUSE_DOWN, onViewMouseDown ); _view.stage.removeEventListener( MouseEvent.MOUSE_UP, onViewMouseUp ); - _view.removeEventListener( Event.MOUSE_LEAVE, onViewMouseUp ); + + if( _needMouseLeaveHack ) { + _view.stage.addEventListener( MouseEvent.MOUSE_MOVE, updateMouseLeave ); + } + _view.stage.addEventListener( Event.MOUSE_LEAVE, onViewMouseUp ); } public function update():void { @@ -80,5 +100,21 @@ package com.away3d.gloop.input public function get projectedMousePosition():Point { return _intersectionPoint; } + + public function updateMouseLeave( event:Event ):void { + if( _view.stage.mouseX < 0 || + _view.stage.mouseX > _view.stage.stageWidth || + _view.stage.mouseY < 0 || + _view.stage.mouseY > _view.stage.stageHeight ) { + if( !_mouseIsOut ) { + _mouseIsOut = true; + _view.stage.dispatchEvent( new Event( Event.MOUSE_LEAVE ) ); + } + } + else if( _mouseIsOut ) { + _mouseIsOut = false; + _view.stage.dispatchEvent( new Event( "mouseEnter" ) ); + } + } } } diff --git a/development/flash/src/com/away3d/gloop/utils/PlatformUtil.as b/development/flash/src/com/away3d/gloop/utils/PlatformUtil.as new file mode 100644 index 0000000..6194d60 --- /dev/null +++ b/development/flash/src/com/away3d/gloop/utils/PlatformUtil.as @@ -0,0 +1,41 @@ +package com.away3d.gloop.utils +{ + import flash.external.ExternalInterface; + import flash.system.Capabilities; + + public class PlatformUtil + { + public static function isRunningOnMobile():Boolean { + var playerType:String = Capabilities.playerType; + return playerType != "DirectX" && playerType != "PlugIn"; + } + + public static function isRunningOnSafari():Boolean { + var browser:String = checkBrowser(); + return browser == "Safari"; + } + + public static function checkBrowser():String { + var browser:String; + var strUserAgent:String = String( ExternalInterface.call( "function() {return navigator.userAgent;}" ) ).toLowerCase(); + if( strUserAgent.indexOf( "firefox" ) != -1 ) { + browser = "Firefox"; + } + else if( strUserAgent.indexOf( "msie" ) != -1 ) { + browser = "Internet Explorer"; + } + else if( strUserAgent.indexOf( "safari" ) != -1 ) { + browser = "Safari"; + } + else if( strUserAgent.indexOf( "chrome" ) != -1 ) { + browser = "Google Chrome"; + } + else if( strUserAgent.indexOf( "opera" ) != -1 ) { + browser = "Opera"; + } else { + browser = "none"; + } + return browser + } + } +} \ No newline at end of file