[flexcoders] Re: background image with Flex?

2011-10-05 Thread BIOSMonkey
There is no direct way to do this, at least in the 3.x SDK (we are still 
standardized on flex 3).

However for a workaround try this:
http://alekkus.com/blog/2009/02/flex-tutorial-setting-tile-image-as-background/

I use a modified version of this component for banners to create a repeating 
background with a movable right image that slides on top as the window is 
resized.


--- In flexcoders@yahoogroups.com, markflex2007 markflex2007@... wrote:

 
 Basically a website background image is made to repeat itself seamlessly 
 either horizontally or vertically or both.
 
 May I use a small image as background and let it repeat like web page?
 how to do that?
 
 Thanks
 
 Mark





[flexcoders] Using the restrict property for a textfield - \u is not working?

2011-10-05 Thread BIOSMonkey
I am trying to set a numeric code range (versus entering string characters) for 
the restrict property of a text field.  The documentation states that this can 
be achieved via the unicode escape sequence, such as \u0030-\u0039.  But I 
cannot get this to work.  

Even trying single character such as

mx:TextInput id=tt width=100% restrict=\u0030/

is failing. As I understand it, this should only allow the number 0 to be 
entered, but it does not work.  Instead, I am able to enter 0, 3, and u, so the 
\u seems to be ignored.

Am I missing something simple?



[flexcoders] Troublesome problem with debugger - local variables not showing

2010-01-21 Thread biosmonkey
I ran into an extremely strange problem today with the debugger.  

Placing a breakpoint in a certain function was NOT showing my local scope 
variables in the list.  At all.  The only thing I have showing is this and, 
if the function has any inputs, _arg1, _arg2 etc.  Some variables I can place a 
watch on and I can see, but others in the same function show that they do not 
exist.  Oddly, the code seems to trace properly as I step through it.

I have run into strange problems before with the debugger losing sync with 
code, etc that were usually fixed with a clean (and occasionally a restart of 
Flex) but nothing I do clears this.

I have found, however, that *moving* the function to some other place higher up 
in the file will allow it to work.  I have noted also that it is not tied to a 
particular function, but rather their seems to be a place beyond which in my 
file that this problem occurs.  

Of course the obvious thing would be to try and isolate where that point is, 
and examine the code, but I cannot find anything suspicious.  

Has anyone seen a problem like this??




[flexcoders] Re: Unable to use a source path with a number in it?

2009-10-05 Thread biosmonkey
Hi,
Flex won't let you put quotes in the edited path name.  It will give an 
invalid path and won't accept it.

Can anyone confirm this happens on the normal Flexbuilder installation (ie not 
as an Eclipse plugin)?



