This does raise a good question: Should we be adding MXML meta tags for all supported events? It seems like a desirable thing to have, and there are currently very few event tags. I’m not clear on whether the meta-tags effect the end result of code size.
Harbs > On Oct 30, 2017, at 7:38 PM, GitBox <g...@apache.org> wrote: > > justinmclean commented on issue #60: Image not removed when src set to null > URL: https://github.com/apache/royale-asjs/issues/60#issuecomment-340524197 > > > This code fails to compile: > ``` > <?xml version="1.0" encoding="utf-8"?> > <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009" > xmlns:js="library://ns.apache.org/royale/basic"> > > <fx:Script><![CDATA[ > import org.apache.flex.events.IEventDispatcher; > > public function blankimage():void { > image.visible = false; > image.src = > "https://www.apache.org/foundation/press/kit/poweredBy/Apache_PoweredBy.png"; > } > public function showImage():void { > image.visible = true; > } > ]]></fx:Script> > > <js:valuesImpl> > <js:SimpleCSSValuesImpl/> > </js:valuesImpl> > > <js:initialView> > > <js:View> > <js:Container id="startPage" visible="true" width="100%"> > <js:beads> > <js:VerticalLayout /> > </js:beads> > <js:Image id="image" > src="https://www.apache.org/foundation/press/kit/asf_logo_url.png" > width="50%" height="50%" layoutNeeded="showImage()" /> > <js:TextButton text="Blank" click="blankimage()" /> > </js:Container> > </js:View> > </js:initialView> > > </js:Application> > ``` > > With this error: > ``` > /Users/justinmclean/IdeaProjects/FlexJSTest/src/ImageBlank.mxml(26): col: > 130 This attribute is unexpected. It will be ignored. > > <js:Image id="image" > src="https://www.apache.org/foundation/press/kit/asf_logo_url.png" > width="50%" height="50%" layoutNeeded="showImage()" /> > ``` > > I assume the only way to do this would be to add a hard coded event > listener manually like so? > > ``` > <fx:Script><![CDATA[ > public function blankimage():void { > image.visible = false; > image.src = > "https://www.apache.org/foundation/press/kit/poweredBy/Apache_PoweredBy.png"; > image.addEventListener("layoutNeeded", showImage); > } > > public function showImage(event:Event):void { > image.visible = true; > } > ]]></fx:Script> > ``` > > > ---------------------------------------------------------------- > This is an automated message from the Apache Git Service. > To respond to the message, please log on GitHub and use the > URL above to go to the specific comment. > > For queries about this service, please contact Infrastructure at: > us...@infra.apache.org > > > With regards, > Apache Git Services