PDA

View Full Version : Userinput in A Flash ActiveXObject


decapitator
06-23-2008, 03:06 PM
Hello Everyone,
I came across yet another problem this time about the combination of MXS and a Flash ActiveXObject.

The problem is just like I know from the dotNET listview example about the label edit part. So in that case it isnt such a real problem since they thought of enableAccelerators. So thats what I did in my case with my flash movie... This works.. But not good.

Most of the typing works except for a few things like the RETURN key wont register a new line while if you open the SWF with the flash player (or if you dont have open in your browser) the textField would work as it should. Also when using CTRL+C etc it replaces the selection with some kind of garbage char (this can be worked around in flash itself but its not what it should be).

After some (more like 6) hours of research I managed to find these thingsI figured out that for some CTRL combinations windows actually generates multiple messages. For example, CTRL+C will generate:
WM_KEYDOWN: VK_CONTROL
WM_KEYDOWN: 0x43 (ASCII for 'C')
WM_CHAR: VK_CANCEL (0x03)I believe the problem is that flash is received the VK_CANCEL and trying to draw ASCII character 0x03 which ends up replacing the selection with a garbage character.
I have modified my projector to filter out the sending of non-drawable WM_CHAR messages and this seems to avoid the garbage characters in flash. I will now try to implement the suggested code to see if I can get the copy and paste to actually work!If he's correct about that it explains why its doing the same thing here a bit further down it was replied withOr you could have added code to pre-translate accelerator messages to your window's message loop in your C++ project. That would translate the raw keystroked into the correct windows messages before they get to the Flash player and would have required no code changes in your FLA. That's pretty much how I do it in SWF StudioBut max only has enableAccelerators (or does that come down to the same thing?). If you have tried my example (at the bottom) disabeling it does help a bit if you want to write down text. But it still adds that garbage char when trying copy/paste, and it still freaks on the RETURN key.

Im not expecting much flash guru's here but for what I see its more the MXS side thats not cooperating. Im hoping someone might have come across this in dotNET or something, or has any suggestions on how this could be fixed.

My example files can be found here in the attatchment or at http://www.box.net/shared/s0dxrk6wwg (http://www.box.net/shared/exobm1lkwc) (zip file with ms, fla (Flash CS3), swf and a txt file with the ActionScript used)

From what I know the site works fine although I never used it before, but im forced to use something like that since I'm not allowed ftp access at the office. If there are any problems please notify me and ill try to fix something else.

Regards,
Jenne

Edit: Oh and is there a way to trigger something when a dialog gets focus becouse the enableAccelerators is set back once you click outside the dialog. So when you move back in its on true while it should be off.
Edit2: added attatchment

davestewart
06-26-2008, 12:40 PM
I'm afraid I can't help with the problem directly, but I find enableaccellerators to be completely unreliable at the best of times.

If anyone from Autodesk is reading this...

magicm
06-26-2008, 01:32 PM
I think the best you can do is to have flash send a message to max when the textbox in your movie receives focus. Catch the event in your script and do a enableAccelerators = false in the event.

This works well for dotNetcontrols (onfocus event) so I suppose it should work for flash movies as well.

Martijn

decapitator
06-26-2008, 02:47 PM
I think the best you can do is to have flash send a message to max when the textbox in your movie receives focus. Catch the event in your script and do a enableAccelerators = false in the event.

This works well for dotNetcontrols (onfocus event) so I suppose it should work for flash movies as well.

MartijnThat doesn't solve the problem. Thats actually what I had before finding out that enable accelerators worked local (setting it on/off in a dialog).

But as I said it does work, it only doesn't do what should be expected because its just for singe characters and some other loose buttons (blame flash I guess). The copy/paste/etc shortcuts must be handled differently somehow. And the linebreak char is added to the textfield as a nice square. But its not evaluated as an actual new line even when its set to multiline.
But I don't see any possible things on what causes the problem let alone finding a good solution for it.

CGTalk Moderation
06-26-2008, 02:47 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.