[flexcoders] Setting default selectedIndex

2008-07-28 Thread calisza
I have what may seem a silly question to all you Flex Ninjas out
there, but I need to do the following and can't seem to find the right
way to do so :

I have a TileList with a custom itemRenderer, each item being a
thumbnail. The dataProvider is populated from a RemoteObject call.
Next to the TileList I have a VBox containing an Image and Label.

Now, when the user clicks on a thumbnail in the TileList, the Image
and Label change accordingly using selectedItem. No problem. 

When the app first loads, I can use the creationComplete() event of
the TileList to manually set the selectedIndex to 1 and therefore
display the first thumbnail in my main Image control.

Now the problem comes in, when the TileList's dataProvider changes
(i.e. the user performs a search and the thumbnail list gets updated)
- how do I then manually set the TileList's selectedIndex back to 1,
since it seems to get cleared automatically (for good reason).
I just have no idea which event to listen for - dataChange doesn't
seem to work and having gone through the API, I can't see any other
event which I can use.

I'm also assuming here that only the TileList in this instance has a
selectedIndex property.

Like I said, it seems like a silly problem to have, and I'm getting
pretty frustrated being held up by something this basic.

Any help would be much appreciated - even if it's a pointer to a
manual entry, anything :)

TIA,
Barry





[flexcoders] Re: Setting default selectedIndex

2008-07-28 Thread calisza
Hi Alex,

Thanks for the tip. The problem for me though - is that I'm trying to
learn how the Mate Framework functions and I have no idea how to
access the TileList's selectedIndex from the class handling the RO
event response. Or any other UI component for that matter.

Hell, I'm not even making sense to myself anymore ;)

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Normally, I'd just set it whenthe result event from the RO is
 dispatched.  If you have everything wired up via binding, you could try
 CollectionChangeEventKind.RESET
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of calisza
 Sent: Monday, July 28, 2008 12:55 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Setting default selectedIndex
 
  
 
 I have what may seem a silly question to all you Flex Ninjas out
 there, but I need to do the following and can't seem to find the right
 way to do so :
 
 I have a TileList with a custom itemRenderer, each item being a
 thumbnail. The dataProvider is populated from a RemoteObject call.
 Next to the TileList I have a VBox containing an Image and Label.
 
 Now, when the user clicks on a thumbnail in the TileList, the Image
 and Label change accordingly using selectedItem. No problem. 
 
 When the app first loads, I can use the creationComplete() event of
 the TileList to manually set the selectedIndex to 1 and therefore
 display the first thumbnail in my main Image control.
 
 Now the problem comes in, when the TileList's dataProvider changes
 (i.e. the user performs a search and the thumbnail list gets updated)
 - how do I then manually set the TileList's selectedIndex back to 1,
 since it seems to get cleared automatically (for good reason).
 I just have no idea which event to listen for - dataChange doesn't
 seem to work and having gone through the API, I can't see any other
 event which I can use.
 
 I'm also assuming here that only the TileList in this instance has a
 selectedIndex property.
 
 Like I said, it seems like a silly problem to have, and I'm getting
 pretty frustrated being held up by something this basic.
 
 Any help would be much appreciated - even if it's a pointer to a
 manual entry, anything :)
 
 TIA,
 Barry





[flexcoders] Removing ArrayCollection item from within ItemRenderer

2008-07-16 Thread calisza
After having a look around at various blogs, resources etc I'm stumped
on the following :

I have a TileList using a custom itemRenderer. The dataprovider is a
standard ArrayCollection of objects.

The itemRenderer contains an Image, a Label and a Button. When the
user clicks the button - I want to remove that particular item from
both the Tilelist and the dataProvider.

The problem is that parent.removeChild(this) only works partially
(it clears the tilelist block of the item's content, but the empty
block remains in place... still highlighted). I also have no idea how
to access the dataProvider from within the itemRenderer.
parent.dataProvider and owner.dataProvider don't seem to work, my
guess being that dataProvider is a private property.

Any ideas ? Is there perhaps a better way of doing this ? (still new
to flex so still learning).

TIA,
Barry



[flexcoders] Re: Removing ArrayCollection item from within ItemRenderer

2008-07-16 Thread calisza
Hi Tim,

Thanks so much, your tips did the trick. I'm going to go the whole
event dispatching route, but it's good to know how to access the
parentDocument elements.

And ditto on the removeChild bit - i had to laugh at myself when I
read your response - it's how we learn :)

thanks again,
B


--- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote:

 
 Hi Barry,
 
 Sorry to laugh a little, but parent.removeChild(this), is actually
 removing the itemRenderer display object; and leaving a hole in the
 TileList.  There are a few ways to remove list items; from within an
 itemRenderer.  But, most of them involve referencing the list's
 dataProvider directly; using something like:
 
 myArrayCollection.removeItemAt(myTileList.selectedIndex);
 
 Now, how do you get to the dataProvider from within the itemRenderer. 
 Probably the best way is to dispatch an event when the delete button is
 clicked.   Using events takes advantage of  loose coupling.   Listen for
 the event in the class that contains the TileList and remove the item
 from the dataProvider.  Depending on how you have it setup, chances are
 that when you click the button inside the itemRenderer, the TileList's
 selected item and index will change automatically.
 
 Another way, if you want to get dirty, is to do something like this on
 the click event of the delete button:
 

