You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by OmPrakash Muppirala <bi...@gmail.com> on 2014/10/18 01:53:55 UTC

[FlexJS] States in FlexJS - bugs?

I created a component that sort of behaves like a Skin class.  It is here:

https://github.com/apache/flex-asjs/blob/develop/examples/FlexJSTest_SVG/src/SkinsView.mxml

This works fine on the Flash side.  There is an issue with mouseChildren
setter on the JS side, but I think I can figure out a way around it.

The real issue here is that on the JS side, no element get drawn.  In the
view JS class, this is how the MXMLDescriptor looks like:

SkinsView.prototype.get_MXMLDescriptor = function()
{
  if (this.mxmldd == undefined)
  {
    /** @type {Array} */
    var arr = SkinsView.base(this, 'get_MXMLDescriptor');
    /** @type {Array} */
    var data = [

];

    if (arr)
      this.mxmldd = arr.concat(data);
    else
      this.mxmldd = data;
  }
  return this.mxmldd;
};

I looked at DataBindingTest example and the states seems to work fine
there.  I am not able to figure out what I am doing wrong.

Alex/Peter/Erik, can one of you please take a look and help me debug?  A
code review of my recent commits would be good as well.

Thanks,
Om

Re: [FlexJS] States in FlexJS - bugs?

Posted by Alex Harui <ah...@adobe.com>.
Great job!  The changes look ok.  At some point we need to figure out why
the first state didn’t become the default state and get applied properly.
It should work like it does in current Flex.

-Alex

On 10/19/14, 2:33 AM, "bigosmallm@gmail.com" <bi...@gmail.com> wrote:

>It looks like the root cause of this issue is that there is no
>initialStateHandler_ method in SimpleStateImpl.js.  As the name indicates,
>this is responsible to handling the initial state.    I added this method.
>
>I also had a manually set currentStae = <defaultState> for this states
>example to work.
>
>Please take a look at my recent commmits to see if I am on the right
>track.
>
>I will sort out the MouseEvent issue next.
>
>Thanks,
>Om
>
>On Fri, Oct 17, 2014 at 9:57 PM, Alex Harui <ah...@adobe.com> wrote:
>
>>
>>
>> On 10/17/14, 5:49 PM, "OmPrakash Muppirala" <bi...@gmail.com>
>>wrote:
>>
>> >
>> >I tested by removing the array of states.  The label does not show up
>>in
>> >Flash, and is the only thing that shows up in HTML/JS.
>> Interesting.  Most of the DataBinding controls don’t have
>> includeIn/excludeFrom and they show up.  I’m about to check in a bunch
>>of
>> improvements, although I don’t know if they will affect states.
>> DataBindingTest worked for me, so hopefully nothing else broke.
>>
>> -Alex
>>
>>


Re: [FlexJS] States in FlexJS - bugs?

Posted by Alex Harui <ah...@adobe.com>.

On 10/20/14, 5:08 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:
>>If you
>> haven’t made progress on it I’ll try to get it working.  I figure you
>> might be busy prepping for your talk tomorrow.
>>
>>
>I just checked in a fix that removes the need for throwing a different
>event type (mouseOut vs. mouseOut_)
>http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/85988f92
>
>Please see if this fixes the issue.
>
>
>> I still want to know what scenario showed the need for this change,
>> although I had wondered whether we would eventually end up needing it.
>>
Unfortunately, there is much more to it.  Code expects MouseEvent to
inherit from Event, and MXML auto-imports flash.events.MouseEvent and we
don’t want everyone to have to type org.apache.flex.events.MouseEvent
everywhere.

I’ll take your changes and try to fix up these issues.

-Alex


Re: [FlexJS] States in FlexJS - bugs?

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Mon, Oct 20, 2014 at 4:02 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 10/19/14, 2:33 AM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:
> >
> >I will sort out the MouseEvent issue next.
>
> The MouseEvent change broke some MXML compiles and list selection.


Sorry about that.


> If you
> haven’t made progress on it I’ll try to get it working.  I figure you
> might be busy prepping for your talk tomorrow.
>
>
I just checked in a fix that removes the need for throwing a different
event type (mouseOut vs. mouseOut_)
http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/85988f92

Please see if this fixes the issue.


> I still want to know what scenario showed the need for this change,
> although I had wondered whether we would eventually end up needing it.
>

My usecase:  I need to create a simple button that has various states of
its skin.  Up/out, over, down.  I want to listen to the mouse event in each
platform (flash.events.MouseEvent vs. goog.events.Event) and set the state
of the skin.

I assume that I need to attach the mouse event handlers and in those
handlers, set the state of the skin.

Since the skin class contains the drawing code (as AS3 API calls or MXMLG
style code), I need to cross-compile the skin class.  So, my mouseevents
needs wrappers so that I can list to the wrapped events on both flash and
js and react to them in the skin class.

Thanks,
Om


>
> -Alex
>
>

Re: [FlexJS] States in FlexJS - bugs?

Posted by Alex Harui <ah...@adobe.com>.

On 10/19/14, 2:33 AM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:
>
>I will sort out the MouseEvent issue next.

The MouseEvent change broke some MXML compiles and list selection.  If you
haven’t made progress on it I’ll try to get it working.  I figure you
might be busy prepping for your talk tomorrow.

I still want to know what scenario showed the need for this change,
although I had wondered whether we would eventually end up needing it.

-Alex


Re: [FlexJS] States in FlexJS - bugs?

Posted by OmPrakash Muppirala <bi...@gmail.com>.
It looks like the root cause of this issue is that there is no
initialStateHandler_ method in SimpleStateImpl.js.  As the name indicates,
this is responsible to handling the initial state.    I added this method.