--- In flexcoders@yahoogroups.com, Muzak p.ginnebe...@... wrote:

 Just a wild guess, try putting it in quotes..
 
 ${MYPATH}\Components\ABC20Components
 
 - Original Message - 
 From: biosmonkey biosmon...@...
 To: flexcoders@yahoogroups.com
 Sent: Monday, October 05, 2009 6:04 AM
 Subject: [flexcoders] Unable to use a source path with a number in it?
 
 
 I have discovered an unusual problem with Flex and the use of workspace 
 linked resources 
 (Window/Preferences/General/Workspace/Linked Resources).
 
  If you have a source path that is partially a linked resource (ie ${MYPATH} 
  and another part is a number, then Flex cannot find 
  the path.
 
  For example, the following will work:
 
  ${MYPATH}\Components\ABCComponents
 
  but the following will not
 
  .
 
  If I look at the properties for the failed link, I get some strange stuff:
 
  Location: MYPATH/Components/ABC%25320Components
  Resolved location: full path\Components\ABC%320Components - (does not 
  exist)
 
 
  I am using Flex Eclipse with Ganymede on Vista 64bit, if that makes a 
  difference.
 
  If I take out the linked resource and just use the full path, then it works 
  fine.  It seems that Flex is trying to escape the path 
  or something, although it does not need to?





[flexcoders] Unable to use a source path with a number in it?

2009-10-04 Thread biosmonkey
I have discovered an unusual problem with Flex and the use of workspace linked 
resources (Window/Preferences/General/Workspace/Linked Resources).

If you have a source path that is partially a linked resource (ie ${MYPATH} and 
another part is a number, then Flex cannot find the path.

For example, the following will work:

${MYPATH}\Components\ABCComponents

but the following will not

${MYPATH}\Components\ABC20Components.

If I look at the properties for the failed link, I get some strange stuff:

Location: MYPATH/Components/ABC%25320Components
Resolved location: full path\Components\ABC%320Components - (does not exist)


I am using Flex Eclipse with Ganymede on Vista 64bit, if that makes a 
difference.

If I take out the linked resource and just use the full path, then it works 
fine.  It seems that Flex is trying to escape the path or something, although 
it does not need to?







[flexcoders] Found the problem! Re: Don't understand how to use deferred instantiation

2009-09-15 Thread biosmonkey
OK, I believe I have found the cause of the problem.

The problem happens when I add a viewstack that is part of a container being 
added to a state with mx:AddChild

If I set up a sample app with a tab navigator and three canvases, each tracing 
preinit, init, and creationComplete then I get this:

Canvas 1 preinit
Canvas 2 preinit
Canvas 3 preinit
Canvas 1 init
Canvas 1 creationComplete

This is as expected.

If however, I use states (create a new state, add the tabnavigator to the state 
with AddChild, then activate the state) I get this:

Canvas 1 preinit
Canvas 1 init
Canvas 2 preinit
Canvas 2 init
Canvas 3 preinit
Canvas 3 init
Canvas 1 creationComplete
Canvas 2 creationComplete
Canvas 3 creationComplete

This is the problem!  The application is driven by states (init, login, and 
runtime) and each state draws the gui by adding a vbox container with the gui 
inside it.  

ALL of my viewstack containers are getting initialized because of 
creationComplete firing!

How do I make navigator deferred instantiation work with states?





[flexcoders] Don't understand how to use deferred instantiation

2009-09-14 Thread biosmonkey
I am having trouble understanding how to use deferred instantiation.

I have a project with a viewstack, and the viewstack has a lot of canvas 
containers for different pages that are activated according to user selection 
on a menubar.  Each page inside the canvas is actually one or two components.

The problem is that each of these components has some custom code attached to 
the creationComplete event that loads external string files. What I am seeing 
is that all containers and the components are initializing when the application 
loads, and all string files are being loaded, regardless of the current 
viewstack view.  This is creating a serious performance problem.

To test the child controls, I added some alerts inside the page components as 
well (such as a label) that are attached to creationComplete and addedToStage.  
Both events are firing when the app loads, for all viewstack containers.

I don't understand this.  What exactly is being deferred?

Do all components/child components/controls go through the initialization 
process and fire creationComplete, regardless of whether they are visible?

Can someone please enlighten me on how to use this correctly?








[flexcoders] Re: Don't understand how to use deferred instantiation

2009-09-14 Thread biosmonkey
I am aware of the creationPolicy property, and it is not set anywhere in the 
application.

As a test, I also created a small test project with a tab navigator with 
canvases, and with a label inside them.  When tracing the preinit, init, and 
creationcomplete events, only the initial tab fires creationComplete as I would 
expect.

Doing the same in my application results in all components firing their 
creationComplete, which loads many, many files.

I cannot figure this out.  Something is making all components instantiate, and 
it is not the policy setting.

Does anyone know of any other reason that would force a nav container to 
instantiate all children?  Bindings?  State change? anything???





--- In flexcoders@yahoogroups.com, Jeffry Houser j...@... wrote:

 
  That's not true.  It only loads everything when the app loads if 
 creationPolicy is set to all . ( 
 http://livedocs.adobe.com/flex/3/langref/mx/core/Container.html#creationPolicy
  
 ).
 
  I suggest that the original poster check the creationPolicy for his 
 viewStack.  If none is set, move up the component chain to the main 
 application file.  Most likely someone somewhere set it to All ( 
 |ContainerCreationPolicy.ALL ).  |
 
 Jake Churchill wrote:
   
 
  Yes, a viewstack loads everything when the app loads.  If you don't 
  want that, I think you need to use states instead
 
   
 
  Jake Churchill
  CF Webtools
  11204 Davenport, Ste. 100
  Omaha, NE  68154
  http://www.cfwebtools.com http://www.cfwebtools.com
  402-408-3733 x103
 
  *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] 
  *On Behalf Of *biosmonkey
  *Sent:* Monday, September 14, 2009 1:49 PM
  *To:* flexcoders@yahoogroups.com
  *Subject:* [flexcoders] Don't understand how to use deferred instantiation
 
   
 
   
 
  I am having trouble understanding how to use deferred instantiation.
 
  I have a project with a viewstack, and the viewstack has a lot of 
  canvas containers for different pages that are activated according 
  to user selection on a menubar. Each page inside the canvas is 
  actually one or two components.
 
  The problem is that each of these components has some custom code 
  attached to the creationComplete event that loads external string 
  files. What I am seeing is that all containers and the components are 
  initializing when the application loads, and all string files are 
  being loaded, regardless of the current viewstack view. This is 
  creating a serious performance problem.
 
  To test the child controls, I added some alerts inside the page 
  components as well (such as a label) that are attached to 
  creationComplete and addedToStage. Both events are firing when the app 
  loads, for all viewstack containers.
 
  I don't understand this. What exactly is being deferred?
 
  Do all components/child components/controls go through the 
  initialization process and fire creationComplete, regardless of 
  whether they are visible?
 
  Can someone please enlighten me on how to use this correctly?
 
  No virus found in this incoming message.
  Checked by AVG - www.avg.com
  Version: 8.5.409 / Virus Database: 270.13.96/2369 - Release Date: 
  09/14/09 05:51:00
 
  
 
 -- 
 Jeffry Houser, Technical Entrepreneur
 Adobe Community Expert: http://tinyurl.com/684b5h
 http://www.twitter.com/reboog711  | Phone: 203-379-0773
 --
 Easy to use Interface Components for Flex Developers
 http://www.flextras.com?c=104
 --
 http://www.theflexshow.com
 http://www.jeffryhouser.com
 --
 Part of the DotComIt Brain Trust





[flexcoders] MXML Component and binding with a setter

2009-05-05 Thread biosmonkey
I have a custom MXML component that has a setter function, dataInput, that 
takes an arraycollection and essentially performs a similar function as a 
dataProvider.

The problem is that I can't get my setter to fire when the dataInput is bound 
to an external arraycollection.  So, if I have

xx:mycomp dataInput={mydata} /

and I have a button that simply does an mydata.addItem(), my setter function 
dataInput will not fire.  It does appear to detect ANY change to mydata.

However, if I create a datagrid, and do the same binding to the dataProvider:

mx:DataGrid dataProvider={mydata} .../

then the datagrid DOES update.


Why is my setter function not firing?  Is there something else I need to do in 
my component?




[flexcoders] Re: MXML Component and binding with a setter

2009-05-05 Thread biosmonkey
I don't know if I can post source, but let me see...
Here is source for a sample app:


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=vertical xmlns:ns1=* horizontalAlign=left
mx:Script
 ![CDATA[
 import mx.collections.ArrayCollection;
 [Bindable] public var myAC:ArrayCollection=new
ArrayCollection();
 [Bindable] public var myInt:int=0;
 ]]
/mx:Script
 mx:DataGrid dataProvider={myAC}
 mx:columns
 mx:DataGridColumn headerText=Data dataField=data/
 /mx:columns
 /mx:DataGrid
 ns1:MyComp dataInput={myAC} dataIntInput={myInt} /
 mx:Button label=Add Item click={myAC.addItem({data:123})}/
 mx:Button label=Increment Int click={myInt++}/
/mx:Application

and here is source for the component MyComp.mxml:

?xml version=1.0 encoding=utf-8?
mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml;
 mx:Script
 ![CDATA[
 import mx.collections.ArrayCollection;
 import mx.controls.Alert;
 public function set dataInput(data:ArrayCollection):void
 {
 Alert.show(Setting dataInput=+data);
 }
 public function set dataIntInput(data:int):void
 {
 Alert.show(Setting int=+data);
 }
 ]]
 /mx:Script
/mx:HBox


All I am doing here is showing a datagrid that is bound to an
arraycollection, along with a custom component with a setter function
that is also bound to the same a.c.

If you click the button to add an item, it shows in the datagrid, which
means it is detecting the change to the arraycollection as I would
expect.  However, the setter in the custom comp does not fire.

As a test, I also added a simple int, which IS being detected by a
different setter.







--- In flexcoders@yahoogroups.com, Tim Hoff timh...@... wrote:


 Probably going to have to show us your getter/setter code; as well as
 the corresponding private var.  If it's an ArrayCollection, it should
 work.

 -TH






[flexcoders] Re: MXML Component and binding with a setter

2009-05-05 Thread biosmonkey
Beautiful - this was the key.

The solution is to assign the given arraycollection to a private var, then add 
an event listener for CollectionChangeEvent.  Changes to the bound collection 
are detected properly now.

Thank you Alex and Tim for your help.


private var _myAc:ArrayCollection=new ArrayCollection();
public function set dataInput(data:ArrayCollection):void
{
_myAc=data;
_myAc.addEventListener(CollectionEvent.COLLECTION_CHANGE,datachange);
}
internal function datachange(event:CollectionEvent):void
{
Alert.show('Change detected!');
}






--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 I didn't run it, but I would not expect the dataProvider setter to fire when 
 you call addItem.  I would expect the DataGrid to update as it is listening 
 for CollectionChangeEvent from the ArrayCollection.  You might need to do the 
 same in your component
 
 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.http://www.adobe.com/
 Blog: http://blogs.adobe.com/aharui
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
 Behalf Of biosmonkey
 Sent: Tuesday, May 05, 2009 2:03 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: MXML Component and binding with a setter
 
 
 
 
 
 I don't know if I can post source, but let me see...
 Here is source for a sample app:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical xmlns:ns1=* horizontalAlign=left
 mx:Script
 ![CDATA[
 import mx.collections.ArrayCollection;
 [Bindable] public var myAC:ArrayCollection=new
 ArrayCollection();
 [Bindable] public var myInt:int=0;
 ]]
 /mx:Script
 mx:DataGrid dataProvider={myAC}
 mx:columns
 mx:DataGridColumn headerText=Data dataField=data/
 /mx:columns
 /mx:DataGrid
 ns1:MyComp dataInput={myAC} dataIntInput={myInt} /
 mx:Button label=Add Item click={myAC.addItem({data:123})}/
 mx:Button label=Increment Int click={myInt++}/
 /mx:Application
 
 and here is source for the component MyComp.mxml:
 
 ?xml version=1.0 encoding=utf-8?
 mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml;
 mx:Script
 ![CDATA[
 import mx.collections.ArrayCollection;
 import mx.controls.Alert;
 public function set dataInput(data:ArrayCollection):void
 {
 Alert.show(Setting dataInput=+data);
 }
 public function set dataIntInput(data:int):void
 {
 Alert.show(Setting int=+data);
 }
 ]]
 /mx:Script
 /mx:HBox
 
 All I am doing here is showing a datagrid that is bound to an
 arraycollection, along with a custom component with a setter function
 that is also bound to the same a.c.
 
 If you click the button to add an item, it shows in the datagrid, which
 means it is detecting the change to the arraycollection as I would
 expect. However, the setter in the custom comp does not fire.
 
 As a test, I also added a simple int, which IS being detected by a
 different setter.
 
 --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Tim 
 Hoff TimHoff@ wrote:
 
 
  Probably going to have to show us your getter/setter code; as well as
  the corresponding private var. If it's an ArrayCollection, it should
  work.
 
  -TH
 
 





[flexcoders] Using an itemRenderer in a grid and rendering glitches

2009-02-17 Thread biosmonkey
I have an adg that displays a tree of items, along with a custom item
renderer that shows an icon representing status.

For the most part this works well, however, in some rare circumstances
when scrolling I have seen the item renderer glitch ... sometimes it
appears to be double rendered, sometimes it is rendered in the wrong
place.  I have also seen the text labels in the tree superimpose on
top of themselves sometimes.

This problem is actually not unique to this situation, because I have
seen it in other grids with IRs.  This problem, however, just happens
to be in a MAJOR project of mine :).

