You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by "romanisitua@yahoo.com" <ro...@yahoo.com> on 2021/08/10 15:22:42 UTC

Uncaught TypeError: Cannot convert [object Object] to IBead

Hi Everyone,
I am developing my first crux based royale app. 
I am getting the following errorwhen running the application Uncaught TypeError: Cannot convert [object Object] to IBead at FrontEnd.org.apache.royale.core.ElementWrapper.addBead (ElementWrapper.as:268)    at FrontEnd.org.apache.royale.core.HTMLElementWrapper.addBead (HTMLElementWrapper.js:50)    at FrontEnd.org.apache.royale.jewel.Application.start (Application.as:674)    at index.html:345

When tracing to the generated javascript source it is failing at this point
if (model is IBead) addBead(model as IBead); if (controller is IBead) addBead(controller as IBead);  for (var index:int in beads) { addBead(beads[index]);            // it fails at this line. }


My guess is that there is one more configuration that needs to be done. I have tried to follow the example on the apache royale site.
Has anyone encountered this issue before ?

Re: Uncaught TypeError: Cannot convert [object Object] to IBead

Posted by Roman Isitua <ro...@gmail.com>.
Thanks for your response Greg.

 In this case, the error from my end.

I added an element that is not a bead to the beads element tag.
The element I added was
"
<js:SimpleCSSValuesImpl />
"
This was a mistake.


It is supposed to be here

<j:valuesImpl>
        <js:SimpleCSSValuesImpl />
    </j:valuesImpl>



Regards,

On Fri, 13 Aug 2021, 00:01 Greg Dove, <gr...@gmail.com> wrote:

>
> I have also seen this in the past, where a bead did not implement IBead.
>
> A check was added to verify that in the addBead method but the error alone
> is not particularly helpful because of stringification. It could be that
> you are encountering a bead that was not updated to explicitly implement
> IBead in the as3 source code, but which probably does comply with the
> interface in terms of its method signatures.
>
> If the bead that is causing the issue is from the royale framework, then
> it needs fixing in the framework.
>
> I just pushed a change that will log the instance to the console before
> the error is thrown.
>
> If you want to check this in your local build now without updating your
> royale sdk, you can do the following:
>
> 1. go into js-debug output folder and navigate to
> org/apache/royale/core/ElementWrapper.js
>
> 2. open that file in a text editor.
>
> 3. Find the block of code that begins with:
> org.apache.royale.core.ElementWrapper.prototype.addBead = function(bead) {
>
> 4. and replace it with:
> org.apache.royale.core.ElementWrapper.prototype.addBead = function(bead) {
>   if (!this._beads) {
>     this._beads = [];
>   }
>   if (goog.DEBUG && !org.apache.royale.utils.Language.is(bead,
> org.apache.royale.core.IBead)) {
>     console.log('Cannot convert ', bead, ' to IBead');
>     throw new TypeError('Cannot convert ' + bead + ' to IBead');
>   }
>   this._beads.push(bead);
>   bead.strand = this;
> };
>
>
> When you re-run the app, you should see a more helpful log in the browser
> console before the error.
> The other way to do this is to do what Yishay said and put a breakpoint at
> the code just before the error is thrown and inspect the bead instance
> there.
>
> Please let us know what that bead is, if it is one that is from the royale
> sdk.
>
> Thanks,
> Greg
>
>
>
> On Fri, Aug 13, 2021 at 3:12 AM Yishay Weiss <yi...@hotmail.com>
> wrote:
>
>> Oh, I see you have resolved it, thanks for sharing.
>>
>>
>>
>> *From: *Yishay Weiss <yi...@hotmail.com>
>> *Sent: *Thursday, August 12, 2021 6:11 PM
>> *To: *users@royale.apache.org
>> *Subject: *RE: Uncaught TypeError: Cannot convert [object Object] to
>> IBead
>>
>>
>>
>> I have encountered similar issues in the past. I think the runtime
>> requirement that all beads actually implement IBead was added a bit late so
>> there may be code that fails in runtime. I would put a breakpoint in your
>> browser and inspect beads to see if one of them is not an IBead.
>>
>>
>>
>> *From: *romanisitua@yahoo.com
>> *Sent: *Tuesday, August 10, 2021 6:23 PM
>> *To: *users@royale.apache.org
>> *Subject: *Uncaught TypeError: Cannot convert [object Object] to IBead
>>
>>
>>
>>
>>
>> Hi Everyone,
>>
>>
>>
>> I am developing my first crux based royale app.
>>
>>
>>
>> I am getting the following error
>>
>> when running the application
>>
>>
>>
>> Uncaught TypeError: Cannot convert [object Object] to IBead
>>
>>  at FrontEnd.org.apache.royale.core.ElementWrapper.addBead
>> (ElementWrapper.as:268)
>>
>>     at FrontEnd.org.apache.royale.core.HTMLElementWrapper.addBead
>> (HTMLElementWrapper.js:50)
>>
>>     at FrontEnd.org.apache.royale.jewel.Application.start
>> (Application.as:674)
>>
>>     at index.html:345
>>
>>
>>
>>
>>
>> When tracing to the generated javascript source it is failing at this
>> point
>>
>>
>>
>> if (model is IBead) addBead(model as IBead);
>>
>> if (controller is IBead) addBead(controller as IBead);
>>
>> for (var index:int in beads) {
>>
>> *addBead(beads[index]);            *// it fails at this line.
>>
>> }
>>
>>
>>
>>
>>
>>
>>
>> My guess is that there is one more configuration that needs to be done. I
>> have tried to follow the example on the apache royale site.
>>
>>
>>
>> Has anyone encountered this issue before ?
>>
>>
>>
>>
>>
>

Re: Uncaught TypeError: Cannot convert [object Object] to IBead

Posted by Greg Dove <gr...@gmail.com>.
I have also seen this in the past, where a bead did not implement IBead.

A check was added to verify that in the addBead method but the error alone
is not particularly helpful because of stringification. It could be that
you are encountering a bead that was not updated to explicitly implement
IBead in the as3 source code, but which probably does comply with the
interface in terms of its method signatures.

If the bead that is causing the issue is from the royale framework, then it
needs fixing in the framework.

I just pushed a change that will log the instance to the console before the
error is thrown.

If you want to check this in your local build now without updating your
royale sdk, you can do the following:

1. go into js-debug output folder and navigate to
org/apache/royale/core/ElementWrapper.js

2. open that file in a text editor.

3. Find the block of code that begins with:
org.apache.royale.core.ElementWrapper.prototype.addBead = function(bead) {

4. and replace it with:
org.apache.royale.core.ElementWrapper.prototype.addBead = function(bead) {
  if (!this._beads) {
    this._beads = [];
  }
  if (goog.DEBUG && !org.apache.royale.utils.Language.is(bead,
org.apache.royale.core.IBead)) {
    console.log('Cannot convert ', bead, ' to IBead');
    throw new TypeError('Cannot convert ' + bead + ' to IBead');
  }
  this._beads.push(bead);
  bead.strand = this;
};


When you re-run the app, you should see a more helpful log in the browser
console before the error.
The other way to do this is to do what Yishay said and put a breakpoint at
the code just before the error is thrown and inspect the bead instance
there.

Please let us know what that bead is, if it is one that is from the royale
sdk.

Thanks,
Greg



On Fri, Aug 13, 2021 at 3:12 AM Yishay Weiss <yi...@hotmail.com> wrote:

> Oh, I see you have resolved it, thanks for sharing.
>
>
>
> *From: *Yishay Weiss <yi...@hotmail.com>
> *Sent: *Thursday, August 12, 2021 6:11 PM
> *To: *users@royale.apache.org
> *Subject: *RE: Uncaught TypeError: Cannot convert [object Object] to IBead
>
>
>
> I have encountered similar issues in the past. I think the runtime
> requirement that all beads actually implement IBead was added a bit late so
> there may be code that fails in runtime. I would put a breakpoint in your
> browser and inspect beads to see if one of them is not an IBead.
>
>
>
> *From: *romanisitua@yahoo.com
> *Sent: *Tuesday, August 10, 2021 6:23 PM
> *To: *users@royale.apache.org
> *Subject: *Uncaught TypeError: Cannot convert [object Object] to IBead
>
>
>
>
>
> Hi Everyone,
>
>
>
> I am developing my first crux based royale app.
>
>
>
> I am getting the following error
>
> when running the application
>
>
>
> Uncaught TypeError: Cannot convert [object Object] to IBead
>
>  at FrontEnd.org.apache.royale.core.ElementWrapper.addBead
> (ElementWrapper.as:268)
>
>     at FrontEnd.org.apache.royale.core.HTMLElementWrapper.addBead
> (HTMLElementWrapper.js:50)
>
>     at FrontEnd.org.apache.royale.jewel.Application.start
> (Application.as:674)
>
>     at index.html:345
>
>
>
>
>
> When tracing to the generated javascript source it is failing at this point
>
>
>
> if (model is IBead) addBead(model as IBead);
>
> if (controller is IBead) addBead(controller as IBead);
>
> for (var index:int in beads) {
>
> *addBead(beads[index]);            *// it fails at this line.
>
> }
>
>
>
>
>
>
>
> My guess is that there is one more configuration that needs to be done. I
> have tried to follow the example on the apache royale site.
>
>
>
> Has anyone encountered this issue before ?
>
>
>
>
>

RE: Uncaught TypeError: Cannot convert [object Object] to IBead

Posted by Yishay Weiss <yi...@hotmail.com>.
Oh, I see you have resolved it, thanks for sharing.

From: Yishay Weiss<ma...@hotmail.com>
Sent: Thursday, August 12, 2021 6:11 PM
To: users@royale.apache.org<ma...@royale.apache.org>
Subject: RE: Uncaught TypeError: Cannot convert [object Object] to IBead

I have encountered similar issues in the past. I think the runtime requirement that all beads actually implement IBead was added a bit late so there may be code that fails in runtime. I would put a breakpoint in your browser and inspect beads to see if one of them is not an IBead.

From: romanisitua@yahoo.com<ma...@yahoo.com>
Sent: Tuesday, August 10, 2021 6:23 PM
To: users@royale.apache.org<ma...@royale.apache.org>
Subject: Uncaught TypeError: Cannot convert [object Object] to IBead


Hi Everyone,

I am developing my first crux based royale app.

I am getting the following error
when running the application

Uncaught TypeError: Cannot convert [object Object] to IBead
 at FrontEnd.org.apache.royale.core.ElementWrapper.addBead (ElementWrapper.as:268)
    at FrontEnd.org.apache.royale.core.HTMLElementWrapper.addBead (HTMLElementWrapper.js:50)
    at FrontEnd.org.apache.royale.jewel.Application.start (Application.as:674)
    at index.html:345


When tracing to the generated javascript source it is failing at this point

if (model is IBead) addBead(model as IBead);
if (controller is IBead) addBead(controller as IBead);
for (var index:int in beads) {
addBead(beads[index]);            // it fails at this line.
}



My guess is that there is one more configuration that needs to be done. I have tried to follow the example on the apache royale site.

Has anyone encountered this issue before ?



RE: Uncaught TypeError: Cannot convert [object Object] to IBead

Posted by Yishay Weiss <yi...@hotmail.com>.
I have encountered similar issues in the past. I think the runtime requirement that all beads actually implement IBead was added a bit late so there may be code that fails in runtime. I would put a breakpoint in your browser and inspect beads to see if one of them is not an IBead.

From: romanisitua@yahoo.com<ma...@yahoo.com>
Sent: Tuesday, August 10, 2021 6:23 PM
To: users@royale.apache.org<ma...@royale.apache.org>
Subject: Uncaught TypeError: Cannot convert [object Object] to IBead


Hi Everyone,

I am developing my first crux based royale app.

I am getting the following error
when running the application

Uncaught TypeError: Cannot convert [object Object] to IBead
 at FrontEnd.org.apache.royale.core.ElementWrapper.addBead (ElementWrapper.as:268)
    at FrontEnd.org.apache.royale.core.HTMLElementWrapper.addBead (HTMLElementWrapper.js:50)
    at FrontEnd.org.apache.royale.jewel.Application.start (Application.as:674)
    at index.html:345


When tracing to the generated javascript source it is failing at this point

if (model is IBead) addBead(model as IBead);
if (controller is IBead) addBead(controller as IBead);
for (var index:int in beads) {
addBead(beads[index]);            // it fails at this line.
}



My guess is that there is one more configuration that needs to be done. I have tried to follow the example on the apache royale site.

Has anyone encountered this issue before ?