this.parentDocument.myTileList.dataProvider.removeItemAt(listData.rowInd\
 ex);
 
 -TH
 
 --- In flexcoders@yahoogroups.com, calisza barry@ wrote:
 
  After having a look around at various blogs, resources etc I'm stumped
  on the following :
 
  I have a TileList using a custom itemRenderer. The dataprovider is a
  standard ArrayCollection of objects.
 
  The itemRenderer contains an Image, a Label and a Button. When the
  user clicks the button - I want to remove that particular item from
  both the Tilelist and the dataProvider.
 
  The problem is that parent.removeChild(this) only works partially
  (it clears the tilelist block of the item's content, but the empty
  block remains in place... still highlighted). I also have no idea how
  to access the dataProvider from within the itemRenderer.
  parent.dataProvider and owner.dataProvider don't seem to work, my
  guess being that dataProvider is a private property.
 
  Any ideas ? Is there perhaps a better way of doing this ? (still new
  to flex so still learning).
 
  TIA,
  Barry
 





[flexcoders] Tilelist, ItemRenderer not refreshing when updating dataProvider

2008-07-10 Thread calisza
I have the following scenario,

I have a tilelist displaying images, each of which is being created
via a custom ItemRenderer.

So far so good. 

Now, I have an upload button, which when clicked, pops-up a
TitleWindow and allows the user to add files for upload. They click
upload and everything works perfectly, files get sent to server, file
gets saved and server sends back an XML response which I then use to
update the TileList ItemRenderers dataProvider. In other words, a new
image gets appended to the dataProvider array.

Now this all works perfectly except for the following : The new image
is not displayed inside the TileList - at least not right away. As
soon as I scroll the TileList the new image appears. So what this
means is that the new image is only displayed when the TileList or the
screen is refreshed - however, I cannot find any way of doing this
programatically.

I've tried using super.commitProperties() to no avail, unless I'm
calling it from the wrong place - currently calling it from a method
within my upload titleWindow.

I've done all the usual searching, reading etc but I've come up blank.
Is there a way around this I'm just not seeing ? Any pointers in the
right direction would be greatly appreciated.

thanks.



[flexcoders] Re: Tilelist, ItemRenderer not refreshing when updating dataProvider

2008-07-10 Thread calisza
The dataProvider is a property of a Cairngorm VO.
So, I have a productVO, of which images is a property (Array), so the
dataProvider is product.VO - the thing is, the dataProvider IS being
updated, its just the display that's not being displayed. As soon as I
select another product, and then switch back to the product in
question, or if I scroll up and then down in the TileList itself, the
newly uploaded image appears.

thanks,
Barry

--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote:

 Are you using the dataPrvoider API to update the dataProvider?  What is
 the dataProvider?
 
 Tracy
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of calisza
 Sent: Thursday, July 10, 2008 2:56 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Tilelist, ItemRenderer not refreshing when
 updating dataProvider
 
  
 
 I have the following scenario,
 
 I have a tilelist displaying images, each of which is being created
 via a custom ItemRenderer.
 
 So far so good. 
 
 Now, I have an upload button, which when clicked, pops-up a
 TitleWindow and allows the user to add files for upload. They click
 upload and everything works perfectly, files get sent to server, file
 gets saved and server sends back an XML response which I then use to
 update the TileList ItemRenderers dataProvider. In other words, a new
 image gets appended to the dataProvider array.
 
 Now this all works perfectly except for the following : The new image
 is not displayed inside the TileList - at least not right away. As
 soon as I scroll the TileList the new image appears. So what this
 means is that the new image is only displayed when the TileList or the
 screen is refreshed - however, I cannot find any way of doing this
 programatically.
 
 I've tried using super.commitProperties() to no avail, unless I'm
 calling it from the wrong place - currently calling it from a method
 within my upload titleWindow.
 
 I've done all the usual searching, reading etc but I've come up blank.
 Is there a way around this I'm just not seeing ? Any pointers in the
 right direction would be greatly appreciated.
 
 thanks.





[flexcoders] Re: Tilelist, ItemRenderer not refreshing when updating dataProvider

2008-07-10 Thread calisza
I've been wondering about that and am in the process of testing this.
Will let you know what happens :).

Just noticed a typo in my previous post - should read product.images
and not product.VO