Has anyone else seen similar problems?  I don't know how it would be
my code ... it seems more like a flash player bug.  I am using flash
10.  Note also that my IR is not doing any graphical drawing; it is
essentially an hbox with an img that just gets its source changed.





[flexcoders] Re: Using dispatchEvent ?

2009-01-13 Thread biosmonkey
Yes.  As I said in the other post, my confusion was not understanding
the relationship between the bubbling mechanism and the UI display list.

I changed it back to extending EventDispatcher and dispatching off the
main app object.  All is well. 


--- In flexcoders@yahoogroups.com, Manish Jethani
manish.jeth...@... wrote:

 On Mon, Jan 12, 2009 at 8:59 PM, biosmonkey biosmon...@... wrote:
 
  The dispatched event needs to be heard by any component, anywhere, by
  setting an event listener for it at the application level.  So
  bubbling up to the app is critical.
 
 Since your component has nothing to do with UI, strictly speaking,
 making it a UI component (extending DisplayObject) seems like the
 wrong thing to do. Event bubbling is typically for UI events; your
 event is not a UI event, it's just that you need it to be broadcast
 application-wide.
 
 So I would consider making the event dispatcher object available
 application-wide, by making it a singleton, for instance, or by making
 it a property of the main application. It seems you're already doing
 something to that effect -- dispatching off the main application
 object.
 
 Manish





