Dear Benjamin :

I user your smaple code,
But error mesage is "elements is undefined"

I need to develop a Desktop Gadget for the interaction bwtween FLASH
and JavaScript
like this -- 
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683#exampleas3

this funtion is very important, but i tried many times......still not
be worked.
 function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
 }

In the above function, I must get the name(or id) of <object>

In main.js file,
How can I get the name of <object> in Desktop Gadget's main.xml ?
<object classid="..." name="obj_id">
   <param ..... />
</object>

elements.name("obj_id") ?
object.name("obj_id") ?

Thanks very much.


On 2月10日, 下午12時53分, "Benjamin [API Guru]" <[email protected]>
wrote:
> As seen inhttp://code.google.com/apis/desktop/docs/gadget_apiref.html#elements
> there is an attribute "count" and a method "item()". You can use
> element.children.count to get the number of children. You can also use
> element.children.item(idx) or element.children.item("name") to get a
> child directly.
>
> Some major difference between this item() and the getElementsById()
> function are:
> - item() only returns one element, not all elements that match
> - getElementsById() works recursively while item() only finds direct
> children.
> - item() can be called with the index of the element or the name of
> it. There is no id="xx" attribute in Google Desktop, only name="xx".
>
> In your case you would call the following code to change the value of
> your "'b'+x + '_' + y" element which is assumed to be a direct
> descendant of the element named "foo".
>
> var ele = foo.children.item('b' + x + '_' + y);
> ele.value = "bar";
>
> Hope this helps,
> Benjamin
>
> On Feb 10, 5:43 am, blhc <[email protected]> wrote:
>
> > Ok...so i how does this children attribute work? a possible workin
> > syntax example perhaps? thnks for poinitin the document part so far!
>
> > On Feb 7, 10:25 am, "Benjamin [API Guru]" <[email protected]>
> > wrote:
>
> > > The method document.getElementsById() is specific to DOM interaction
> > > in the browser. Google Desktop does not support these DOM calls. Have
> > > a look 
> > > athttp://code.google.com/apis/desktop/docs/gadget_apiref.html#basicElement
> > > especially the children attributes on how to iterate through the
> > > elements of a specific element.
>
> > > Best regards,
> > > Benjamin
>
> > > On Feb 4, 8:48 am, blhc <[email protected]> wrote:
>
> > > > this works in js but in google desktop gadget it says document
> > > > undefined
> > > > document.getElementById('b'+x + '_' + y).value = ' ';
> > > > how to i change this so that it can be used in google api
> > > > thanks
> > > > lee

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Desktop Developer Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Desktop-Developer?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to