c'mon guys i'm still stuck no one has any ideas on how to loop trough
the XML?? i need it to finish my work here. can't anyone help me with
this. and also, i dont know if it chages anything but the XMl is not
default its created dinamically to and i already verified and its ok

--- In flexcoders@yahoogroups.com, "Daniel Fernandes Credidio"
<[EMAIL PROTECTED]> wrote:
>
> Thanks for the help troy.
> 
> but i'm still having some problems, The XML is still the same, and i
> made the change in the for just as you said, but it gets worse, if i
> do that it doesn't even enters the For, it goes through it.
> 
> --- In flexcoders@yahoogroups.com, "Troy Gilbert" <troy.gilbert@>
> wrote:
> >
> > I've tripped on all of those at one time or another, so I'm happy to
> oblige
> > with an answer as best I can:
> > 
> > 1. It threw me a bit at first, but it makes sense once you look at
> the types
> > returned by XML class. If an element of the XML has "complex"
> content (i.e.
> > its not just straight text, but rather has additional XML elements or
> > structure), then referring to that XML element will always return an
> > XMLList. Thus, when you say "for each (var s:XML in
> data.lastResult.Tipos)"
> > the XML class is returning an XMLList for all elements named
> "Tipos", which
> > in your sample data there is only one. If you want to iterate for
> each of a
> > certain element, you specify that element in the for each like this:
> "for
> > each (var s:XML in data.lastResult.Tipos.Tipo)". And to access them
> directly
> > with an index, you'd use "var s:XML = data.lastResult.Tipos.Tipo[0];".
> > 
> > 2. To dynamically create UI components just new them ("var
> txt:TextInput =
> > new TextInput();") and then add them to the container
> ("addChild(txt);").
> > For dynamically creating forms the Form and FormItem components are a
> > lifesaver as they'll save you from having to do any formating
work. Your
> > code will end up looking something like this:
> > 
> > var form:Form = new Form();
> > var formItem:FormItem = new FormItem();
> > formItem.label = "Some Field:";
> > var txtField:TextInput = new TextInput();
> > formItem.addChild(txtField);
> > form.addChild(formItem);
> > addChild(form);
> > 
> > 3. You can load data from a ByteArray into things like the image
> component.
> > Assuming you've already got the binary data pulled from the
> database, and
> > assuming its in a format that Flash understands directly (SWF,
PNG, JPG,
> > GIF, etc.), you can use the "loadBytes()" method of the
> > flash.display.Loaderclass. This will give you a DisplayObject that you
> > can then use elsewhere as
> > you would traditionally use a dynamically loaded image.
> > 
> > Troy.
> > 
> > 
> > 
> > On 2/22/07, Daniel Fernandes Credidio <lienwein@> wrote:
> > >
> > >   Hi,
> > >
> > > I'm quite new to Flex and I need help with Three things.
> > >
> > > I have an file thats sending me an XML based on data i got from
> the DB,
> > >
> > > I have to loop trough the XML and i saw in another thread that
we can
> > > do it by using the code:
> > > //the XML
> > > <Tipos>
> > > <Tipo>
> > > <Situa>0</Situa>
> > > <Imagem Conteudo=''/>
> > > <Qtd>Computador: 11</Qtd>
> > > </Tipo>
> > > <Tipo>
> > > <Situa>0</Situa>
> > > <Imagem Conteudo=''/>
> > > <Qtd>Monitor: 9</Qtd>
> > > </Tipo>
> > > <Tipo>
> > > <Situa>0</Situa>
> > > <Imagem Conteudo=''/>
> > > <Qtd>No break: 3</Qtd>
> > > </Tipo>
> > > <Tipo>
> > > <Situa>0</Situa>
> > > <Imagem Conteudo=''/>
> > > <Qtd>Notebook: 3</Qtd>
> > > </Tipo>
> > > </Tipos>
> > >
> > > for each (var s:XML in data.lastResult.Tipos){
> > > //some code here
> > > }
> > >
> > > the first problem is that it only loops once even tough there are 3.
> > >
> > > the second is that i need to add components(TextArea, Image, Label,
> > > etc.)on a Panel, but i must do it Using AS3 since its going to be
> > > created based on the XML(i searched livedocs AND flex help but
didn't
> > > find it).
> > >
> > > the third one is the most tricky of the three, I an getting the
image
> > > from the DB and its binary i need to send it into flex and use
it as a
> > > kind of source to the Image component
> > >
> > > PS: its not an URL its the data itself.
> > >
> > > i know it can be rather confusing but please answer me even if
its to
> > > say its impossible to do this.
> > >
> > > Gratefull for your help,
> > > Daniel Fernandes Credidio
> > >
> > >  
> > >
> >
>


Reply via email to