That's making sense for me now, a few days ago I made a *very* stupid mistake 
and saw exactly the same symptoms as you, Jason. Again, a simple bare bones 
test showed everything working exactly as expected, yet the flow of execution 
in the application itself stopped dead with no error raised. Stepping in the 
debugger last saw it disappearing somewhere(?) into the binding code ... Whilst 
totally confused at the time, luckily I did spot my obvious error whilst 
scratching my head and looking at the method in question ...
Thanks Alex, that does help me understand why.


-----Original Message-----
From: flexcoders@yahoogroups.com on behalf of Alex Harui
Sent: Fri 01/02/2008 18:11
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Set dataProvider method stops at midpoint?
 
Don't forget Jason, we're all new to AS3, no matter how much time you
spent with AS2.  In AS3, if some outer method in your call stack has a
try/catch handler (which binding does), then if something in the "new
MyClass" line throws an error, you'll see exactly what you described.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Merrill, Jason
Sent: Friday, February 01, 2008 8:21 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Set dataProvider method stops at midpoint?

 

I'm somewhat new to Flex, but NOT new to Actionscript, and this is the
oddest and one of the most frustrating things I have ever had to debug.
I'm sure it's just me not understanding how Flex, components, and
databinding works, but I'm at a loss.  The core of my question is:  What
could cause a method to stop executing completely in the middle and not
have the debugger complain of any errors?  I have verified this happens
in my application through trace statements, but have not been able to
reproduce it with simple test cases which mimics the same structure (as
far as I can tell).

 

I have an actionscript-written component that extends UIComponent.  In
the main app, I have some dummy data put into an ArrayCollection which
is in an init() function, which is fired upon the Flex app's
creationComplete event (see sample code at the bottom of this post). In
the component which extends UIComponent and overwrites some methods
(code snippet below), I have a set dataProvider function which takes in
the data from the dataProvider parameter for the component in MXML, but
it seems to hang up halfway through.  The method sets the dataProvider
data to a private variable, and then creates an instance of another
class:

 

//snippet

  [Bindable]
  private var _dataProvider:ArrayCollection;

 

  public function set dataProvider(_dp:ArrayCollection):void
  {
   _dataProvider = _dp;
   trace("this traces fine, and data received.");
   _myClass = new MyClass(this, _dp); //why would this stop the method?
   trace("This never traces!!!!!");
   addChild(_myClass);
  } 

 

The first trace works fine, the second never traces, and I don't get any
debugger or console messages (Flexbuilder 2)!  So I thought, maybe there
was some code in my "MyClass" (not the real name, but keeping it simple
here) which extends sprite which is not working right - but I've
searched through MyClass and the other class it uses, and all the data
comes through fine, it's constructor fires, and so does the constructor
of the other class it imports.  I spent most of yesterday trying to
debug this and I'm turning to the list now.  Here is the main app MXML
(the segment of the component is above):

 

 

//snippet

<mx:Application 
 xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " xmlns:c="components.*"
 layout="absolute" 
 applicationComplete="init()" >

 <mx:Script>
  <![CDATA[

   

    [Bindable]
    public var fakeData:ArrayCollection;

   

    private function init():void

    {

        fakeData = setFakeData();

    }

 

    private function setFakeData():void
    {
        fakeData.addItem({firstName:"David", lastName:"Branson"});

        fakeData.addItem({firstName:"Nelson", lastName:"Davidson"});

        fakeData.addItem({firstName:"Sally", lastName:""});        
    }

    ....etc etc.

 

then further down in the MXML is the component declaration:

 

    <c:MyComponent dataProvider="{fakeData}" ..blah blah/>

 

What could be going on here?  Thanks for any insights.

 

Jason Merrill 
Bank of America 
GT&O L&LD Solutions Design & Development 
eTools & Multimedia 

Bank of America Flash Platform Developer Community 

 

 



______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in 
England and Wales with registration No. 02622298 and registered office: 4th 
Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT 
registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and 
used only by the intended recipient. If you have received it in error, please 
contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 
1010. Please then delete the e-mail and do not disclose its contents to any 
person.
This email has been scanned for Primal Pictures by the MessageLabs Email 
Security System.
______________________________________________________________________

<<winmail.dat>>

Reply via email to