Re: [flexcoders] Re: Dynamically creating item IDs

2007-03-02 Thread slangeberg

Believe you need to pass the event object:

mx:TextInput preinitialize=assignID(event)/

But, that's a pretty good idea!

-Scott

On 3/2/07, bhaq1972 [EMAIL PROTECTED] wrote:


  maybe your trying to do something like this

mx:TextInput preinitialize=assignID()/

private function assignID(event:FlexEvent):void
{
//read your xml file and get id
var sID:String = assign your id from your xml file here;

//assign this textinput's id
event.currentTarget.id = sID;
}

--- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Andrew
Trice [EMAIL PROTECTED]
wrote:

 What do you mean? That statement very vague. Can you create
variables
 dynamically... yes. Can you use reflection and introspection into
 classes... yes. Can you create UI components at runtime... yes.



 Can flex compete with ajax... absolutely.



 _

 Andrew Trice

 Cynergy Systems, Inc.

 http://www.cynergysystems.com



 Blog: http://www.cynergysystems.com/blogs/page/andrewtrice

 Email: [EMAIL PROTECTED]

 Office: 866-CYNERGY



 

 From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On
 Behalf Of Clint Tredway
 Sent: Thursday, March 01, 2007 4:19 PM
 To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 Subject: Re: [flexcoders] Re: Dynamically creating item IDs



 what do you mean by 'id'

 On 3/1/07, thetexaspsycho2003 [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]  wrote:

 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.commailto:
flexcoders% flexcoders%25
40yahoogroups.com
 , thetexaspsycho2003
 thetexaspsycho2003@ wrote:
 
  Is there a way to dynamically create an item's ID? For example
pulling
  it in from a XML file?
 

 I guess from the lack of replies there is no way of doing this. If
so,
 this is very disappointing. The ability to create IDs on-the-fly
is
 very helpful in other technologies, such as AJAX.




 --
 http://indeegrumpee.spaces.live.com/
 http://indeegrumpee.spaces.live.com/


 





--

: : ) Scott


RE: [flexcoders] Re: Dynamically creating item IDs

2007-03-02 Thread Gordon Smith
Are you talking about the id=... attribute on MXML tags? All it does
it autogenerate a public var in the class. For example, if you write
 
mx:Button id=b/
 
in an MXML component then the autogenerated AS class has the instance
var
 
public var b:Button;
 
So if you plan on dynamically instantiating components instead of
statically declaring them with tags, you simply declare your own var as
above and then do
 
b = new Button();
 
The difference between this approach and AJAX is that AS3 gets its
performance gain over Javascript by having non-dynamic classes (where
all properties and methods are declared at compilation time) in addition
to to dynamic ones. Flex components are mostly non-dynamic for speed. So
you simply declare variables to be the id's of the components you're
going to create later.
 
- Gordon



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of thetexaspsycho2003
Sent: Thursday, March 01, 2007 1:12 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Dynamically creating item IDs



--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, thetexaspsycho2003
[EMAIL PROTECTED] wrote:

 Is there a way to dynamically create an item's ID? For example pulling
 it in from a XML file?


I guess from the lack of replies there is no way of doing this. If so,
this is very disappointing. The ability to create IDs on-the-fly is
very helpful in other technologies, such as AJAX.



 


Re: [flexcoders] Re: Dynamically creating item IDs

2007-03-01 Thread Clint Tredway

what do you mean by 'id'

On 3/1/07, thetexaspsycho2003 [EMAIL PROTECTED] wrote:


  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
thetexaspsycho2003
[EMAIL PROTECTED] wrote:

 Is there a way to dynamically create an item's ID? For example pulling
 it in from a XML file?


I guess from the lack of replies there is no way of doing this. If so,
this is very disappointing. The ability to create IDs on-the-fly is
very helpful in other technologies, such as AJAX.







--
http://indeegrumpee.spaces.live.com/


RE: [flexcoders] Re: Dynamically creating item IDs

2007-03-01 Thread Andrew Trice
What do you mean?  That statement very vague.  Can you create variables
dynamically... yes.  Can you use reflection and introspection into
classes... yes.  Can you create UI components at runtime... yes.  

 

Can flex compete with ajax... absolutely.

 

_

Andrew Trice

Cynergy Systems, Inc.

http://www.cynergysystems.com

 

Blog: http://www.cynergysystems.com/blogs/page/andrewtrice

Email: [EMAIL PROTECTED]

Office: 866-CYNERGY 

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Clint Tredway
Sent: Thursday, March 01, 2007 4:19 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: Dynamically creating item IDs

 

what do you mean by 'id'

On 3/1/07, thetexaspsycho2003 [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  wrote: 

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, thetexaspsycho2003
[EMAIL PROTECTED] wrote: 

 Is there a way to dynamically create an item's ID? For example pulling
 it in from a XML file?


I guess from the lack of replies there is no way of doing this. If so,
this is very disappointing. The ability to create IDs on-the-fly is 
very helpful in other technologies, such as AJAX.




-- 
http://indeegrumpee.spaces.live.com/
http://indeegrumpee.spaces.live.com/  

 



Re: [flexcoders] Re: Dynamically creating item IDs

2007-03-01 Thread Jason King
I'm not mr. actionscript but a class like this should facilitate what 
you need.


class Idgen {
   static var nextid:int = 0 ;
   static function getNext:String() {
  return id + nextid;
  nextid++;
  }
  static function reset:void() {
   nextid = 0;
   }
}

Then call Idgen.getNext() to get a series of unique ids.
thetexaspsycho2003 wrote:

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

Is there a way to dynamically create an item's ID? For example pulling
it in from a XML file?




I guess from the lack of replies there is no way of doing this. If so,
this is very disappointing. The ability to create IDs on-the-fly is
very helpful in other technologies, such as AJAX.




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links







  




Re: [flexcoders] Re: Dynamically creating item IDs

2007-03-01 Thread Troy Gilbert

You can also check out Flex's NameUtil class (mx.utils.NameUtil I believe).
It basically does what Jason suggested but tracks a separate series of id's
per class name. Thus, you get get series such as Button1, Button2, Button3,
HList1, HList2, etc.

If you're talking about globally unique ID (or universally unique ID),
there's a function somewhere in the API (search IUUID or UUID in the docs)
that'll do a best attempt at generating an ID in AS based on the random
number generator and the clock (which is the practically the best you can do
without the Flash Player being able to provide something like a NIC serial
number or CPU ID).

Troy.


On 3/1/07, Jason King [EMAIL PROTECTED] wrote:


   I'm not mr. actionscript but a class like this should facilitate what
you need.

class Idgen {
static var nextid:int = 0 ;
static function getNext:String() {
   return id + nextid;
   nextid++;
   }
   static function reset:void() {
nextid = 0;
}
}

Then call Idgen.getNext() to get a series of unique ids.
thetexaspsycho2003 wrote:

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

 Is there a way to dynamically create an item's ID? For example pulling
it in from a XML file?

 I guess from the lack of replies there is no way of doing this. If so,
this is very disappointing. The ability to create IDs on-the-fly is
very helpful in other technologies, such as AJAX.




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links