Search the web
Sign In
New User? Sign Up
ydn-flash · Yahoo! Flash Developer Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Re: Tree dataprovider   Message List  
Reply | Forward Message #1096 of 2036 |
Re: Tree dataprovider

Ah, I see. It seems that a more fundamental issue here is that the
Tree automatically absorbs the entire XML structure -- so the <rtmp>,
<introframe> and <title> nodes become child tree nodes of the <video>
node, rather than its properties.

Without modifications to the Tree component, one way to do this would
be to pre-parse your XML data and store properties of each video in a
separate data structure. An array would probably be the fastest. So
for example, if you have something like this:

<videos>
<video label="Foo">
<Foo's properties...>
</video>
<video label="Bar">
<Bar's properties...>
</video>
</videos>

You would parse this, and create two data structures:

An XML:

<videos>
<video label="Foo" id="0" />
<video label="Bar" id="1" />
</videos>

And an Array:

[{XML object of Foo's properties}, {XML object of Bar's properties}].

If you use the generated XML to populate the Tree, the id attribute
will become available for each item in the tree you click on -- you
can then use that id to look up the specific data, however complex, in
the Array.

Does this solution make sense?

Thanks,
Allen





--- In ydn-flash@yahoogroups.com, "Randy Troppmann"
<randy.troppmann@...> wrote:
>
> Hey Allen,
> Thanks for the response. I think that is a very convenient way to
populate
> the tree and it works nicely. What I am trying to do is associate
data with
> a "label" level of the tree. For example:
>
> <videos>
>
> <video label="Shell Video" >
> <rtmp url="rtmp://flashmedia.foo.ca:1935/foo_ca_streams"/>
> <introFrame url="titles/shell_small.jpg"/>
> <title value="Streaming video example 320x240"/>
> <autoPlay value="false"/>
> </video>
> <video label="Amy Video" >
> <rtmp url="rtmp://flashmedia.foo.ca:1935/foot_ca_streams"/>
> <introFrame url="titles/tenacity.jpg"/>
> <title value="Streaming video with xml-based chapters"/>
> <autoPlay value="false"/>
> <chapters>
> <chapter time="20" title="This video is squished on purpose; should
> be 622 x 350"/>
> <chapter time="60" title="Sample chapter 2"/>
> </chapters>
> </video>
> </videos>
>
> In this case the <video> child is the clickable part of the tree and I
> would like a way to bind the children of <video> to the click event so
> I can pass in the associated parameters. As you can see the structure
> is more complicated than putting a value in an attribute of the
> <video> node. I would like to parse out the attributes and reference
> them in the click event somehow. I hope that makes sense. Any ideas
> are welcome.
>
> Cheers,
>
> Randy Troppmann
>
>
>
>
>
> On Wed, Jun 25, 2008 at 4:13 PM, Allen Rabinovich <allenrabinovich@...>
> wrote:
>
> > Hi Randy,
> >
> > Sorry for the delayed response. Can you elaborate what you mean by
> > that? The way the Tree works right now is that it populates each item
> > with the properties specified in the source XML, and those properties
> > become available as variables in the item object (exactly how the List
> > does it). Does that make sense? For example, let's say this is the
> > source XML for the Tree:
> >
> > <root>
> > <node label="Foo" someproperty="blah" />
> > <node label="Bar" someother="Bazz" />
> > </root>
> >
> > This Tree will contain two items, Foo and Bar. When you click on the
> > item Foo, the Tree will dispatch an itemClick event, which will
> > contain an item property. That item is an Object that has
> > someproperty="blah".
> >
> > Let me know if that answers your question.
> >
> > - Allen
> >
> > --- In ydn-flash@yahoogroups.com <ydn-flash%40yahoogroups.com>, "Randy
> > Troppmann"
> >
> > <randy.troppmann@> wrote:
> > >
> > > Is there a way to bind an object to a data provider so that a click
> > on an
> > > item can have access to parameters of that item?
> > > - Randy
> > >
> >
> >
> >
>





Wed Jul 2, 2008 8:58 pm

allenrabinovich
Online Now Online Now
Send Email Send Email

Forward
Message #1096 of 2036 |
Expand Messages Author Sort by Date

Is there a way to bind an object to a data provider so that a click on an item can have access to parameters of that item? - Randy...
Randy Troppmann
randy.troppmann
Offline Send Email
Jun 12, 2008
9:12 pm

Hi Randy, Sorry for the delayed response. Can you elaborate what you mean by that? The way the Tree works right now is that it populates each item with the...
Allen Rabinovich
allenrabinovich
Online Now Send Email
Jun 25, 2008
10:13 pm

Hey Allen, Thanks for the response. I think that is a very convenient way to populate the tree and it works nicely. What I am trying to do is associate data...
Randy Troppmann
randy.troppmann
Offline Send Email
Jul 1, 2008
4:45 am

Ah, I see. It seems that a more fundamental issue here is that the Tree automatically absorbs the entire XML structure -- so the <rtmp>, <introframe> and...
Allen Rabinovich
allenrabinovich
Online Now Send Email
Jul 2, 2008
8:59 pm

Yes, makes sense. A hashtable that can be associated with the tree. Makes sense. Thanks! - Randy On Wed, Jul 2, 2008 at 2:58 PM, Allen Rabinovich...
Randy Troppmann
randy.troppmann
Offline Send Email
Jul 3, 2008
4:35 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help