ImageButton Mouse Events

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

ImageButton Mouse Events

doug777
This post was updated on .
Except for the click event which has type="org.apache.flex.events.MouseEvent"
-

all the other mouse events have type="flash.events.MouseEvent".

This only seems to be at fault in the js:ImageButton.

Doug




--
Sent from: http://apache-royale-users.20374.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: ImageButton Mouse Events

Piotr Zarzycki
Hi Doug,

Not sure what do you mean. ImageButton extends Button which provides an event "click" type: org.apache.flex.events.MouseEvent. What problem do you have ?

Thanks, Piotr

2018-01-18 5:17 GMT+01:00 doug777 <[hidden email]>:
Except for the click event which has type="org.apache.flex.events.MouseEvent"
-

all the other mouse events have type="flash.events.MouseEvent".

This only seems to be at fault in the ImageButton.

Doug




--
Sent from: http://apache-royale-users.20374.n8.nabble.com/



--

Piotr Zarzycki 

Patreon: https://www.patreon.com/piotrzarzycki

Reply | Threaded
Open this post in threaded view
|

Re: ImageButton Mouse Events

doug777
If you use any of the Mouse Events other than 'click' in js:ImageButton then
when you create the handler function, that function's MouseEvent maps to
org.apache.flex.events.MouseEvent, but the event in the js:ImageButton tag
maps to flash.events.MouseEvent, so Moonshine reports the error 'Implicit
coercion of a value with static type MouseEvent to a possibly unrelated type
MouseEvent.'

Doug



--
Sent from: http://apache-royale-users.20374.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: ImageButton Mouse Events

Piotr Zarzycki
How are you building your application to JS only or to SWF and JS ?

2018-01-18 10:35 GMT+01:00 doug777 <[hidden email]>:
If you use any of the Mouse Events other than 'click' in js:ImageButton then
when you create the handler function, that function's MouseEvent maps to
org.apache.flex.events.MouseEvent, but the event in the js:ImageButton tag
maps to flash.events.MouseEvent, so Moonshine reports the error 'Implicit
coercion of a value with static type MouseEvent to a possibly unrelated type
MouseEvent.'



--

Piotr Zarzycki 

Patreon: https://www.patreon.com/piotrzarzycki

Reply | Threaded
Open this post in threaded view
|

Re: ImageButton Mouse Events

doug777
This is a JS only project. All of the mouse events available in
org.apache.flex.events.MouseEvent seem to work in the js:Button component,
so as ImageButton extends Button I assumed they would all be available in
this component as well. They seem to work in TextButton for example.

Doug





--
Sent from: http://apache-royale-users.20374.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: ImageButton Mouse Events

Alex Harui-2
Doug,

Can you post some sample code that goes wrong?  Or file a JIRA?

Thanks,
-Alex

On 1/18/18, 4:33 PM, "doug777" <[hidden email]> wrote:

>This is a JS only project. All of the mouse events available in
>org.apache.flex.events.MouseEvent seem to work in the js:Button component,
>so as ImageButton extends Button I assumed they would all be available in
>this component as well. They seem to work in TextButton for example.
>
>Doug
>
>
>
>
>
>--
>Sent from:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-roy
>ale-users.20374.n8.nabble.com%2F&data=02%7C01%7Caharui%40adobe.com%7C79a53
>7fce4484a57f97a08d55ed44c7f%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>36519188265167317&sdata=qHKyL4X%2FQBLjbqJf8D2%2Fo54U6G3XhY%2F965HA2tb%2FY4
>s%3D&reserved=0

Reply | Threaded
Open this post in threaded view
|

Re: ImageButton Mouse Events

doug777
Hi Alex,

It looks like all the button components do only support click events. Not
sure if this is the way they are written or if this is a fault.

However using a Label or Image component in button mode all the Mouse Events
are available so for the moment that solves my problem.

If you paste the following into Moonshine you can see the problem.

<?xml version="1.0" encoding="utf-8"?>
<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:js="library://ns.apache.org/flexjs/basic" >
       
        <fx:Script>
               
        </fx:Script>
       
        <js:valuesImpl>
                <js:SimpleCSSValuesImpl />
        </js:valuesImpl>
       
        <js:initialView>
                <js:View width="400" height="300">
                        <js:Container width="100%" height="100%" >
                                <js:Button rollOver="changeText(event)" rollOut="changeText(event)"
width="100"/>
                                <js:TextButton text="Hello" rollOver="changeText(event)"
rollOut="changeText(event)" width="100"/>
                                <js:ImageButton src="" rollOver="changeImage(event)"
rollOut="changeImage(event)" width="100"/>
                                <js:Label text="Hello" mouseChildren="false" buttonMode="true"
useHandCursor="true"
                                        rollOver="changeText(event)" rollOut="changeText(event)" width="100"/>
                                <js:Image src="" mouseChildren="false" buttonMode="true"
useHandCursor="true"
                                        rollOver="changeText(event)" rollOut="changeText(event)" width="100"/>
                        </js:Container>
                </js:View>
        </js:initialView>
       
 </js:Application>

Doug



--
Sent from: http://apache-royale-users.20374.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: ImageButton Mouse Events

doug777
This is the code inside the script tags that seems to have disappeared.

import org.apache.flex.events.MouseEvent;

                        private function changeImage(event:MouseEvent):void{
                               
                        }
                       
                        private function changeText(event:MouseEvent):void{
                               
                        }



--
Sent from: http://apache-royale-users.20374.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: ImageButton Mouse Events

Alex Harui-2
OK, I think the upshot is that Button.as needs to have Event metadata for
rollOver/rollOut and maybe some other mouse events.

Thanks for bringing that to our attention.

-Alex

On 1/18/18, 6:28 PM, "doug777" <[hidden email]> wrote:

>This is the code inside the script tags that seems to have disappeared.
>
>import org.apache.flex.events.MouseEvent;
>
> private function changeImage(event:MouseEvent):void{
>
> }
>
> private function changeText(event:MouseEvent):void{
>
> }
>
>
>
>--
>Sent from:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-roy
>ale-users.20374.n8.nabble.com%2F&data=02%7C01%7Caharui%40adobe.com%7Cac3de
>c49d10e44e7032008d55ee44d99%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>36519257002174363&sdata=U4FXWZp26Ada7QvfxzqBmzESSkUhIEgPWOoDTCaNK8w%3D&res
>erved=0