You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Oleg Konovalov <ol...@gmail.com> on 2014/09/11 20:53:12 UTC

HostComponent is NULL?

Hi,

I am creating a View/ViewSkin pair,
with view extending SkinnableContainer.
As usual, often have to call hostComponent.method1(),
but getting Error # 1009 Cannot access a property or method.
I do define HostComponent properly in the skin.
When I call that method1, hostComponent is NULL. Why?
What I might be missing?

TIA,
Oleg

Re: HostComponent is NULL?

Posted by Oleg Konovalov <ol...@gmail.com>.
As I mentioned in previous post, I am already getting a 1-2 lines exception,
so what will try/catch block give me? :-)
On Sep 11, 2014 8:10 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:

> On Thu, Sep 11, 2014 at 5:01 PM, Oleg Konovalov <ol...@gmail.com> wrote:
>
> > All I get in error stack trace is 1 line (or 2 if it called not directly
> > from MXML Spark Button definition, but from some method in that skin
> > class):
> >
> > MySkinClass::Btn1_click:   line xxx
> >
> >
> > I am using Parsley 2.4 (if that is relevant).
> >
> >
> Lots of times, Parsley eats the exceptions and lets things silently fail.
> I usually add a try catch in my code and inspect the scope chain for
> errors.
>
> In your case, try adding a try catch where you are trying to access the
> hostcomponent.
>
> In case you are using the parsley swcs, try switching to the parsely source
> directly and perhaps you can see the exact location things are failing.
>
> Thanks,
> Om
>
>
>
> > It is really strange:  I wrote a lot of such   view/viewSkin pairs and
> > never seen that problem before.
> >
> > In that case I copied existing pair of them and copied into it some code
> > from another pair with minor changes.
> > Probably missed something....     all compiles and looks normal.
> > have proper constructor in view...
> >
> >
> > On Thu, Sep 11, 2014 at 3:54 PM, Alex Harui <ah...@adobe.com> wrote:
> >
> > > Did you try to attach something?  Attachments don't always work on the
> > > mailing list.  Copy and paste the stack trace or post it somewhere and
> > > send a link to it.
> > >
> > > -Alex
> > >
> > > On 9/11/14 12:37 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> > >
> > > >Skin's spark button click -- to hostComponent.method1()
> > > >On Sep 11, 2014 3:19 PM, "Alex Harui" <ah...@adobe.com> wrote:
> > > >
> > > >> What does the call stack look like?
> > > >>
> > > >> On 9/11/14 12:15 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> > > >>
> > > >> >I am calling it by clicking a button on fully drawn screen, so I
> > would
> > > >> >expect that hostComponent to be initialized by then. Are there any
> > > >> >conditions to check or configuration I need to know about?
> > > >> >Seems to work fine on many similar screens.
> > > >> >Using Flex 4.5.1.
> > > >> >And F3 does bring me to correct method.
> > > >> >On Sep 11, 2014 3:03 PM, "Alex Harui" <ah...@adobe.com> wrote:
> > > >> >
> > > >> >> Calling too soon before hostComponent is assigned, or maybe
> > > >> >>hostComponent
> > > >> >> is the type you specified.
> > > >> >>
> > > >> >> On 9/11/14 11:53 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> > > >> >>
> > > >> >> >Hi,
> > > >> >> >
> > > >> >> >I am creating a View/ViewSkin pair,
> > > >> >> >with view extending SkinnableContainer.
> > > >> >> >As usual, often have to call hostComponent.method1(),
> > > >> >> >but getting Error # 1009 Cannot access a property or method.
> > > >> >> >I do define HostComponent properly in the skin.
> > > >> >> >When I call that method1, hostComponent is NULL. Why?
> > > >> >> >What I might be missing?
> > > >> >> >
> > > >> >> >TIA,
> > > >> >> >Oleg
> > > >> >>
> > > >> >>
> > > >>
> > > >>
> > >
> > >
> >
> >
> > --
> > Thank you,
> > Oleg.
> >
>

Re: HostComponent is NULL?

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Thu, Sep 11, 2014 at 5:01 PM, Oleg Konovalov <ol...@gmail.com> wrote:

