Amit Shrestha

listen for ESC key event at the main application then on key down do following in your event listener :

  1. private function keyDownEvent(event:KeyboardEvent):void {
  2.    if (event.keyCode == Keyboard.ESCAPE) {
  3.       DragManager.acceptDragDrop(null);
  4.       // get drag proxy
  5.       var dragProxy: DragProxy = DragManager.mx_internal::dragProxy;
  6.       if (dragProxy != null) {
  7.       //provide some thing for mouse up
  8.       dragProxy.mouseUpHandler(new MouseEvent(MouseEvent.MOUSE_UP));
  9.    }
  10.  }
  11. }

http://xtrace.blogspot.com/2011/09/stateful-example-in-extjs-saving-tree.html  [Migrating to this blog,,flollow there for further updates]

More on extjs at: http://xtrace.blogspot.com/search/label/extjs

First read this:  http://dev.sencha.com/deploy/ext-4.0.2a/docs/#/api/Ext.state.Stateful-cfg-stateful

Following example demonstrate simple way to save a selected item in tree:

  1. this.tree = Ext.create(‘Ext.tree.Panel’, {
  2.     viewConfig: {
  3.         plugins: {
  4.             ptype: ‘treeviewdragdrop’,
  5.             appendOnly: true
  6.         }
  7.     },
  8.     height: 350,
  9.     width: 400,
  10.     stateEvents: [‘saveSelectedItem’],
  11.     stateId:’myTreeId’,
  12.     stateful:true,
  13.     rootVisible: false,
  14.     mySelectedItem:”,//my own added Variable
  15.     getState : function () {
  16.         /*this is place where we state what things are to be saved*/
  17.         console.log(‘saving’+this.mySelectedItem);
  18.         /*we return thing to be save in format key:value*/
  19.         return {
  20.             mySelectedItem: this.mySelectedItem
  21.         }
  22.     },
  23.     applyState : function (state) {
  24.         /*this is place where we recover the saved state*/
  25.         console.log(state);
  26.         console.log(“Previosuly selected “+state.mySelectedItem);
  27.      },
  28.     listeners:{
  29.        itemclick:{fn:function (view, record, item, index, even) {
  30.             console.log(“saving item:”+record.data.text);
  31.             this.mySelectedItem =  record.data.text;
  32.             this.fireEvent(‘saveSelectedItem’);
  33.        }}
  34.     }
  35. });
…………

[image source: http://wikipedia.org%5D

Get implementation here : strategy_pattern.zip   [It’s an eclipse java project]

I had problem in generating web application from web ratio. I would like to share the solution i found,, because other may also face same problem
After viewing the description , Problem seems to be to fact that, i had my tomcat directory in my “Program File” and webration was in some other directory and my Operating system [windows 7] denied the write to that folder.
[my webratio did’nt had tomcat installation in it, because i denies installation of tomcat as i already had one]
Solution:
In the project outline view, select the project
In the project property view, you will find the “output path”
Change this path to some other location
[Once deployed , you can just copy the deployed folder to tomcat “webapp” folder manually and restart the tomcat]

[http://xtrace.blogspot.com/2011/09/problem-while-generating-web.html]

Tags:

[Note: it is about Porting / migrating  flex3 project to Flex 4 project with minimal/no change in code and, ofcourse without having to install Flash Builder 4 ie, it does’nt matter if you have  Flex 4 IDE or not ]. If you are looking for changing whole code , like tags, add child etc etc. then have a look at: http://www.learnosity.com/techblog/index.cfm/2010/3/21/Flex-3-to-Flex-4-Migration-Howto

I did following things:

Add “-theme=${flexlib}/themes/Halo/halo.swc” to compiler additional argument [in eclipse” rt click project> properties> Flex compiler”]. So that compiler know  it’s a Hallo theme project

[This should eliminate most of errors]

Now i got following run time errors:

1)Error: Compatibility version has already been read.
at mx.core::FlexVersion$/set compatibilityVersion()
at mx.core::FlexVersion$/set compatibilityVersionString()
at styles_boo_mx_core_FlexModuleFactory()

Solution = I was loading the sytle swf file at run time to set style. Now i conpiled that file too in Felx 4, and this error was gone.

2)VerifyError: Error #1053: Illegal override of activate in mx.managers.SystemManagerProxy.

Solution = I was loading a swf module at the run time.  So again i compile that swf with Flex 4. And now that error was gone too.

And hence a working project in Felx 4 🙂

Tags: ,