[flexcoders] Re: Using dispatchEvent ?

2009-01-12 Thread biosmonkey
Actually, I did think about that and tried changing from
EventDispatcher to extending UIComponent but it still does not work. I
even tried Canvas and it still does not catch it.

As an experiment, though, I tried dispatching the same event from one
of my components elsewhere in the application just to make sure the
custom event itself was OK, and that worked.

Does it make a difference that I am dispatching this event from inside
an HTTPService callback? Basically, the way this class works is that I
instantiate it with a timer value, and every x seconds it makes a call
to the server to get some data, and based on the result of that data I
dispatch an event with the payload.




--- In flexcoders@yahoogroups.com, Josh McDonald dzn...@... wrote:

 Event bubbling only occurs within the display list. So your dispatching
 object must also be a child UIComponent if you want to catch bubbled
events.
 
 -Josh
 
 On Mon, Jan 12, 2009 at 4:12 PM, biosmonkey biosmon...@... wrote:
 
  I thought I had understood the event model, but apparently not.
 
  I have a custom class that extends EventDispatcher, let's call it
  MyClass.  This class will periodically dispatch a custom event based
  on a timer and some condition.
 
  In my main app, I instantiate an instance of this class.  I also
  create an event listener at the application level.
 
  Here's the problem:
 
  * If I use dispatchEvent(...) inside MyClass, the event listener in
  the main app never fires (the custom event *is* set to bubble)
 
  * The only way it will work is if I use the application object, ie
  mx.core.Application.application.dispatchEvent(...)
 
  But I don't understand why I have to do this? I have used a similar
  model just fine when dispatching events from inside components (ie I
  use dispatchEvent and my custom event is heard at the app level via
  bubbling).
 
  Can someone help me understand this?
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location:
 
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives:
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
  Links
 
 
 
 
 
 
 -- 
 Therefore, send not to know For whom the bell tolls. It tolls for