> All I get in error stack trace is 1 line (or 2 if it called not directly
> from MXML Spark Button definition, but from some method in that skin
> class):
>
> MySkinClass::Btn1_click:   line xxx
>
>
> I am using Parsley 2.4 (if that is relevant).
>
>
Lots of times, Parsley eats the exceptions and lets things silently fail.
I usually add a try catch in my code and inspect the scope chain for
errors.

In your case, try adding a try catch where you are trying to access the
hostcomponent.

In case you are using the parsley swcs, try switching to the parsely source
directly and perhaps you can see the exact location things are failing.

Thanks,
Om



> It is really strange:  I wrote a lot of such   view/viewSkin pairs and
> never seen that problem before.
>
> In that case I copied existing pair of them and copied into it some code
> from another pair with minor changes.
> Probably missed something....     all compiles and looks normal.
> have proper constructor in view...
>
>
> On Thu, Sep 11, 2014 at 3:54 PM, Alex Harui <ah...@adobe.com> wrote:
>
> > Did you try to attach something?  Attachments don't always work on the
> > mailing list.  Copy and paste the stack trace or post it somewhere and
> > send a link to it.
> >
> > -Alex
> >
> > On 9/11/14 12:37 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> >
> > >Skin's spark button click -- to hostComponent.method1()
> > >On Sep 11, 2014 3:19 PM, "Alex Harui" <ah...@adobe.com> wrote:
> > >
> > >> What does the call stack look like?
> > >>
> > >> On 9/11/14 12:15 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> > >>
> > >> >I am calling it by clicking a button on fully drawn screen, so I
> would
> > >> >expect that hostComponent to be initialized by then. Are there any
> > >> >conditions to check or configuration I need to know about?
> > >> >Seems to work fine on many similar screens.
> > >> >Using Flex 4.5.1.
> > >> >And F3 does bring me to correct method.
> > >> >On Sep 11, 2014 3:03 PM, "Alex Harui" <ah...@adobe.com> wrote:
> > >> >
> > >> >> Calling too soon before hostComponent is assigned, or maybe
> > >> >>hostComponent
> > >> >> is the type you specified.
> > >> >>
> > >> >> On 9/11/14 11:53 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> > >> >>
> > >> >> >Hi,
> > >> >> >
> > >> >> >I am creating a View/ViewSkin pair,
> > >> >> >with view extending SkinnableContainer.
> > >> >> >As usual, often have to call hostComponent.method1(),
> > >> >> >but getting Error # 1009 Cannot access a property or method.
> > >> >> >I do define HostComponent properly in the skin.
> > >> >> >When I call that method1, hostComponent is NULL. Why?
> > >> >> >What I might be missing?
> > >> >> >
> > >> >> >TIA,
> > >> >> >Oleg
> > >> >>
> > >> >>
> > >>
> > >>
> >
> >
>
>
> --
> Thank you,
> Oleg.
>

Re: HostComponent is NULL?

Posted by Oleg Konovalov <ol...@gmail.com>.
All I get in error stack trace is 1 line (or 2 if it called not directly
from MXML Spark Button definition, but from some method in that skin class):

MySkinClass::Btn1_click:   line xxx


I am using Parsley 2.4 (if that is relevant).

It is really strange:  I wrote a lot of such   view/viewSkin pairs and
never seen that problem before.

In that case I copied existing pair of them and copied into it some code
from another pair with minor changes.
Probably missed something....     all compiles and looks normal.
have proper constructor in view...


On Thu, Sep 11, 2014 at 3:54 PM, Alex Harui <ah...@adobe.com> wrote:

