Undo and redo is not working on TextInput in AIR application? - apache-flex

I've just noticed in my AIR application that redo is not working. It also seems that there it only is going back one step (but sometimes two or three).
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:TextArea horizontalCenter="0" verticalCenter="0" />
</s:WindowedApplication>
I'm using CMD + Z for undo and CMD + Z + Shift for redo. I'm sure this was working at one point. Maybe it was only in the browser?
I'm using Flex 4.6 and AIR 3.6. I'm using Mac 10.10.5. I'm using Firefox 40.3. I also tried it in Safari.
Undo and redo work correctly in the text fields in both of those browsers using the same shortcut combinations listed.

according to docs it should work:
The Spark TextArea also supports unlimited undo/redo within one
editing session. An editing session starts when the control gets
keyboard focus and ends when the control loses focus.
but i noticed during development of my app that
when we use backspace it counts it as separate states
in other cases it see all changes as one

Related

Drawable Canvas

I recently upgraded my Flash Builder from Burrito to 4.5 Premium. I am trying to create this (Drawing Demo) in the latest version of Flex, on Blackberry Playbook, but I am getting errors:
Code
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:Panel layout="absolute" title="Draw Test" backgroundColor="#ffffff">
<mx:Canvas backgroundColor="#ffffff">
<mh:DrawableCanvas id="main" backgroundColor="#ffff80" backgroundAlpha="0" width="100%" height="100%" y="0" x="0">
</mh:DrawableCanvas>
</mx:Canvas>
</s:Panel>
</s:Application>
The Error
The prefix "mx" for element "mx:Canvas" is not bound. I have tried adding "xmlns:mx="http://www.adobe.com/2006/mxml" to the head with no joy.
Is canvas no longer supported? All I want is a canvas to draw onto to capture a human signature...
Any ideas?
EDIT:
Took onboard the advice but still getting something wrong, see screenshot.
Any ideas? Am I missing a mx.swc or something?
Canvas and all other components are still supported since Flex4 is backwards compatible with Flex3.
In your case, the error message says it all.
Your application does not correctly refer to the mx: namespace.
Therefore, it will not be able to find the Canvas component.
In a Spark application, it is advised to add the mx namespace as follows:
xmlns:mx="library://ns.adobe.com/flex/mx"
instead of
xmlns:mx="http://www.adobe.com/2006/mxml"
If your are migrating your Flex3 Halo application to a Flex4 Spark application, please read the official migration guide. Chapter 4 is particularly useful.
Cheers
Make sure that your project can use both MX and Spark components in Properties -> Flex Build Path
Move caret to the end of <mx:Canvas and press Ctrl + Space. IDE should suggest correct namespace.

Flex Accessibility - Cannot set screen reader order

I'm having a problem where I'm not able to set up a custom reading order for text in my Flex application. I'm setting the tabIndex property on each text element, which I understand is the proper way to set the reading order for a screen reader.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute">
<mx:Label x="10" y="10" text="1" tabIndex="2" />
<mx:Label x="10" y="36" text="2" tabIndex="1" />
<mx:Label x="10" y="62" text="3" tabIndex="3" />
</mx:Application>
For this small test application, the screen reader (JAWS 12) reads "1 2 3" instead of "2 1 3".
Some testing seems to indicate that this is only a problem for my particular configuration. I am compiling the application with Flex SDK 4.1, but using the MX component set only, and the Halo theme. We've got a fairly complex app which started out before Flex 4 was around, so while we have made the jump to compile with the latest SDK, we have not yet upgraded anything to use the Spark component set.
When I make a similar test app using the 4.1 SDK and the Spark components+theme, the reading order is set correctly. Same result if I make a test app and compile using the 3.5 SDK - everything works.
I know I could switch to using Spark components, but I'm trying to avoid that if I can as it would mean timelines would have to change on the current project I'm working on.
Has anyone run into any similar issues, or have any suggestions that might get this to work?
You'll want to use Text instead of Label. Documentation:
A Label control is read by a screen
reader when it is associated with
other controls, or when the Forms mode
is inactive. The Label control is not
focusable in Forms mode, or by the
keyboard.
...
A Text control is not focusable and is
read by screen readers only when Forms
mode is inactive.
I also found this which might be a better solution. The example is in Flex 4, but you can do the same with Label in Flex 3, just need to implement the IFocusManagerComponent interface.
Im working with JAWS 11 in Flex 3 at the moment, so havnt had that problem yet. But, i've read about one option of putting copies of the components offstage, its too complicated for our needs, and letting the screen reader just read these components in order:
http://www.adobe.com/accessibility/products/flash/reading.html#off_stage
Also, a trick I saw was to set the TabIndex in increments of 10. JAWs only cares about their order, and if you need to add extra components, you wont need to renumber everything. i.e. 10, 20, 30 then if you need you can add 11, rather than renumbering everything.
Brian

Workaround for AdvancedDataGrid flicker in Flex Hero 4.5.0.19786