thee.
 
 Like the cut of my jib? Check out my Flex blog!
 
 :: Josh 'G-Funk' McDonald
 :: 0437 221 380 :: j...@...
 :: http://flex.joshmcdonald.info/
 :: http://twitter.com/sophistifunk





[flexcoders] Re: Using dispatchEvent ?

2009-01-12 Thread biosmonkey

The dispatched event needs to be heard by any component, anywhere, by
setting an event listener for it at the application level.  So
bubbling up to the app is critical. 


--- In flexcoders@yahoogroups.com, Manish Jethani
manish.jeth...@... wrote:

 On Mon, Jan 12, 2009 at 11:42 AM, biosmonkey biosmon...@... wrote:
 
  In my main app, I instantiate an instance of this class.  I also
  create an event listener at the application level.
 
  Here's the problem:
 
  * If I use dispatchEvent(...) inside MyClass, the event listener in
  the main app never fires (the custom event *is* set to bubble)
 
 To add to Josh's response, I would say the best way to do this is to
 listen on the object itself.
 
 obj = new MyClass();
 obj.addEventListener(...);
 
 The events don't have to be bubbling then.
 
 Manish





[flexcoders] Re: Using dispatchEvent ?

2009-01-12 Thread biosmonkey
I see.

I think the part I was missing was the fact that the class object
needed to be a child of the application to be in its display list,
instead of instantiated to a variable.