> Did you try to attach something?  Attachments don't always work on the
> mailing list.  Copy and paste the stack trace or post it somewhere and
> send a link to it.
>
> -Alex
>
> On 9/11/14 12:37 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
>
> >Skin's spark button click -- to hostComponent.method1()
> >On Sep 11, 2014 3:19 PM, "Alex Harui" <ah...@adobe.com> wrote:
> >
> >> What does the call stack look like?
> >>
> >> On 9/11/14 12:15 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> >>
> >> >I am calling it by clicking a button on fully drawn screen, so I would
> >> >expect that hostComponent to be initialized by then. Are there any
> >> >conditions to check or configuration I need to know about?
> >> >Seems to work fine on many similar screens.
> >> >Using Flex 4.5.1.
> >> >And F3 does bring me to correct method.
> >> >On Sep 11, 2014 3:03 PM, "Alex Harui" <ah...@adobe.com> wrote:
> >> >
> >> >> Calling too soon before hostComponent is assigned, or maybe
> >> >>hostComponent
> >> >> is the type you specified.
> >> >>
> >> >> On 9/11/14 11:53 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> >> >>
> >> >> >Hi,
> >> >> >
> >> >> >I am creating a View/ViewSkin pair,
> >> >> >with view extending SkinnableContainer.
> >> >> >As usual, often have to call hostComponent.method1(),
> >> >> >but getting Error # 1009 Cannot access a property or method.
> >> >> >I do define HostComponent properly in the skin.
> >> >> >When I call that method1, hostComponent is NULL. Why?
> >> >> >What I might be missing?
> >> >> >
> >> >> >TIA,
> >> >> >Oleg
> >> >>
> >> >>
> >>
> >>
>
>


-- 
Thank you,
Oleg.

Re: HostComponent is NULL?

Posted by Alex Harui <ah...@adobe.com>.
Did you try to attach something?  Attachments don't always work on the
mailing list.  Copy and paste the stack trace or post it somewhere and
send a link to it.

-Alex

On 9/11/14 12:37 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:

>Skin's spark button click -- to hostComponent.method1()
>On Sep 11, 2014 3:19 PM, "Alex Harui" <ah...@adobe.com> wrote:
>
>> What does the call stack look like?
>>
>> On 9/11/14 12:15 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
>>
>> >I am calling it by clicking a button on fully drawn screen, so I would
>> >expect that hostComponent to be initialized by then. Are there any
>> >conditions to check or configuration I need to know about?
>> >Seems to work fine on many similar screens.
>> >Using Flex 4.5.1.
>> >And F3 does bring me to correct method.
>> >On Sep 11, 2014 3:03 PM, "Alex Harui" <ah...@adobe.com> wrote:
>> >
>> >> Calling too soon before hostComponent is assigned, or maybe
>> >>hostComponent
>> >> is the type you specified.
>> >>
>> >> On 9/11/14 11:53 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:
>> >>
>> >> >Hi,
>> >> >
>> >> >I am creating a View/ViewSkin pair,
>> >> >with view extending SkinnableContainer.
>> >> >As usual, often have to call hostComponent.method1(),
>> >> >but getting Error # 1009 Cannot access a property or method.
>> >> >I do define HostComponent properly in the skin.
>> >> >When I call that method1, hostComponent is NULL. Why?
>> >> >What I might be missing?
>> >> >
>> >> >TIA,
>> >> >Oleg
>> >>
>> >>
>>
>>


Re: HostComponent is NULL?

Posted by Oleg Konovalov <ol...@gmail.com>.
Skin's spark button click -- to hostComponent.method1()
On Sep 11, 2014 3:19 PM, "Alex Harui" <ah...@adobe.com> wrote:

> What does the call stack look like?
>
> On 9/11/14 12:15 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
>
> >I am calling it by clicking a button on fully drawn screen, so I would
> >expect that hostComponent to be initialized by then. Are there any
> >conditions to check or configuration I need to know about?
> >Seems to work fine on many similar screens.
> >Using Flex 4.5.1.
> >And F3 does bring me to correct method.
> >On Sep 11, 2014 3:03 PM, "Alex Harui" <ah...@adobe.com> wrote:
> >
> >> Calling too soon before hostComponent is assigned, or maybe
> >>hostComponent
> >> is the type you specified.
> >>
> >> On 9/11/14 11:53 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> >>
> >> >Hi,
> >> >
> >> >I am creating a View/ViewSkin pair,
> >> >with view extending SkinnableContainer.
> >> >As usual, often have to call hostComponent.method1(),
> >> >but getting Error # 1009 Cannot access a property or method.
> >> >I do define HostComponent properly in the skin.
> >> >When I call that method1, hostComponent is NULL. Why?
> >> >What I might be missing?
> >> >
> >> >TIA,
> >> >Oleg
> >>
> >>
>
>

Re: HostComponent is NULL?

