vmarada
asked on
What is BookMark Error in flex and how it is resolved?
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/s eek()
at mx.collections::Hierarchic alCollecti onViewCurs or/get current()
at mx.collections::Hierarchic alCollecti onViewCurs or/collect ionChangeH andler()
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.collections::Hierarchic alCollecti onView/nes tedCollect ionChangeH andler()
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.collections::ListCollec tionView/d ispatchEve nt()
at mx.collections::ListCollec tionView/a ddItemsToV iew()
at mx.collections::ListCollec tionView/l istChangeH andler()
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.collections::ArrayList/ internalDi spatchEven t()
at mx.collections::ArrayList/ addItemAt( )
at mx.collections::ListCollec tionView/a ddItemAt()
at mx.collections::ListCollec tionView/a ddItem()
at com.zetainteractive.model. managers:: ListManage r/sampleDa ta()
at com.cynergysystems.tango:: GenericRes ponder/res ult()
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/ackno wledge()
at NetConnectionMessageRespon der/result Handler()
at mx.messaging::MessageRespo nder/resul t()
if(folderObj.children != null)
folderObj.children.addItem
In the above code, i am getting the following error.
Error: Bookmark no longer valid.
at ListCollectionViewCursor/s
at mx.collections::Hierarchic
at mx.collections::Hierarchic
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.collections::Hierarchic
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.collections::ListCollec
at mx.collections::ListCollec
at mx.collections::ListCollec
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.collections::ArrayList/
at mx.collections::ArrayList/
at mx.collections::ListCollec
at mx.collections::ListCollec
at com.zetainteractive.model.
at com.cynergysystems.tango::
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()
at mx.rpc.events::ResultEvent
at mx.rpc::AbstractOperation/
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/ackno
at NetConnectionMessageRespon
at mx.messaging::MessageRespo
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> 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();
}
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();
}
ASKER
folderObj.children.enableA utoUpdate( );
same error is being shown in the above line.
Error: Bookmark no longer valid.
at ListCollectionViewCursor/s eek()[C:\a utobuild\3 .2.0\frame works\proj ects\frame work\src\m x\collecti ons\ListCo llectionVi ew.as:2048 ]
at mx.collections::Hierarchic alCollecti onViewCurs or/get current()[C:\work\flex\dmv _automatio n\projects \datavisua lisation\s rc\mx\coll ections\Hi erarchical Collection ViewCursor .as:198]
at mx.controls.advancedDataGr idClasses: :AdvancedD ataGridBas e/createRo w()[C:\wor k\flex\dmv _automatio n\projects \datavisua lisation\s rc\mx\cont rols\advan cedDataGri dClasses\A dvancedDat aGridBase. as:1629]
at mx.controls.advancedDataGr idClasses: :AdvancedD ataGridBas e/makeRows AndColumns ()[C:\work \flex\dmv_ automation \projects\ datavisual isation\sr c\mx\contr ols\advanc edDataGrid Classes\Ad vancedData GridBase.a s:892]
at mx.controls::AdvancedDataG ridBaseEx/ makeRowsAn dColumns() [C:\work\f lex\dmv_au tomation\p rojects\da tavisualis ation\src\ mx\control s\Advanced DataGridBa seEx.as:19 18]
at mx.controls::AdvancedDataG rid/makeRo wsAndColum ns()[C:\wo rk\flex\dm v_automati on\project s\datavisu alisation\ src\mx\con trols\Adva ncedDataGr id.as:7169 ]
at mx.controls.listClasses::A dvancedLis tBase/make RowsAndCol umnsWithEx traRows()[ C:\work\fl ex\dmv_aut omation\pr ojects\dat avisualisa tion\src\m x\controls \listClass es\Advance dListBase. as:1231]
at mx.controls.listClasses::A dvancedLis tBase/upda teDisplayL ist()[C:\w ork\flex\d mv_automat ion\projec ts\datavis ualisation \src\mx\co ntrols\lis tClasses\A dvancedLis tBase.as:3 501]
at mx.controls::AdvancedDataG ridBaseEx/ updateDisp layList()[ C:\work\fl ex\dmv_aut omation\pr ojects\dat avisualisa tion\src\m x\controls \AdvancedD ataGridBas eEx.as:177 8]
at mx.controls::AdvancedDataG rid/update DisplayLis t()[C:\wor k\flex\dmv _automatio n\projects \datavisua lisation\s rc\mx\cont rols\Advan cedDataGri d.as:6007]
at mx.controls.listClasses::A dvancedLis tBase/vali dateDispla yList()[C: \work\flex \dmv_autom ation\proj ects\datav isualisati on\src\mx\ controls\l istClasses \AdvancedL istBase.as :3072]
at mx.managers::LayoutManager /validateD isplayList ()[C:\auto build\3.2. 0\framewor ks\project s\framewor k\src\mx\m anagers\La youtManage r.as:622]
at mx.managers::LayoutManager /doPhasedI nstantiati on()[C:\au tobuild\3. 2.0\framew orks\proje cts\framew ork\src\mx \managers\ LayoutMana ger.as:695 ]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callL aterDispat cher2()[C: \autobuild \3.2.0\fra meworks\pr ojects\fra mework\src \mx\core\U IComponent .as:8628]
at mx.core::UIComponent/callL aterDispat cher()[C:\ autobuild\ 3.2.0\fram eworks\pro jects\fram ework\src\ mx\core\UI Component. as:8568]
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.collections::Hierarchic alCollecti onView/nes tedCollect ionChangeH andler()[C :\work\fle x\dmv_auto mation\pro jects\data visualisat ion\src\mx \collectio ns\Hierarc hicalColle ctionView. as:1202]
at flash.events::EventDispatc her/dispat chEventFun ction()
at flash.events::EventDispatc her/dispat chEvent()
at mx.collections::ListCollec tionView/d ispatchEve nt()[C:\au tobuild\3. 2.0\framew orks\proje cts\framew ork\src\mx \collectio ns\ListCol lectionVie w.as:833]
at mx.collections::ListCollec tionView/a ddItemsToV iew()[C:\a utobuild\3 .2.0\frame works\proj ects\frame work\src\m x\collecti ons\ListCo llectionVi ew.as:931]
at mx.collections::ListCollec tionView/l istChangeH andler()[C :\autobuil d\3.2.0\fr ameworks\p rojects\fr amework\sr c\mx\colle ctions\Lis tCollectio nView.as:1 051]
at mx.collections::ListCollec tionView/h andlePendi ngUpdates( )[C:\autob uild\3.2.0 \framework s\projects \framework \src\mx\co llections\ ListCollec tionView.a s:1210]
at mx.collections::ListCollec tionView/e nableAutoU pdate()[C: \autobuild \3.2.0\fra meworks\pr ojects\fra mework\src \mx\collec tions\List Collection View.as:37 0]
at com.zetainteractive.model. managers:: ListManage r/sampleDa ta()[D:\Ze taMail5\ze tamail_fle x\src\com\ zetaintera ctive\mode l\managers \ListManag er.as:2807 ]
at com.cynergysystems.tango:: GenericRes ponder/res ult()[D:\Z etaMail5\z etamail_fl ex\src\com \cynergysy stems\tang o\GenericR esponder.a s:22]
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[C:\aut obuild\3.2 .0\framewo rks\projec ts\rpc\src \mx\rpc\As yncToken.a s:199]
at mx.rpc.events::ResultEvent /http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[C:\autob uild\3.2.0 \framework s\projects \rpc\src\m x\rpc\even ts\ResultE vent.as:17 2]
at mx.rpc::AbstractOperation/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobu ild\3.2.0\ frameworks \projects\ rpc\src\mx \rpc\Abstr actOperati on.as:193]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C :\autobuil d\3.2.0\fr ameworks\p rojects\rp c\src\mx\r pc\Abstrac tInvoker.a s:193]
at mx.rpc::Responder/result() [C:\autobu ild\3.2.0\ frameworks \projects\ rpc\src\mx \rpc\Respo nder.as:43 ]
at mx.rpc::AsyncRequest/ackno wledge()[C :\autobuil d\3.2.0\fr ameworks\p rojects\rp c\src\mx\r pc\AsyncRe quest.as:7 4]
at NetConnectionMessageRespon der/result Handler()[ C:\autobui ld\3.2.0\f rameworks\ projects\r pc\src\mx\ messaging\ channels\N etConnecti onChannel. as:515]
at mx.messaging::MessageRespo nder/resul t()[C:\aut obuild\3.2 .0\framewo rks\projec ts\rpc\src \mx\messag ing\Messag eResponder .as:199]
same error is being shown in the above line.
Error: Bookmark no longer valid.
at ListCollectionViewCursor/s
at mx.collections::Hierarchic
at mx.controls.advancedDataGr
at mx.controls.advancedDataGr
at mx.controls::AdvancedDataG
at mx.controls::AdvancedDataG
at mx.controls.listClasses::A
at mx.controls.listClasses::A
at mx.controls::AdvancedDataG
at mx.controls::AdvancedDataG
at mx.controls.listClasses::A
at mx.managers::LayoutManager
at mx.managers::LayoutManager
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callL
at mx.core::UIComponent/callL
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.collections::Hierarchic
at flash.events::EventDispatc
at flash.events::EventDispatc
at mx.collections::ListCollec
at mx.collections::ListCollec
at mx.collections::ListCollec
at mx.collections::ListCollec
at mx.collections::ListCollec
at com.zetainteractive.model.
at com.cynergysystems.tango::
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[C:\aut
at mx.rpc.events::ResultEvent
at mx.rpc::AbstractOperation/
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/ackno
at NetConnectionMessageRespon
at mx.messaging::MessageRespo
What if you remove the enableAutoUpdate() and just keep the disableAutoUpdate()?
ASKER
The objects are not getting added to the folderObj, if i remove enableAutoUpdate().
>> 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...
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...
ASKER
how to find that ....by calling enableAutoUpdate() will not cause the problem....
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.disable AutoUpdate ();
folderObj.children.addItem (res[i]);
callLater(
public function():void {
folderObj.children.enableA utoUpdate( );
});
}
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.disable
folderObj.children.addItem
callLater(
public function():void {
folderObj.children.enableA
});
}
ASKER
Compilation error is showing in the above code at callLater saying that "call to a possibly undefined method callLater".
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.
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.
ASKER
Here the Problem is the code is in the Action Script File. How to deal with that in AS file
>> 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.
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.
ASKER
Addressed partiakl fix
ASKER