Capture CTRL+A, CTRL+C keys/events in flex - actionscript-3

How to capture CTRL+A, CTRL+C events in flex? It looks like they are special keys/combinations.
As I understand in Flex 3.4 I can capture CTRL+A by capturing Event.SELECT_ALL, and CTRL+C by capturing Event.COPY. BUT it complains that there are no SELECT_ALL static const in Event class.
I'm using Flex SDK 3.4 and Flex Builder for Linux (Ubuntu).
public function MyCanvas()
{
super();
focusEnabled = true;
addEventListener(Event.SELECT_ALL, onSelectAll); // It complains here
addEventListener(Event.COPY, onCopy); // and here
}

According to Flex 3.4 language reference there is SELECT_ALL in Event class. What version of Flex SDK are you using? Can you post example of your code?
Update: It seems the SELECT_ALL has been added in Flash Player 10. Based on this.

I don't see this from the API, but it could be an issue of targeting the right Flash player version.

You're probably not targeting Flash 10. In Project > Properties > Flex Compiler, make sure you've set either Require Flash Version: 10.0.0 (under HTML Wrapper -- yours may read 9.x.x) or otherwise specified the compiler argument -target-player=10.0.0. That ought to do the trick.

Related

ChartboostX not loading more apps

I am using this wrapper someone recommended for my iOS cocos2dx game link. It works when I call the showInterstitial() method, but when I try to use the showMoreApps the dialog appears for a split second and then disappears.
In my AppDelegate::applicationDidFinishLaunching() I do this
ChartboostX::sharedChartboostX()->setAppId("REDACTED");
ChartboostX::sharedChartboostX()->setAppSignature("REDACTED");
ChartboostX::sharedChartboostX()->startSession();
ChartboostX::sharedChartboostX()->cacheMoreApps();
And then when I want to call the showMoreApps I do this
ChartboostX::sharedChartboostX()->showMoreApps();
Have a look at my wrapper for Chartboost. It has been updated to use the latest version of the Chartboost SDK and works perfectly in my cocos2D-x game. I have not finished the android documentation yet but you can probably work it out yourself if you need to. The documentation for iOS is almost finished and quite easy to follow.(FYI the class ADELLE is the chartboost delegate and is an objective C++ class so you can use C++ in it as you normally would mixed in with the objective C. This is the same for AdWrapper.mm)
Check it out and see if it works for you.
https://github.com/Lochlanna/Chartboost-Cocos2D-x

Adobe Flash Builder : AddChild vs AddElement

Using Adobe Flash Builder 4.0 ?
Getting error when using addChild(). Compiler suggests about using addElement(). Are both these functions alternate of each other ? Or is it like addChild is deprecated ?
To get clear. Adobe Flash Builder is IDE for developing flex apps. What's important is Flex SDK version. Obviously you're using version 4+. I suggest to avoid using mx (Flex 3) components without strong need. You should read more about Flex 3 and Flex 4 difference.
Post about addChild vs addElement.

How to use robotlegs and signals without flex ie. pure as3

I'm try to put together a bare bones robotlegs-signals project but all the samples I've seen are flex ie
Index.mxml
<context:SignalCafeContext contextView="{this}"/>
SignalCafeContext.as
public class SignalCafeContext extends SignalContext
{
override public function startup():void
{
injector.mapSingleton.... etc etc
}
}
Is this possible to replace the mxml with another .as file - normally I would pass from the main class
context = new MyContext(this); // where this is DisplayObjectContainer
however super() takes no parameters in SignalContext so I might be missing something.
More Info:
libs:
as3-signals-v0.5.swc
robotlegs-framework-v1.03.swc
signals-extensions-SignalsCommandMap.swc
What you're trying would work in the current RobotLegs v.1 release (v.1.5.2). Context and its subclass SignalContext take optional params. The first param is your context view:
contextView:DisplayObjectContainer = null
Here's the SignalContext class extending Context.
Note, Context in Robotlegs 2 does not take parameters (source).
I imagine you need to start with a actionscript project instead of a flex project in FlashBuilder first.
Yes, your right, you just extend the Context class, as you can see in the basic HelloFlash robotlegs demo
mxml tags are just shorthand for actionscript classes. So I'd imagine you could start by taking a look at the auto-generated actionscript code. There is a flash builder compiler option that will let you see this. Using that as a template, you probably can't go too far wrong.

StageDisplayState.FULLSCREEN vs StageDisplayState.FULLSCREEN_INTERACTIVE

What's the difference between the the two display states?
StageDisplayState.FULL_SCREEN doesn't support keyboard interactivity. StageDisplayState.FULL_SCREEN_INTERACTIVE does, but it works only with Adobe AIR.
Source: Adobe ActionScript3 Reference
StageDisplayState.FULLSCREEN is available in both AIR and normal Flex web apps, Keyboard is not traced
StageDisplayState.FULLSCREEN_INTERACTIVE available ONLY IN AIR and it allows you to used the keyboard. for ex you can type inside a TextInput in FS only with FullScreenInteractive.
StageDisplayState.FULL_SCREEN_INTERACTIVE can work in flex webapp.when you compile web app,you just need to replace the playerglobal.swc by high version,like 11.7。。。
hope it helps you

Handling JavaScript calls to window.open()- not using Native Windows - Adobe AIR

I am developing an Adobe AIR application which uses both native windows and floating panels. Is is possible to enable the creation of a floating window instead of a native window when a JavaScript window.open() function is called?
It is required that all of the floating windows are contained within one native window, therefore the creation of more native windows is not suitable.
I have used a Custom HTMLHost class in order to enable the creation of a native window but I can’t work out a way of creating a MDI window instead. I am using the flexMDI framework for my floating panel interface.
Any help on this would be much appreciated.
You can try hijacking the HTML's window object via code:
htmlContent.addEventListener(Event.COMPLETE, htmlLoaded);
private function myOpenFunction(...args) {
// Do stuff with args
}
private function htmlLoaded(event:Event):void
{
htmlContent.domWindow.open = myOpenFunction;
}
I'm not sure if that (or something very similar) will work, but it's probably the only way to do it if it can be done at all.