Solved

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

Posted on 2009-07-02
14
1,560 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
  • 7
  • 7
14 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 500 total points
Comment Utility
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
Comment Utility
folderObj.children is an ArrayCollection.
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> 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
 

Author Comment

by:vmarada
Comment Utility
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
Comment Utility
What if you remove the enableAutoUpdate() and just keep the disableAutoUpdate()?
0
 

Author Comment

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

Expert Comment

by:zzynx
Comment Utility
>> 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

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

Expert Comment

by:zzynx
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>> 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
Comment Utility
Addressed partiakl fix
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
flash keyboard access html form 15 336
Custom Component 1 239
Querying XML Data Type 4 538
Adobe URL is default to local hosts in my Mac Air 13 530
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…
This article will show you how to create an ISO CD-ROM/DVD-ROM image (*.iso), and MD5 checksum signature, for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5). It's a good idea to compare checksums, because many installations fail because of a corr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now