Adobe Dreamweaver Forums



Last 10 THreads :         Word Document (Last Post : ABCJARED - Replies : 1 - Views : 6 )           »          Re: CF8 keeps crashing (Last Post : crania - Replies : 0 - Views : 1 )           »          CF8 crashes java.lang.OutOfMer moryErronable to createnew native thread (Last Post : crania - Replies : 1 - Views : 2 )           »          audio (Last Post : Captiv8r - Replies : 3 - Views : 4 )           »          Quiz communication to SumTotal LMS (Last Post : roxlwood - Replies : 1 - Views : 6 )           »          Call out side flex (Last Post : G009 - Replies : 0 - Views : 1 )           »          How to turn IMAGE into MOVIECLIP??? (Last Post : Amy Blankenship - Replies : 4 - Views : 5 )           »          DW Flash Encoder (Last Post : wycn - Replies : 0 - Views : 1 )           »          DIV in Table not working. (Last Post : JoeyD1978 - Replies : 3 - Views : 4 )           »          Issue with Firefox & Flash Player Installation (Last Post : hhgttg - Replies : 1 - Views : 29 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #11 (permalink)  
Old 10-01-2008, 02:58 PM
curious_Lee
 
Posts: n/a
Diggs:
Default Re: Strange behavior in Flex Builder 3

I'm trying to access the TextInput field with id="txtPhoto" when the user
clicks the Button with id="btnBrowse" from inside the itemRenderer element.
Here's what the DataGridColumn looks like. I seem to be able to find the parent
element of the button from the event; but how do you then traverse down and
find the HBox and then the TextInput within that? Further down, I have the code
that I'm using to try to access the element.

<mxataGridColumn headerText="Test" width="250">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalGap="2">
<mx:TextInput id="txtPhoto" />
<mx:Script>
<![CDATA[
import mx.controls.listClasses.ListBase;
]]>
</mx:Script>
<mx:Button id="btnBrowse" label="Browse" click="
outerDocument.doBrowse( event )"/>
<mx:Button id="btnUpload" label="Upload"
click="outerDocument.doSubmit( event )"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mxataGridColumn>

Here's the code that needs to access the TextInput for this specific row whose
btnBrowse has been clicked,

// Called when the "Browse" button is clicked
public function doBrowse( event:Event ):void
{
file.browse();
var lb:mx.controls.listClasses.ListBaseContentHolder =
event.target.parent.parent;

if (lb==null) return;

// This code doesn't work -- says:
// TypeError: Error #1010: A term is undefined and has no properties.
for (var i:int = 0; i < lb.numChildren; i++){
var hb:HBox = lb.listItems[i][0] as HBox;

if (hb==null) continue;
var ti:TextInput = hb.getChildAt(1) as TextInput;
if (ti==null) continue;
ti.text = "hello world!";
break;
}
}

Reply With Quote
Sponsored Links
  #12 (permalink)  
Old 10-01-2008, 02:58 PM
curious_Lee
 
Posts: n/a
Diggs:
Default Re: Strange behavior in Flex Builder 3

I'm trying to access the TextInput field with id="txtPhoto" when the user
clicks the Button with id="btnBrowse" from inside the itemRenderer element.
Here's what the DataGridColumn looks like. I seem to be able to find the parent
element of the button from the event; but how do you then traverse down and
find the HBox and then the TextInput within that? Further down, I have the code
that I'm using to try to access the element.

<mxataGridColumn headerText="Test" width="250">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalGap="2">
<mx:TextInput id="txtPhoto" />
<mx:Script>
<![CDATA[
import mx.controls.listClasses.ListBase;
]]>
</mx:Script>
<mx:Button id="btnBrowse" label="Browse" click="
outerDocument.doBrowse( event )"/>
<mx:Button id="btnUpload" label="Upload"
click="outerDocument.doSubmit( event )"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mxataGridColumn>

Here's the code that needs to access the TextInput for this specific row whose
btnBrowse has been clicked,

// Called when the "Browse" button is clicked
public function doBrowse( event:Event ):void
{
file.browse();
var lb:mx.controls.listClasses.ListBaseContentHolder =
event.target.parent.parent;

if (lb==null) return;

// This code doesn't work -- says:
// TypeError: Error #1010: A term is undefined and has no properties.
for (var i:int = 0; i < lb.numChildren; i++){
var hb:HBox = lb.listItems[i][0] as HBox;

if (hb==null) continue;
var ti:TextInput = hb.getChildAt(1) as TextInput;
if (ti==null) continue;
ti.text = "hello world!";
break;
}
}

Reply With Quote


  #13 (permalink)  
Old 10-01-2008, 02:58 PM
curious_Lee
 
Posts: n/a
Diggs:
Default Re: Strange behavior in Flex Builder 3

I'm trying to access the TextInput field with id="txtPhoto" when the user
clicks the Button with id="btnBrowse" from inside the itemRenderer element.
Here's what the DataGridColumn looks like. I seem to be able to find the parent
element of the button from the event; but how do you then traverse down and
find the HBox and then the TextInput within that? Further down, I have the code
that I'm using to try to access the element.

<mxataGridColumn headerText="Test" width="250">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalGap="2">
<mx:TextInput id="txtPhoto" />
<mx:Script>
<![CDATA[
import mx.controls.listClasses.ListBase;
]]>
</mx:Script>
<mx:Button id="btnBrowse" label="Browse" click="
outerDocument.doBrowse( event )"/>
<mx:Button id="btnUpload" label="Upload"
click="outerDocument.doSubmit( event )"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mxataGridColumn>

Here's the code that needs to access the TextInput for this specific row whose
btnBrowse has been clicked,

// Called when the "Browse" button is clicked
public function doBrowse( event:Event ):void
{
file.browse();
var lb:mx.controls.listClasses.ListBaseContentHolder =
event.target.parent.parent;

if (lb==null) return;

// This code doesn't work -- says:
// TypeError: Error #1010: A term is undefined and has no properties.
for (var i:int = 0; i < lb.numChildren; i++){
var hb:HBox = lb.listItems[i][0] as HBox;

if (hb==null) continue;
var ti:TextInput = hb.getChildAt(1) as TextInput;
if (ti==null) continue;
ti.text = "hello world!";
break;
}
}

Reply With Quote
  #14 (permalink)  
Old 10-01-2008, 02:59 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Strange behavior in Flex Builder 3


"curious_Lee" <webforumsuser@macromedia.com> wrote in message
news:gbr2jd$qgn$1@forums.macromedia.com...
> I'm trying to access the TextInput field with id="txtPhoto" when the user
> clicks the Button with id="btnBrowse" from inside the itemRenderer
> element.
> Here's what the DataGridColumn looks like. I seem to be able to find the
> parent
> element of the button from the event; but how do you then traverse down
> and
> find the HBox and then the TextInput within that? Further down, I have the
> code
> that I'm using to try to access the element.
>
> <mxataGridColumn headerText="Test" width="250">
> <mx:itemRenderer>
> <mx:Component>
> <mx:HBox horizontalGap="2">
> <mx:TextInput id="txtPhoto" />
> <mx:Script>
> <![CDATA[
> import mx.controls.listClasses.ListBase;
> ]]>
> </mx:Script>
> <mx:Button id="btnBrowse" label="Browse" click="
> outerDocument.doBrowse( event )"/>
> <mx:Button id="btnUpload" label="Upload"
> click="outerDocument.doSubmit( event )"/>
> </mx:HBox>
> </mx:Component>
> </mx:itemRenderer>
> </mxataGridColumn>
>
> Here's the code that needs to access the TextInput for this specific row
> whose
> btnBrowse has been clicked,
>
> // Called when the "Browse" button is clicked
> public function doBrowse( event:Event ):void
> {
> file.browse();
> var lb:mx.controls.listClasses.ListBaseContentHolder =
> event.target.parent.parent;
>
> if (lb==null) return;
>
> // This code doesn't work -- says:
> // TypeError: Error #1010: A term is undefined and has no properties.
> for (var i:int = 0; i < lb.numChildren; i++){
> var hb:HBox = lb.listItems[i][0] as HBox;
>
> if (hb==null) continue;
> var ti:TextInput = hb.getChildAt(1) as TextInput;
> if (ti==null) continue;
> ti.text = "hello world!";
> break;
> }
> }


Why go UP to the contentHolder and then back DOWN to the HBox that is the
parent of the thing that was clicked?

But I reiterate that if you use an itemClick event instead of a regular
click event, you will receive a different kind of event that has properties
specific to working with data.

HTH;

Amy


Reply With Quote
  #15 (permalink)  
Old 10-01-2008, 02:59 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Strange behavior in Flex Builder 3


"curious_Lee" <webforumsuser@macromedia.com> wrote in message
news:gbr2jd$qgn$1@forums.macromedia.com...
> I'm trying to access the TextInput field with id="txtPhoto" when the user
> clicks the Button with id="btnBrowse" from inside the itemRenderer
> element.
> Here's what the DataGridColumn looks like. I seem to be able to find the
> parent
> element of the button from the event; but how do you then traverse down
> and
> find the HBox and then the TextInput within that? Further down, I have the
> code
> that I'm using to try to access the element.
>
> <mxataGridColumn headerText="Test" width="250">
> <mx:itemRenderer>
> <mx:Component>
> <mx:HBox horizontalGap="2">
> <mx:TextInput id="txtPhoto" />
> <mx:Script>
> <![CDATA[
> import mx.controls.listClasses.ListBase;
> ]]>
> </mx:Script>
> <mx:Button id="btnBrowse" label="Browse" click="
> outerDocument.doBrowse( event )"/>
> <mx:Button id="btnUpload" label="Upload"
> click="outerDocument.doSubmit( event )"/>
> </mx:HBox>
> </mx:Component>
> </mx:itemRenderer>
> </mxataGridColumn>
>
> Here's the code that needs to access the TextInput for this specific row
> whose
> btnBrowse has been clicked,
>
> // Called when the "Browse" button is clicked
> public function doBrowse( event:Event ):void
> {
> file.browse();
> var lb:mx.controls.listClasses.ListBaseContentHolder =
> event.target.parent.parent;
>
> if (lb==null) return;
>
> // This code doesn't work -- says:
> // TypeError: Error #1010: A term is undefined and has no properties.
> for (var i:int = 0; i < lb.numChildren; i++){
> var hb:HBox = lb.listItems[i][0] as HBox;
>
> if (hb==null) continue;
> var ti:TextInput = hb.getChildAt(1) as TextInput;
> if (ti==null) continue;
> ti.text = "hello world!";
> break;
> }
> }


Why go UP to the contentHolder and then back DOWN to the HBox that is the
parent of the thing that was clicked?

But I reiterate that if you use an itemClick event instead of a regular
click event, you will receive a different kind of event that has properties
specific to working with data.

HTH;

Amy


Reply With Quote


  #16 (permalink)  
Old 10-01-2008, 02:59 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Strange behavior in Flex Builder 3


"curious_Lee" <webforumsuser@macromedia.com> wrote in message
news:gbr2jd$qgn$1@forums.macromedia.com...
> I'm trying to access the TextInput field with id="txtPhoto" when the user
> clicks the Button with id="btnBrowse" from inside the itemRenderer
> element.
> Here's what the DataGridColumn looks like. I seem to be able to find the
> parent
> element of the button from the event; but how do you then traverse down
> and
> find the HBox and then the TextInput within that? Further down, I have the
> code
> that I'm using to try to access the element.
>
> <mxataGridColumn headerText="Test" width="250">
> <mx:itemRenderer>
> <mx:Component>
> <mx:HBox horizontalGap="2">
> <mx:TextInput id="txtPhoto" />
> <mx:Script>
> <![CDATA[
> import mx.controls.listClasses.ListBase;
> ]]>
> </mx:Script>
> <mx:Button id="btnBrowse" label="Browse" click="
> outerDocument.doBrowse( event )"/>
> <mx:Button id="btnUpload" label="Upload"
> click="outerDocument.doSubmit( event )"/>
> </mx:HBox>
> </mx:Component>
> </mx:itemRenderer>
> </mxataGridColumn>
>
> Here's the code that needs to access the TextInput for this specific row
> whose
> btnBrowse has been clicked,
>
> // Called when the "Browse" button is clicked
> public function doBrowse( event:Event ):void
> {
> file.browse();
> var lb:mx.controls.listClasses.ListBaseContentHolder =
> event.target.parent.parent;
>
> if (lb==null) return;
>
> // This code doesn't work -- says:
> // TypeError: Error #1010: A term is undefined and has no properties.
> for (var i:int = 0; i < lb.numChildren; i++){
> var hb:HBox = lb.listItems[i][0] as HBox;
>
> if (hb==null) continue;
> var ti:TextInput = hb.getChildAt(1) as TextInput;
> if (ti==null) continue;
> ti.text = "hello world!";
> break;
> }
> }


Why go UP to the contentHolder and then back DOWN to the HBox that is the
parent of the thing that was clicked?

But I reiterate that if you use an itemClick event instead of a regular
click event, you will receive a different kind of event that has properties
specific to working with data.

HTH;

Amy


Reply With Quote
  #17 (permalink)  
Old 10-01-2008, 02:59 PM
curious_Lee
 
Posts: n/a
Diggs:
Default Re: Strange behavior in Flex Builder 3

Thanks, Amy. Now I'm able to update the TextInput; however, I've run into an
issue where, after you've set the TextInput, if you scroll the datagrid, you'll
notice (randomly) other TextInput fields in the same column with the same
value. After some research, it appears to be that the itemRenderers are
recycled -- only the first 10 or 12 rows have itemRenderers generated for them:

[bullet]
http://www.adobe.com/devnet/flex/art...erers_pt1.html
[/bullet]
[bullet]
http://blogs.adobe.com/aharui/2007/0...nderers_1.html
[/bullet]

What a bummer. I can't write the filename the person selected to the
dataprovider (the solution to the recycling issue) unless the user clicks the
Upload button. One solution: Do a popup itemRenderer, where the only choices
the user has are [Upload] and [Cancel]. This way we don't run into the issue.

I know it's a performance reason as to why itemRenderers are recycled; but I
wish it were better documented. I almost lost my mind before I realized what
was going on! Also, I wish there was a way to turn it off -- even if it means
poor performance.

Reply With Quote
  #18 (permalink)  
Old 10-01-2008, 02:59 PM
curious_Lee
 
Posts: n/a
Diggs:
Default Re: Strange behavior in Flex Builder 3

Thanks, Amy. Now I'm able to update the TextInput; however, I've run into an
issue where, after you've set the TextInput, if you scroll the datagrid, you'll
notice (randomly) other TextInput fields in the same column with the same
value. After some research, it appears to be that the itemRenderers are
recycled -- only the first 10 or 12 rows have itemRenderers generated for them:

[bullet]
http://www.adobe.com/devnet/flex/art...erers_pt1.html
[/bullet]
[bullet]
http://blogs.adobe.com/aharui/2007/0...nderers_1.html
[/bullet]

What a bummer. I can't write the filename the person selected to the
dataprovider (the solution to the recycling issue) unless the user clicks the
Upload button. One solution: Do a popup itemRenderer, where the only choices
the user has are [Upload] and [Cancel]. This way we don't run into the issue.

I know it's a performance reason as to why itemRenderers are recycled; but I
wish it were better documented. I almost lost my mind before I realized what
was going on! Also, I wish there was a way to turn it off -- even if it means
poor performance.

Reply With Quote


  #19 (permalink)  
Old 10-01-2008, 02:59 PM
curious_Lee
 
Posts: n/a
Diggs:
Default Re: Strange behavior in Flex Builder 3

Thanks, Amy. Now I'm able to update the TextInput; however, I've run into an
issue where, after you've set the TextInput, if you scroll the datagrid, you'll
notice (randomly) other TextInput fields in the same column with the same
value. After some research, it appears to be that the itemRenderers are
recycled -- only the first 10 or 12 rows have itemRenderers generated for them:

[bullet]
http://www.adobe.com/devnet/flex/art...erers_pt1.html
[/bullet]
[bullet]
http://blogs.adobe.com/aharui/2007/0...nderers_1.html
[/bullet]

What a bummer. I can't write the filename the person selected to the
dataprovider (the solution to the recycling issue) unless the user clicks the
Upload button. One solution: Do a popup itemRenderer, where the only choices
the user has are [Upload] and [Cancel]. This way we don't run into the issue.

I know it's a performance reason as to why itemRenderers are recycled; but I
wish it were better documented. I almost lost my mind before I realized what
was going on! Also, I wish there was a way to turn it off -- even if it means
poor performance.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 09:35 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk