Solved

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

Posted on 2009-07-02
14
1,572 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
enable compression/gzip on oracle XML DB HTTP Server 3 568
Flex 3 application will not load when launched 6 346
Flex Builder 4.5 3 415
Adobe live streaming 8 697
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 describes how to reset your Windows 10 password when you've forgotten it.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

829 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