Solved

What is BookMark Error in flex and how it is resolved?

Posted on 2009-07-02
14
1,583 Views
Last Modified: 2012-05-07
var res:ArrayCollection = event.result as  ArrayCollection;
if(folderObj.children != null)
       folderObj.children.addItem(res[i]);

In the above code, i am getting the following error.

Error: Bookmark no longer valid.
      at ListCollectionViewCursor/seek()
      at mx.collections::HierarchicalCollectionViewCursor/get current()
      at mx.collections::HierarchicalCollectionViewCursor/collectionChangeHandler()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.collections::HierarchicalCollectionView/nestedCollectionChangeHandler()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.collections::ListCollectionView/dispatchEvent()
      at mx.collections::ListCollectionView/addItemsToView()
      at mx.collections::ListCollectionView/listChangeHandler()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.collections::ArrayList/internalDispatchEvent()
      at mx.collections::ArrayList/addItemAt()
      at mx.collections::ListCollectionView/addItemAt()
      at mx.collections::ListCollectionView/addItem()
      at com.zetainteractive.model.managers::ListManager/sampleData()
      at com.cynergysystems.tango::GenericResponder/result()
      at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()
      at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()
      at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
      at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
      at mx.rpc::Responder/result()
      at mx.rpc::AsyncRequest/acknowledge()
      at NetConnectionMessageResponder/resultHandler()
      at mx.messaging::MessageResponder/result()
0
Comment
Question by:vmarada
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
14 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 500 total points
ID: 24761160
What is the type of "folderObj.children"? A ListCollectionView I suppose?

Try replacing

var res:ArrayCollection = event.result as  ArrayCollection;
if(folderObj.children != null)
       folderObj.children.addItem(res[i]);

by

var res:ArrayCollection = event.result as  ArrayCollection;
if(folderObj.children != null) {
       var lcv:ListCollectionView = folderObj.children as ListCollectionView;
       lcv.disableAutoUpdate();
       lcv.addItem(res[i]);
       lcv.enableAutoUpdate();
}
0
 

Author Comment

by:vmarada
ID: 24761329
folderObj.children is an ArrayCollection.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24761367
>> folderObj.children is an ArrayCollection
Good! Since an ArrayCollection extends ListCollectionView:

var res:ArrayCollection = event.result as  ArrayCollection;
if(folderObj.children != null) {
       var ac:ArrayCollection = folderObj.children as ArrayCollection;
       ac.disableAutoUpdate();
       ac.addItem(res[i]);
       ac.enableAutoUpdate();
}
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:vmarada
ID: 24761400
folderObj.children.enableAutoUpdate();

same error is being shown in the above line.

Error: Bookmark no longer valid.
      at ListCollectionViewCursor/seek()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:2048]
      at mx.collections::HierarchicalCollectionViewCursor/get current()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\collections\HierarchicalCollectionViewCursor.as:198]
      at mx.controls.advancedDataGridClasses::AdvancedDataGridBase/createRow()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\advancedDataGridClasses\AdvancedDataGridBase.as:1629]
      at mx.controls.advancedDataGridClasses::AdvancedDataGridBase/makeRowsAndColumns()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\advancedDataGridClasses\AdvancedDataGridBase.as:892]
      at mx.controls::AdvancedDataGridBaseEx/makeRowsAndColumns()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:1918]
      at mx.controls::AdvancedDataGrid/makeRowsAndColumns()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\AdvancedDataGrid.as:7169]
      at mx.controls.listClasses::AdvancedListBase/makeRowsAndColumnsWithExtraRows()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\listClasses\AdvancedListBase.as:1231]
      at mx.controls.listClasses::AdvancedListBase/updateDisplayList()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\listClasses\AdvancedListBase.as:3501]
      at mx.controls::AdvancedDataGridBaseEx/updateDisplayList()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:1778]
      at mx.controls::AdvancedDataGrid/updateDisplayList()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\AdvancedDataGrid.as:6007]
      at mx.controls.listClasses::AdvancedListBase/validateDisplayList()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\listClasses\AdvancedListBase.as:3072]
      at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:622]
      at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:695]
      at Function/http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628]
      at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.collections::HierarchicalCollectionView/nestedCollectionChangeHandler()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\collections\HierarchicalCollectionView.as:1202]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.collections::ListCollectionView/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:833]
      at mx.collections::ListCollectionView/addItemsToView()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:931]
      at mx.collections::ListCollectionView/listChangeHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1051]
      at mx.collections::ListCollectionView/handlePendingUpdates()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1210]
      at mx.collections::ListCollectionView/enableAutoUpdate()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:370]
      at com.zetainteractive.model.managers::ListManager/sampleData()[D:\ZetaMail5\zetamail_flex\src\com\zetainteractive\model\managers\ListManager.as:2807]
      at com.cynergysystems.tango::GenericResponder/result()[D:\ZetaMail5\zetamail_flex\src\com\cynergysystems\tango\GenericResponder.as:22]
      at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncToken.as:199]
      at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\events\ResultEvent.as:172]
      at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:193]
      at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:193]
      at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
      at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
      at NetConnectionMessageResponder/resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:515]
      at mx.messaging::MessageResponder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:199]
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24761429
What if you remove the enableAutoUpdate() and just keep the disableAutoUpdate()?
0
 

Author Comment

by:vmarada
ID: 24761568
The objects are not getting added to the folderObj, if i remove enableAutoUpdate().
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24762183
>> The objects are not getting added to the folderObj, if i remove enableAutoUpdate().
Well, they are but the view doesn't show them due to disableAutoUpdate() call as the Flex help states:

Prevents changes to the collection itself and items within the collection from being dispatched by the view. Also prevents the view from updating the positions of items if the positions change in the collection.

But the above is followed by:
The changes will be queued and dispatched appropriately after enableAutoUpdate is called.
The disableAutoUpdate method acts cumulatively; the same number of calls to enableAutoUpdate  are required for the view to dispatch events and refresh.

So, the question is: when calling enableAutoUpdate() again without having the problem...
0
 

Author Comment

by:vmarada
ID: 24765460
how to find that ....by calling enableAutoUpdate() will not cause the problem....
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24770383
It's clear that calling disableAutoUpdate() helps in avoiding the error.
Apparently calling enableAutoUpdate() is also needed if you want the view to be updated according to the changes.
But if you do at that point, you get the same error.
Maybe you should call it "later"...

Could you try this:

var res:ArrayCollection = event.result as  ArrayCollection;
if(folderObj.children != null) {
       folderObj.children.disableAutoUpdate();
       folderObj.children.addItem(res[i]);
       callLater(
           public function():void {
                folderObj.children.enableAutoUpdate();
       });
}
0
 

Author Comment

by:vmarada
ID: 24785657
Compilation error is showing in the above code at callLater saying that "call to a possibly undefined method callLater".
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24793193
Well, callLater() is a method that can be called on all objects that inherit from the UIComponent class.
I don't know the context of your code snippet.
I would suggest you call it on the "view class/control" that displays that collection.
0
 

Author Comment

by:vmarada
ID: 24979925
Here the Problem is the code is in the Action Script File. How to deal with that in AS file
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24980076
>> the code is in the Action Script File
I was already assuming that, yes.
My comment stays valid.

If you simply wrote callLater() in fact you call it on this, being the instance of the class your AS file represents.
That class should inherit from UIComponent.
0
 

Author Closing Comment

by:vmarada
ID: 31599087
Addressed partiakl fix
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question