Rollback to the previous hackery, this hackery didn't work.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@233 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -25,14 +25,16 @@ import flash.display.DisplayObject;
|
|||||||
|
|
||||||
import flash.geom.Rectangle;
|
import flash.geom.Rectangle;
|
||||||
|
|
||||||
import flash.text.TextField;
|
|
||||||
|
|
||||||
import mx.core.mx_internal;
|
import mx.core.mx_internal;
|
||||||
import mx.core.IFlexDisplayObject;
|
import mx.core.IFlexDisplayObject;
|
||||||
import mx.core.IInvalidating;
|
import mx.core.IInvalidating;
|
||||||
|
|
||||||
import mx.containers.VBox;
|
import mx.containers.VBox;
|
||||||
|
|
||||||
|
import mx.managers.IFocusManagerComponent;
|
||||||
|
|
||||||
|
import mx.skins.ProgrammaticSkin;
|
||||||
|
|
||||||
import com.threerings.flash.MediaContainer;
|
import com.threerings.flash.MediaContainer;
|
||||||
|
|
||||||
// TODO: there are focus issues in here that need dealing with.
|
// TODO: there are focus issues in here that need dealing with.
|
||||||
@@ -43,17 +45,13 @@ import com.threerings.flash.MediaContainer;
|
|||||||
// damn thing doesn't seem to grip onto the focus.
|
// damn thing doesn't seem to grip onto the focus.
|
||||||
//
|
//
|
||||||
public class GameContainer extends VBox
|
public class GameContainer extends VBox
|
||||||
|
implements IFocusManagerComponent
|
||||||
{
|
{
|
||||||
public var keyGrabber :TextField = new TextField();
|
|
||||||
|
|
||||||
public function GameContainer (url :String)
|
public function GameContainer (url :String)
|
||||||
{
|
{
|
||||||
keyGrabber.selectable = false;
|
|
||||||
rawChildren.addChild(keyGrabber);
|
|
||||||
|
|
||||||
rawChildren.addChild(_game = new MediaContainer(url));
|
rawChildren.addChild(_game = new MediaContainer(url));
|
||||||
|
|
||||||
// tabEnabled = true; // turned off by Container
|
tabEnabled = true; // turned off by Container
|
||||||
// focusRect = true; // we need the focus rect
|
// focusRect = true; // we need the focus rect
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,13 +60,6 @@ public class GameContainer extends VBox
|
|||||||
return _game;
|
return _game;
|
||||||
}
|
}
|
||||||
|
|
||||||
override public function setActualSize (w :Number, h :Number) :void
|
|
||||||
{
|
|
||||||
super.setActualSize(w, h);
|
|
||||||
keyGrabber.width = w;
|
|
||||||
keyGrabber.height = h;
|
|
||||||
}
|
|
||||||
|
|
||||||
// override public function setFocus () :void
|
// override public function setFocus () :void
|
||||||
// {
|
// {
|
||||||
// if (stage) {
|
// if (stage) {
|
||||||
@@ -80,29 +71,27 @@ public class GameContainer extends VBox
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// override protected function adjustFocusRect (obj :DisplayObject = null) :void
|
override protected function adjustFocusRect (obj :DisplayObject = null) :void
|
||||||
// {
|
{
|
||||||
// super.adjustFocusRect(obj);
|
super.adjustFocusRect(obj);
|
||||||
//
|
|
||||||
// // TODO: this is probably all wrong
|
// TODO: this is probably all wrong
|
||||||
// var focusObj :IFlexDisplayObject =
|
var focusObj :IFlexDisplayObject =
|
||||||
// IFlexDisplayObject(mx_internal::getFocusObject());
|
IFlexDisplayObject(mx_internal::getFocusObject());
|
||||||
// if (focusObj) {
|
if (focusObj) {
|
||||||
// var r :Rectangle = transform.pixelBounds;
|
var r :Rectangle = transform.pixelBounds;
|
||||||
// focusObj.setActualSize(r.width - 2, r.height - 2);
|
focusObj.setActualSize(r.width - 2, r.height - 2);
|
||||||
// focusObj.move(0, 0);
|
focusObj.move(0, 0);
|
||||||
//
|
|
||||||
// if (focusObj is IInvalidating) {
|
if (focusObj is IInvalidating) {
|
||||||
// IInvalidating(focusObj).validateNow();
|
IInvalidating(focusObj).validateNow();
|
||||||
//
|
|
||||||
// } else if (focusObj is ProgrammaticSkin) {
|
} else if (focusObj is ProgrammaticSkin) {
|
||||||
// ProgrammaticSkin(focusObj).validateNow();
|
ProgrammaticSkin(focusObj).validateNow();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
protected var _game :MediaContainer;
|
protected var _game :MediaContainer;
|
||||||
|
|
||||||
protected var _keyGrabber :TextField;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -521,9 +521,9 @@ public class GameControlBackend
|
|||||||
keyEventType :String, add :Boolean) :void
|
keyEventType :String, add :Boolean) :void
|
||||||
{
|
{
|
||||||
if (add) {
|
if (add) {
|
||||||
_container.keyGrabber.addEventListener(keyEventType, handleKeyEvent);
|
_container.addEventListener(keyEventType, handleKeyEvent);
|
||||||
} else {
|
} else {
|
||||||
_container.keyGrabber.removeEventListener(keyEventType, handleKeyEvent);
|
_container.removeEventListener(keyEventType, handleKeyEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user