--- In flexcoders@yahoogroups.com, jack_freud [EMAIL PROTECTED] wrote:

 Could it be that you need to use an ArrayCollection rather than an
 array? I think binding to Array only shows changes if the array itself
 is replaced, not its items.
 
 Jack
 
 --- In flexcoders@yahoogroups.com, calisza barry@ wrote:
 
  The dataProvider is a property of a Cairngorm VO.
  So, I have a productVO, of which images is a property (Array), so the
  dataProvider is product.VO - the thing is, the dataProvider IS being
  updated, its just the display that's not being displayed. As soon as I
  select another product, and then switch back to the product in
  question, or if I scroll up and then down in the TileList itself, the
  newly uploaded image appears.
  
  thanks,
  Barry
  
  --- In flexcoders@yahoogroups.com, Tracy Spratt tspratt@ wrote:
  
   Are you using the dataPrvoider API to update the dataProvider? 
 What is
   the dataProvider?
   
   Tracy
   

   
   
   
   From: flexcoders@yahoogroups.com
 [mailto:[EMAIL PROTECTED] On
   Behalf Of calisza
   Sent: Thursday, July 10, 2008 2:56 PM
   To: flexcoders@yahoogroups.com
   Subject: [flexcoders] Tilelist, ItemRenderer not refreshing when
   updating dataProvider
   

   
   I have the following scenario,
   
   I have a tilelist displaying images, each of which is being created
   via a custom ItemRenderer.
   
   So far so good. 
   
   Now, I have an upload button, which when clicked, pops-up a
   TitleWindow and allows the user to add files for upload. They click
   upload and everything works perfectly, files get sent to server,
file
   gets saved and server sends back an XML response which I then use to
   update the TileList ItemRenderers dataProvider. In other words,
a new
   image gets appended to the dataProvider array.
   
   Now this all works perfectly except for the following : The new
image
   is not displayed inside the TileList - at least not right away. As
   soon as I scroll the TileList the new image appears. So what this
   means is that the new image is only displayed when the TileList
or the
   screen is refreshed - however, I cannot find any way of doing this
   programatically.
   
   I've tried using super.commitProperties() to no avail, unless I'm
   calling it from the wrong place - currently calling it from a method
   within my upload titleWindow.
   
   I've done all the usual searching, reading etc but I've come up
blank.
   Is there a way around this I'm just not seeing ? Any pointers in the
   right direction would be greatly appreciated.
   
   thanks.
  
 





[flexcoders] Re: Tilelist, ItemRenderer not refreshing when updating dataProvider

2008-07-10 Thread calisza
Ok excellent, changing from Array to ArrayCollection has solved the
problem. Lesson learned :)

thanks for the help.

--- In flexcoders@yahoogroups.com, calisza [EMAIL PROTECTED] wrote:

 I've been wondering about that and am in the process of testing this.
 Will let you know what happens :).
 
 Just noticed a typo in my previous post - should read product.images
 and not product.VO
 
 
 --- In flexcoders@yahoogroups.com, jack_freud jack_web@ wrote:
 
  Could it be that you need to use an ArrayCollection rather than an
  array? I think binding to Array only shows changes if the array itself
  is replaced, not its items.
  
  Jack
  
  --- In flexcoders@yahoogroups.com, calisza barry@ wrote:
  
   The dataProvider is a property of a Cairngorm VO.
   So, I have a productVO, of which images is a property (Array),
so the
   dataProvider is product.VO - the thing is, the dataProvider IS being
   updated, its just the display that's not being displayed. As
soon as I
   select another product, and then switch back to the product in
   question, or if I scroll up and then down in the TileList
itself, the
   newly uploaded image appears.
   
   thanks,
   Barry
   
   --- In flexcoders@yahoogroups.com, Tracy Spratt tspratt@ wrote:
   
Are you using the dataPrvoider API to update the dataProvider? 
  What is
the dataProvider?

Tracy

 



From: flexcoders@yahoogroups.com
  [mailto:[EMAIL PROTECTED] On
Behalf Of calisza
Sent: Thursday, July 10, 2008 2:56 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Tilelist, ItemRenderer not refreshing when
updating dataProvider

 

I have the following scenario,

I have a tilelist displaying images, each of which is being
created
via a custom ItemRenderer.

So far so good. 

Now, I have an upload button, which when clicked, pops-up a
TitleWindow and allows the user to add files for upload. They
click
upload and everything works perfectly, files get sent to server,
 file
gets saved and server sends back an XML response which I then
use to
update the TileList ItemRenderers dataProvider. In other words,
 a new
image gets appended to the dataProvider array.

Now this all works perfectly except for the following : The new
 image
is not displayed inside the TileList - at least not right away. As
soon as I scroll the TileList the new image appears. So what this
means is that the new image is only displayed when the TileList
 or the
screen is refreshed - however, I cannot find any way of doing this
programatically.

I've tried using super.commitProperties() to no avail,
unless I'm
calling it from the wrong place - currently calling it from a
method
within my upload titleWindow.

I've done all the usual searching, reading etc but I've come up
 blank.
Is there a way around this I'm just not seeing ? Any pointers
in the
right direction would be greatly appreciated.

thanks.