Since I updated to the latest build of Flex Hero (4.5.0.19786) AdvancedDataGrids flicker in design view with Flash Builder Burrito preview. Has anyone run into this and if so is there a work-around besides dropping back a version?
Update 02 19:29
This did not occur in previous Hero builds, e.g 18623. I am using the default Spark theme, nothing else particularly special.
Update 01 19:15
I tracked down the problem to an instance of a custom (default custom, i.e the result of doing new->component based on AdvancedDataGrid) on the same form.
The component declaration:
<?xml version="1.0" encoding="utf-8"?>
<mx:AdvancedDataGrid
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</mx:AdvancedDataGrid>
The custom component instantiation. Note "fo" is a namespace representing the path to the package for which the custom component resides.
<fo:adgTest width="300" height="200">
<fo:columns>
<mx:AdvancedDataGridColumn headerText="blah1" />
<mx:AdvancedDataGridColumn headerText="blah2" />
</fo:columns>
</fo:adgTest>
It turns out that this custom version of AdvancedDataGrid causes the design view to break down. Very odd.
Update 03 2011-02-11 13:36
A custom AdvancedDataGrid does not cause design-view breakdown unless I add columns to it.
Update 04 2011-02-11 15:13
Filed as a bug: https://bugs.adobe.com/jira/browse/SDK-29507
I think, this is not the problem of sdk. Its a problem of the designer (Flex Burrito). I have exactly the same envoirment, and my version of burrito is 287807.
My AdvancedDataGrit does NOT flicker!
Do you have some styles applied or something else?
After following your steps described in your question, i also have a flickering custom AdvancedDatagrid on my stage. When i click to another component (tab) and go back to the implemented adg, the flickering stops.
When i close the Component with the flicker adg in it and open it again, the adg flicker again.
With the preversion of the sdk the adg doesn't flicker. I notice also, that the graphic is different.
In the preversion, i can see some folderIcons wirh teh expanded or closed arrows.
After switching to 19786 the foldericons disapear and the flickering starts.
There is something wrong and i would start a thread in adobe bug base.
In my opinion, you did nothing wrong. There is no better way and it is equal if i drag the custom ADG or code it in codeview. The result is always a flicker adg in designview.
Sorry for the misunderstands and my bad english
BR Frank

Adword: Encountered flash error - ad cannot use mouse tracking

Trying to create a banner ad as a one-off project for a client. I am using Flash Builder / AS 3 and with my simple hello world example. Google Adwords rejects the add with: Encountered flash error - ad cannot use mouse tracking.
I Have not been able to figure out what I am doing that signals to Adwords that I am mouse tracking. Follows is my simple mxml file: (the handleClick is to adhear to their clickTAG specification)
Thanks!!!
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="336" minHeight="280" width="336" height="280" includeInLayout="true" click="handleClick(event)">
<fx:Script>
<![CDATA[
public function handleClick(mouseEvent:MouseEvent):void {
navigateToURL(new URLRequest(root.loaderInfo.parameters.clickTAG),"_blank");
}
]]>
</fx:Script>
</s:Application>
It is quite possible that whatever automated analysis that Google does on the ads submitted is being confused by the Flex framework. You could try creating an ActionScript project instead of Flex project in Flash builder and see if that makes any difference.
If you use an ActionScript project you won't be able to use MXML for creating the ad, but you might not really even want to drag in the Flex framework, since it takes a while to load (the first time at least).

adobe flash buider (flex4): Error #2025 or Error: addChild() is not available in this class. Instead, use addElement()

I'm a complete newbie to Flex, so apologies for my dumbness. I've searched for an answer but haven't found anything that seems to be doing the trick.
What I'm trying to do: port this example http://www.adobe.com/devnet/air/flex/articles/flex_air_codebase_print.html
to Flash Builder 4.
All seems to be fine but for one thing. When I use the original code for the Air application
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="onApplicationComplete()">
<fx:Script>
<![CDATA[
private static const neededForCompilation:AirGeneralImplementation = null;
private function onApplicationComplete():void
{
var can:MainCanvas = new MainCanvas();
this.addChild(can);
can.labelMessage = "Loaded in an AIR Application ";
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:WindowedApplication>
I get this run time error
Error: addChild() is not available in
this class. Instead, use addElement()
or modify the skin, if you have one.
at
spark.components.supportClasses::SkinnableComponent/addChild()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:1038]
If I substitute the code with
this.addElement(can);
Everything loads well but the first time I try to press any of the buttons on the main canvas I get the following run time error
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/getChildIndex()
at mx.managers::SystemManager/getChildIndex()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1665]
at mx.managers.systemClasses::ActiveWindowManager/mouseDownHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\systemClasses\ActiveWindowManager.as:437]
here's the super simple code for the main canvas
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="init();">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script source="main.as" />
<mx:Label id="lblMessage" text="The UI from the shared Flex app BothCode" x="433" y="112"/>
<s:Button x="433" y="141" click="saveFile();" label="Save File"/>
<s:Button x="601" y="141" click="GeneralFactory.getGeneralInstance().airOnlyFunctionality();" label="Air Only"/>
</s:Application>
Any help would be immensely appreciated. And any pointers to how to setup a project that can compile in both Air and Flash while sharing the same code, all for Flex 4, would also be immensely appreciated.
thank you!
I ran into the same problem using that tutorial for Flex 4. I did the same thing as you and used the <s:Application> component for the Main Canvas. However the tutorial uses a <mx:VBox>, the solution I found was to change the Main Canvas from an <s:Application> to an <s:Group>. The problem seems to be embedding an Application within an Application.
The code on that link was written using the flex 3.5 sdk or below. You are using the new flex 4 sdk ( which is the default for Flash Builder ).
You can do the following:
1. step into the code do any necessary changes to make it work for flex 4 sdk.
2. setup a new project using the flex 3 sdk ( select "Use a specific SDK" and choose the Flex 3 from the dropdown box in the "New Project" window)
I would suggest going for the second option, make it work and once you've stepped a little deeper into flex 4 you can do the 1st option.
Cheers.

Resources