Thanks a lot Daniel for the help. I'll give it a try tomorrow.
On May 8, 2012 7:42 PM, "Daniel Wagner" <daniel.wag...@1und1.de> wrote:
> Hi, and welcome to qooxdoo!
>
> You can use qx.lang.Function.bind to create a function with the context
> you want:
>
> var onStateChangeBound = qx.lang.Function.bind(this.onStateChange, this);
>
> Call loadYoutubeVideo with the bound function and it should work as
> expected.
>
>
> Regards,
> Daniel
>
> On 05/08/2012 03:29 PM, cherfim wrote:
> > Hi all, I'm kind of new to qooxdoo/web dev, but I really found the
> > framework to be great and intuitive. but I'm hitting an annoying
> > situation when trying to develop my first application (youtube api,
> > iframe), and below is my source ; I created a qooxdoo app that have an
> > iframe which itself loads an HTML file that do the youtube api thing :
> > myclass (abreviated) :
> >
> > * qx.Class.define("kortobalibrary.GUI.Player",
> > * {
> > * ....
> > * onFrameLoad : function(e){
> > *
> > * this.__frame.getWindow().loadYoutubeVideo(this.__video,
> > this.onReady, this.onStateChange, this.onError, this.onAPINotReady);
> > *
> > * },
> > * ....
> > * }
> >
> > and this is the html file (abreviated) :
> >
> > * function loadYoutubeVideo(myVideoID, vidHeight, vidWidth, startTime,
> > onReady, onPlayerStateChange, onError, onAPINotReady) {
> > *
> > * player = new YT.Player('player', {
> > * height: vidHeight,
> > * width: vidWidth,
> > * videoId : myVideoID,
> > * playerVars: { 'autoplay': 0, 'controls': 0, 'enablejsapi': 1, 'rel':
> 0},
> > * events: {
> > * 'onReady': onReady,
> > * 'onStateChange': onPlayerStateChange,
> > * 'onError' : onError
> > * }
> > * });
> >
> > till here it's ok, now the problem is when my onPlayerStateChange
> > function is called :
> >
> > * else if (e.data == 1){
> > * this.__pause.setEnabled(true);
> > * this.__play.setEnabled(true);
> > * }
> >
> > you guessed it, /"this"/ no longer references my object, and I get an
> > error in debug console ; I tried to add a context parameter and pass
> > /"this"/ to /"loadYoutubeVideo"/and then call the functions with
> > /context./ , but still this didn't work ! so long story short, is there
> > a way to send the "this" to the HTML, and then come back to my
> > application normally ? if not, is there a way to call my qooxdoo methods
> > from a script in HTML file ? PS : which tag should I use to post a code.
> > all help is welcome, thanks in advance, BR
> > ------------------------------------------------------------------------
> > View this message in context: qooxdoo <-> HTML communication
> > <
> http://qooxdoo.678.n2.nabble.com/qooxdoo-HTML-communication-tp7539097.html
> >
> > Sent from the qooxdoo mailing list archive
> > <http://qooxdoo.678.n2.nabble.com/> at Nabble.com.
> >
> >
> >
> ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >
> >
> >
> > _______________________________________________
> > qooxdoo-devel mailing list
> > qooxdoo-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel