> Like if i create a <mx:TextInput id="foo" /> to work with it on the
> actionscript just use foo.text = 'bla' for example.
>
The reason you can access foo in your AS here is because when you
define an mxml-tag, it basically becomes a public, bindable property
of that class. So if you want the same in AS it's sth like:
      [Bindable]
      public var foo:TextInput;

> So, looking at this code and suppose that you CAN NOT change not one
> line of this code, how do i work with "foo" in the myTimer function?
If we CAN NOT change the code, there's no way to work with 'foo' in
myTimer function (however as you pointed out yourself, you can test on
the last part of childName of the last canvas to see if it matches the
name of 'foo').
This is because you've declared foo inside the init-funtion, therefore
it doesn't 'exists' out of the scope of that function.

> The thing is i'm creating a lot of forms dynamically
Great :) So do I, and I stumbled on a likewise problem. Not being able
to reference the created objects.
Even if you think to outsmart Flex and do like JJain said
(object.id='myId'), the object won't be accessible by the use of that
ID. The reason is that Flex/Flash generates the id of a generated
object itself.
There is a clean workaround for this problem using a Dictionary with
the id's as keys and the objects as values. You can find an
explanation about this method here:
http://www.jumpingbean.co.za/blogs/mark/flex_reference_components_dynamic_runtime_creation

--Johan


Reply via email to