I could convert my class to a component I suppose, and place it in my
MXML but frankly I don't mind dispatching from mx..application.

I just needed to understand why I had to do it that way.

Thanks


--- In flexcoders@yahoogroups.com, Sam Lai samuel@... wrote:

 The event listener attached to the Application is not reacting to the
 event fired from your custom class because your custom class instance
 is not attached to the Application DisplayList. It is just an object
 in memory. If you want the event from your custom class instance to
 bubble up to the Application, you need to add it to the Application's
 DisplayList.
 
 The DisplayList is typically used for UI components, i.e. when you
 click a button in the UI, it fires an event and that event propagates
 up the display list.
 
 However, you can add non-UI components to it too. Your custom class
 just needs to extend the DisplayObject class (I think - it should have
 extended EventDispatcher already). You also need to add the instance
 to the Application object by using the addChild method on the
 Application object, e.g. application.addChild(myclass);
 
 If you declare the custom class instance in MXML, it is automatically
 added to the Application object (well, technically, only if it is a
 loaded component in the UI).
 
 
 
 2009/1/12 biosmonkey biosmon...@...:
 
  The dispatched event needs to be heard by any component, anywhere, by
  setting an event listener for it at the application level.  So
  bubbling up to the app is critical.
 
 
  --- In flexcoders@yahoogroups.com, Manish Jethani
  manish.jethani@ wrote:
 
  On Mon, Jan 12, 2009 at 11:42 AM, biosmonkey biosmonkey@ wrote:
 
   In my main app, I instantiate an instance of this class.  I also
   create an event listener at the application level.
  
   Here's the problem:
  
   * If I use dispatchEvent(...) inside MyClass, the event listener in
   the main app never fires (the custom event *is* set to bubble)
 
  To add to Josh's response, I would say the best way to do this is to
  listen on the object itself.
 
  obj = new MyClass();
  obj.addEventListener(...);
 
  The events don't have to be bubbling then.
 
  Manish
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location:
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
Links
 
 
 
 





[flexcoders] Using dispatchEvent ?

2009-01-11 Thread biosmonkey
I thought I had understood the event model, but apparently not.

I have a custom class that extends EventDispatcher, let's call it
MyClass.  This class will periodically dispatch a custom event based
on a timer and some condition.

In my main app, I instantiate an instance of this class.  I also
create an event listener at the application level.

