Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-07-02
14
Medium Priority
?
1,612 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 1000 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

609 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