From: m88e24 <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, 24 July, 2006 8:30:20 AM
Subject: [flexcoders] TypeError when using removedEffect on custom component within Repeater
Flex 2
Player r15 (debug version installed by builder)
A repeater is bound to an ArrayCollection. The ArrayCollection is
dynamically updated. Objects are added and removed at runtime. This
works satisfactory. Now I want the removal of an object to trigger an
effect which is much nicer than just removing an item from the screen
with the blink of an eye. So I use the removedEffect in my custom
component.
The code looks something like this.
My custom component (just the bits that are relevant):
<mx:Canvas xmlns:mx="http://www.adobe. com/2006/ mxml"
creationComplete= "initApp( )"
currentState= "{assistant. availability} "
horizontalScrollPol icy="off" verticalScrollPolic y="off"
creationCompleteEff ect="{appear} " removedEffect= "{disappear} ">
<mx:Parallel id="appear" >
<mx:Fade alphaFrom="0" duration="1000" />
</mx:Parallel>
<mx:Parallel id="disappear" >
<mx:Fade alphaTo="0" duration="1000" />
</mx:Parallel>
</mx:Canvas>
ow the main application with the repeater (again just the relevant bits):
<mx:Application xmlns:mx="http://www.adobe. com/2006/ mxml"
pageTitle="SNS Bank"
layout="absolute"
horizontalAlign= "center" verticalAlign= "middle"
width="800" height="600"
creationComplete= "initApp( )" xmlns:local= "*">
<mx:Script>
<![CDATA[
[Bindable]
private var assistants:ArrayCol lection = new ArrayCollection( );
</mx:Script>
<mx:Tile height="245" top="29" borderStyle= "none"
dropShadowEnabled= "false"
width="350" horizontalCenter= "0" backgroundColor= "#FAA54C"
backgroundAlpha= "0.05">
<mx:Repeater id="rp1" dataProvider= "{assistants} "
recycleChildren= "true" removed="{disappear }">
<local:AssistantRep resentationPanel id="assistantPanel"
assistant="{ rp1.currentItem} "/>
</mx:Repeater>
</mx:Tile>
</mx:Canvas>
When the removedEffect is defined on the custom component repeated
within the Repeater and an element is removed from the ArrayCollection
the Repeater is bound to, the error with stack trace occurs:
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at
mx.effects:: EffectManager$ /http://www.adobe. com/2006/ flex/mx/internal ::eventHandler()[C:\dev\GMC\ sdk\frameworks\ mx\effects\ EffectManager. as:547]
at flash.display: :DisplayObjectCo ntainer/removeCh ild()
at
mx.core::UIComponen t/http://www.adobe. com/2006/ flex/mx/internal ::$removeChild()[C:\dev\GMC\ sdk\frameworks\ mx\core\UICompon ent.as:4616]
at
mx.core::Container/ removeChild( )[C:\dev\ GMC\sdk\framewor ks\mx\core\ Container. as:2324]
at
mx.core::Repeater/ mx.core:Repeater ::recycle( )[C:\dev\ GMC\sdk\framewor ks\mx\core\ Repeater. as:1049]
at
mx.core::Repeater/ mx.core:Repeater ::execute( )[C:\dev\ GMC\sdk\framewor ks\mx\core\ Repeater. as:1097]
at
mx.core::Repeater/ mx.core:Repeater ::collectionChan gedHandler( )[C:\dev\ GMC\sdk\framewor ks\mx\core\ Repeater. as:1118]
at
flash.events: :EventDispatcher /flash.events: EventDispatcher: :dispatchEventFu nction()
at flash.events: :EventDispatcher /dispatchEvent( )
at
mx.collections: :ListCollectionV iew/dispatchEven t()[C:\dev\ GMC\sdk\framewor ks\mx\collection s\ListCollection View.as:833]
at
mx.collections: :ListCollectionV iew/mx.collectio ns:ListCollectio nView::removeIte msFromView( )[C:\dev\ GMC\sdk\framewor ks\mx\collection s\ListCollection View.as:1367]
at
mx.collections: :ListCollectionV iew/mx.collectio ns:ListCollectio nView::listChang eHandler( )[C:\dev\ GMC\sdk\framewor ks\mx\collection s\ListCollection View.as:1022]
at
flash.events: :EventDispatcher /flash.events: EventDispatcher: :dispatchEventFu nction()
at flash.events: :EventDispatcher /dispatchEvent( )
at
mx.collections: :ArrayList/ mx.collections: ArrayList: :internalDispatc hEvent()[ C:\dev\GMC\ sdk\frameworks\ mx\collections\ ArrayList. as:518]
at
mx.collections: :ArrayList/ removeItemAt( )[C:\dev\ GMC\sdk\framewor ks\mx\collection s\ArrayList. as:371]
at
mx.collections: :ListCollectionV iew/removeItemAt ()[C:\dev\ GMC\sdk\framewor ks\mx\collection s\ListCollection View.as:596]
at
ProspectCenter/ ProspectCenter: :removeAssistant ()[C:\fds2\ jrun4\servers\ dev\sns\Prospect Center.mxml: 187]
at
ProspectCenter/ assistantStatusC hangeHandler( )[C:\fds2\ jrun4\servers\ dev\sns\Prospect Center.mxml: 144]
at
ProspectCenter/ __assistantStatu sConsumer_ message() [C:\fds2\ jrun4\servers\ dev\sns\Prospect Center.mxml: 35]
at
flash.events: :EventDispatcher /flash.events: EventDispatcher: :dispatchEventFu nction()
at flash.events: :EventDispatcher /dispatchEvent( )
at
mx.messaging: :Consumer/ mx.messaging: Consumer: :messageHandler( )[C:\dev\ enterprise_ gmc\frameworks\ mx\messaging\ Consumer. as:943]
at
flash.events: :EventDispatcher /flash.events: EventDispatcher: :dispatchEventFu nction()
at flash.events: :EventDispatcher /dispatchEvent( )
at
mx.messaging: :ChannelSet/ mx.messaging: ChannelSet: :messageHandler( )[C:\dev\ enterprise_ gmc\frameworks\ mx\messaging\ ChannelSet. as:849]
at
flash.events: :EventDispatcher /flash.events: EventDispatcher: :dispatchEventFu nction()
at flash.events: :EventDispatcher /dispatchEvent( )
at
mx.messaging. channels: :NetConnectionCh annel/receive( )[C:\dev\ enterprise_ gmc\frameworks\ mx\messaging\ channels\ NetConnectionCha nnel.as:232]
When stepping through the code in the debugger the error does not
occur. Meaning that the breakpoint is set at the point where an
element is removed from the ArrayCollection the Repeater is bound to.
Can anyone verify this behaviour?
Brgds,
Eduard
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