Here's the problem:

* If I use dispatchEvent(...) inside MyClass, the event listener in
the main app never fires (the custom event *is* set to bubble)

* The only way it will work is if I use the application object, ie
mx.core.Application.application.dispatchEvent(...)

But I don't understand why I have to do this? I have used a similar
model just fine when dispatching events from inside components (ie I
use dispatchEvent and my custom event is heard at the app level via
bubbling).  

Can someone help me understand this?



[flexcoders] Deselecting tree nodes based on some condition

2008-12-23 Thread biosmonkey
I am using the tree view in an advanced data grid.

The nodes in the tree can be any kind of parent/child relationship,
and each node is one of a few different types.

So for example, let's say you have a tree consisting of nodes that are
one of 5 different types A,B,C,D,and E.

If the user first clicks on a node of type B, then I need to limit all
future selections to type B by deselecting or preventing the user from
clicking them. This needs to work whether the user ctrl-clicks
individual nodes, or shift-clicks a whole bunch of nodes. 

So, in essence I don't care about any parent/child relationships...if
the user shift-clicks across a large number of parents and children I
still treat them as individual nodes.

So, I just need to a) see what the first type is that they clicked and
b) scan any other selected items and deselect them if they are not the
same type.


I tried messing around with the selectedItems array, but I could not
seem to alter it.  I am also not sure how much code *I* need to do to
make this work, ie can I remove an entry from the selectedItems array
and Flex deselects it for me, or do I have to do everything?





[flexcoders] Re: Deselecting tree nodes based on some condition

2008-12-23 Thread biosmonkey
Thanks to those who have replied.

I am indeed executing this code inside the itemclick handler, but I
just didn't know how to manipulate the list.

When it was mentioned that the grid is not going to be aware of any
array functions performed directly on the selectedItems array, I
altered the code to do a shallow copy with concat and performed the
splicing of the items on the clone.  I then copied it back to the
selectedItems array.

It is working well, EXCEPT for one problem...

Consider the following:  you have a grid with many items.  You click
one item, then shift-click a few items down.  All of the items are
selected.  You then hold shift and click a second time further down -
the selected list is expanded to the new clicked item.

This mechanism is broken when my code executes.  You can click, and 
shift-click once to select multiple items, but if you try to
shift-click again it will not work.

I traced into the handler, and noted the following:
* if my code is not active, and the user shift-clicks a second time,
then the selectedItems array contains all items
* if my code IS active, the the number of selected items stays the
same as the initial shift-click.  Also, the selectedItem property is
no longer null.

What this suggests is that there is some other mechanism at work to
track shift-clicked items, and this is getting messed up when I
reassign the selectedItems array.

It works great except for this one thing - does anyone have any insight?





[flexcoders] Creating UTF8 strings from hex bytes encoded as text

2008-12-22 Thread biosmonkey
I have a need to take a string that is encoded as hex bytes and decode
it into a utf8 string.

For example:
30 30 30 
would be 000

This works fine since chars 0x7f are standard ascii in utf8. The
problem is taking this concept and trying to decode a utf8 string with
bytes 0x7f.

For example, the sequence:
e8 8b b1 e8 aa 9e
should display two Japanese characters.

I do not know how to create a string with these values that will
display properly as utf8.  One problem is that I do not know how Flex
internally stores utf8 strings.  If I cut-and-paste the actual utf8
string from a file into Flex, the JA characters show up fine in the
editor, debugger and the application. 

[I am not sure if this will show up for you but let's try]
public var test:String=#33521;#35486;;

So clearly Flex can understand a sequence of bytes in a String object
as utf8.  But how to create it? If I try to create a string using the
bytes, it fails. For example

public var test2:String=\xe8\x8b\xb1\xe8\xaa\x9e;

does not display properly.  If I view these to vars in the debugger.
the test var is correct, whereas the test2 is junk.

I have not experimented with the ByteArray class, as I know there are
some utf8 specific functions, but why won't this work?  The MX file is
encoded as utf8, and as I said Flex understands utf8 strings just fine
so why can't I take each byte value and concatenate to get a utf8 string?






[flexcoders] Re: Creating UTF8 strings from hex bytes encoded as text

2008-12-22 Thread biosmonkey

I'll reply to you and my own post, as the solution was indeed the
ByteArray class.

It was quite simple actually


1) create a bytearray 
2) writebyte each value into the bytearray
3) output by using by the toString function