I also had a manually set currentStae = <defaultState> for this states
example to work.

Please take a look at my recent commmits to see if I am on the right
track.

I will sort out the MouseEvent issue next.

Thanks,
Om

On Fri, Oct 17, 2014 at 9:57 PM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 10/17/14, 5:49 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:
>
> >
> >I tested by removing the array of states.  The label does not show up in
> >Flash, and is the only thing that shows up in HTML/JS.
> Interesting.  Most of the DataBinding controls don’t have
> includeIn/excludeFrom and they show up.  I’m about to check in a bunch of
> improvements, although I don’t know if they will affect states.
> DataBindingTest worked for me, so hopefully nothing else broke.
>
> -Alex
>
>

Re: [FlexJS] States in FlexJS - bugs?

Posted by Alex Harui <ah...@adobe.com>.

On 10/17/14, 5:49 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:

>
>I tested by removing the array of states.  The label does not show up in
>Flash, and is the only thing that shows up in HTML/JS.
Interesting.  Most of the DataBinding controls don’t have
includeIn/excludeFrom and they show up.  I’m about to check in a bunch of
improvements, although I don’t know if they will affect states.
DataBindingTest worked for me, so hopefully nothing else broke.

-Alex


Re: [FlexJS] States in FlexJS - bugs?

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Fri, Oct 17, 2014 at 5:26 PM, Alex Harui <ah...@adobe.com> wrote:

> I don’t think I made sure states works with an includeIn that is a list of
> states so that’s the first place I’d look.
>

I had to do that because, if I don't specify all the list of states, the
Label never shows up on the Flash version.  Technically, if I don't specify
any state, it should show up in all the states.  But, that does not seem to
be working.

I tested by removing the array of states.  The label does not show up in
Flash, and is the only thing that shows up in HTML/JS.


>
> State-dependent children don’t go in the MXMLDescriptor.  They become
> AddItems in the overrides of the States and all of that gets set up in the
> constructor.
>
> Also, there is a bug in setting up the initial state that may not have
> been fixed in the JS side.  DataBindingTest doesn’t have any children that
> are dependent on the initial state.  You can look at recent changes I made
> to SimpleStatesImpl.as and sync them over to the JS side, or I’ll probably
> get to it next week.
>

Okay, thanks for the hint.  I will try to debug this over the weekend.

Thanks,
Om


>
> -Alex
>
> On 10/17/14, 4:53 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:
>
> >I created a component that sort of behaves like a Skin class.  It is here:
> >
> >
> https://github.com/apache/flex-asjs/blob/develop/examples/FlexJSTest_SVG/s
> >rc/SkinsView.mxml
> >
> >This works fine on the Flash side.  There is an issue with mouseChildren
> >setter on the JS side, but I think I can figure out a way around it.
> >
> >The real issue here is that on the JS side, no element get drawn.  In the
> >view JS class, this is how the MXMLDescriptor looks like:
> >
> >SkinsView.prototype.get_MXMLDescriptor = function()
> >{
> >  if (this.mxmldd == undefined)
> >  {
> >    /** @type {Array} */
> >    var arr = SkinsView.base(this, 'get_MXMLDescriptor');
> >    /** @type {Array} */
> >    var data = [
> >
> >];
> >
> >    if (arr)
> >      this.mxmldd = arr.concat(data);
> >    else
> >      this.mxmldd = data;
> >  }
> >  return this.mxmldd;
> >};
> >
> >I looked at DataBindingTest example and the states seems to work fine
> >there.  I am not able to figure out what I am doing wrong.
> >
> >Alex/Peter/Erik, can one of you please take a look and help me debug?  A
> >code review of my recent commits would be good as well.
> >
> >Thanks,
> >Om
>
>

Re: [FlexJS] States in FlexJS - bugs?

Posted by Alex Harui <ah...@adobe.com>.
I don’t think I made sure states works with an includeIn that is a list of
states so that’s the first place I’d look.

State-dependent children don’t go in the MXMLDescriptor.  They become
AddItems in the overrides of the States and all of that gets set up in the
constructor.

Also, there is a bug in setting up the initial state that may not have
been fixed in the JS side.  DataBindingTest doesn’t have any children that
are dependent on the initial state.  You can look at recent changes I made
to SimpleStatesImpl.as and sync them over to the JS side, or I’ll probably
get to it next week.

-Alex

On 10/17/14, 4:53 PM, "OmPrakash Muppirala" <bi...@gmail.com> wrote:

>I created a component that sort of behaves like a Skin class.  It is here:
>
>https://github.com/apache/flex-asjs/blob/develop/examples/FlexJSTest_SVG/s
>rc/SkinsView.mxml
>
>This works fine on the Flash side.  There is an issue with mouseChildren
>setter on the JS side, but I think I can figure out a way around it.
>
>The real issue here is that on the JS side, no element get drawn.  In the
>view JS class, this is how the MXMLDescriptor looks like:
>
>SkinsView.prototype.get_MXMLDescriptor = function()
>{
>  if (this.mxmldd == undefined)
>  {
>    /** @type {Array} */
>    var arr = SkinsView.base(this, 'get_MXMLDescriptor');
>    /** @type {Array} */
>    var data = [
>
>];
>
>    if (arr)
>      this.mxmldd = arr.concat(data);
>    else
>      this.mxmldd = data;
>  }
>  return this.mxmldd;
>};
>
>I looked at DataBindingTest example and the states seems to work fine
>there.  I am not able to figure out what I am doing wrong.
>
>Alex/Peter/Erik, can one of you please take a look and help me debug?  A
>code review of my recent commits would be good as well.
>
>Thanks,
>Om