Posted by Alex Harui <ah...@adobe.com>.
What does the call stack look like?

On 9/11/14 12:15 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:

>I am calling it by clicking a button on fully drawn screen, so I would
>expect that hostComponent to be initialized by then. Are there any
>conditions to check or configuration I need to know about?
>Seems to work fine on many similar screens.
>Using Flex 4.5.1.
>And F3 does bring me to correct method.
>On Sep 11, 2014 3:03 PM, "Alex Harui" <ah...@adobe.com> wrote:
>
>> Calling too soon before hostComponent is assigned, or maybe
>>hostComponent
>> is the type you specified.
>>
>> On 9/11/14 11:53 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:
>>
>> >Hi,
>> >
>> >I am creating a View/ViewSkin pair,
>> >with view extending SkinnableContainer.
>> >As usual, often have to call hostComponent.method1(),
>> >but getting Error # 1009 Cannot access a property or method.
>> >I do define HostComponent properly in the skin.
>> >When I call that method1, hostComponent is NULL. Why?
>> >What I might be missing?
>> >
>> >TIA,
>> >Oleg
>>
>>


Re: HostComponent is NULL?

Posted by jude <fl...@gmail.com>.
Is the host component in a different state? If it is you must set the
creation policy to create it right away. Can you post the skin code here or
post it to paste bin?

Also, put a break point in the click handler so you can step through it
before it throws the exception and see if you see any thing out of place.

On Thursday, September 11, 2014, Oleg Konovalov <ol...@gmail.com> wrote:

> I am calling it by clicking a button on fully drawn screen, so I would
> expect that hostComponent to be initialized by then. Are there any
> conditions to check or configuration I need to know about?
> Seems to work fine on many similar screens.
> Using Flex 4.5.1.
> And F3 does bring me to correct method.
> On Sep 11, 2014 3:03 PM, "Alex Harui" <aharui@adobe.com <javascript:;>>
> wrote:
>
> > Calling too soon before hostComponent is assigned, or maybe hostComponent
> > is the type you specified.
> >
> > On 9/11/14 11:53 AM, "Oleg Konovalov" <olegkon@gmail.com <javascript:;>>
> wrote:
> >
> > >Hi,
> > >
> > >I am creating a View/ViewSkin pair,
> > >with view extending SkinnableContainer.
> > >As usual, often have to call hostComponent.method1(),
> > >but getting Error # 1009 Cannot access a property or method.
> > >I do define HostComponent properly in the skin.
> > >When I call that method1, hostComponent is NULL. Why?
> > >What I might be missing?
> > >
> > >TIA,
> > >Oleg
> >
> >
>

Re: HostComponent is NULL?

Posted by Oleg Konovalov <ol...@gmail.com>.
I am calling it by clicking a button on fully drawn screen, so I would
expect that hostComponent to be initialized by then. Are there any
conditions to check or configuration I need to know about?
Seems to work fine on many similar screens.
Using Flex 4.5.1.
And F3 does bring me to correct method.
On Sep 11, 2014 3:03 PM, "Alex Harui" <ah...@adobe.com> wrote:

> Calling too soon before hostComponent is assigned, or maybe hostComponent
> is the type you specified.
>
> On 9/11/14 11:53 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:
>
> >Hi,
> >
> >I am creating a View/ViewSkin pair,
> >with view extending SkinnableContainer.
> >As usual, often have to call hostComponent.method1(),
> >but getting Error # 1009 Cannot access a property or method.
> >I do define HostComponent properly in the skin.
> >When I call that method1, hostComponent is NULL. Why?
> >What I might be missing?
> >
> >TIA,
> >Oleg
>
>

Re: HostComponent is NULL?

Posted by Alex Harui <ah...@adobe.com>.
Calling too soon before hostComponent is assigned, or maybe hostComponent
is the type you specified.

On 9/11/14 11:53 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:

>Hi,
>
>I am creating a View/ViewSkin pair,
>with view extending SkinnableContainer.
>As usual, often have to call hostComponent.method1(),
>but getting Error # 1009 Cannot access a property or method.
>I do define HostComponent properly in the skin.
>When I call that method1, hostComponent is NULL. Why?
>What I might be missing?
>
>TIA,
>Oleg