Data was correctly decoded from the bytearray as a utf8 string, and it
worked the first time.  Wish I had known this 8 hours ago

I still am not clear on why I had so much trouble with trying to use
strings (why can't I just concatenate the codes?), but this works so
I'm not really going to investigate it any further!

Thanks




[flexcoders] Re: ComboBox as itemRenderer/editor in Datagrid is not updating dataProvider...

2008-11-25 Thread biosmonkey

My understanding of this function is that it is to cause an update in
the rendering of the control attached to the data, which implies that
the dataProvider has the correct data - the control is just not
showing it.

I have the reverse problem.  In my case, the renderers (the combo
boxes) are changing just fine, but the selection index in the combo is
NOT being written back to the grid's dataProvider.

Another solution would be to directly manipulate the grid's
dataProvider myself.  In this case, I can hook the change event for
the itemrenderer and manually update the value.  But I don't know off
hand how to access the parent dataProvider cell from within an
itemRenderer?  




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

 Depending on your data, you may need to call itemUpdated so
renderers find out there's been a change to their data.




[flexcoders] ComboBox as itemRenderer/editor in Datagrid is not updating dataProvider...

2008-11-24 Thread biosmonkey
I'm seeing a problem with a combobox in a datagrid that I simply have
not been able to solve.

The setup:

Consider a datagrid where one of the columns has a combobox
itemrenderer/editor in each row with choices A,B,C,or D.  Outside of
the datagrid is a Save button, along with another combobox exactly
like the others, but choosing an option here forces all other
comboboxes inside the datagrid to change to it.  So selecting B in the
outside combo makes all combos in the datagrid go to B.

As far as the code structure goes, the itemrenderer is drop-in, and
the root component is an hbox, with the combobox inside it.  This is
to that I could align it to the right of the cell.

The structure is like this:

DataGridColumn
  itemrenderer
hbox
  combobox

To get the grid combos to change, I bound their selectedIndex to the
selectedIndex of the outerDocument.combo

Everything works fine if choosing an option within the grid.  But 
when using the outside combobox to change the others, the grid combo
boxes are NOT updating their dataprovider.  But, oddly, I have
observed that if I change the outer combo setting, then click anywhere
in the grid FIRST, and then click my Save button, it works.

I thought that perhaps I needed to dispatch a CHANGE or CLICK event,
so I altered the combo bindings to create a bindsetter instead that
does the same thing plus dispatch an event.  I have tried dispatching
a variety of events and nothing works.

How do I get the grid combos to update the datagrid dataprovider when
using the outside combo???






[flexcoders] Binding textinput width to datagrid column width?

2008-10-29 Thread biosmonkey
I must be doing something dumb, but I can't understand why this isn't
working.

I have a datagrid with say, 2 columns. Under the datagrid, I have two
text input controls next to each other in an hbox.

I want the text input controls to match the width of the datagrid
columns directly above them. This means when the datagrid is drawn and
the column widths determined, the textinput controls should resize
themselves to match. This also should occur if the user resizes the
columns manually.

So, I assigned IDs to the datagridcolumn objects, and tried to bind
the width of the text input controls to them.

So first I tried
mx:TextInput width={colName.width}

and this didn't work.

So then I tried a bindproperty:

BindingUtils.bindProperty(txtiName,width,colName ,width);

and this didn't work either.

So then I used a bindsetter just for the purpose of setting a
breakpoint in the function to see if it was firing. It fires only on
init, and not when the columns are resized.

What am I doing wrong?