Can't we implement the url as well as the binary image using css? For examle a url source: <img width="16" height="16" alt="star" src="image/star.png" />
For example a binary source: <img width="16" height="16" alt="star" src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" /> Both are named source and a UrlSource would be identical to the url and a BinarySource would be the base64 encoded presentation. I can't see how there should be problems with mapping this to Flash Chris -----Ursprüngliche Nachricht----- Von: Alex Harui [mailto:[email protected]] Gesendet: Montag, 8. August 2016 17:56 An: [email protected] Betreff: Re: FlexJS Image.source On 8/8/16, 8:32 AM, "Harbs" <[email protected]> wrote: >How do I do that without ending up with double code in my app? If one >part of the app uses Image and another uses ImageWithBlob, that’s going >to duplicate about 600 lines of code. Why wouldn't all of your code use ImageWithBlob? Also, why wouldn't ImageWithBlob subclass Image to share most of that code, and ImageViewWithBlob subclass ImageView? I should point out that, with beads, the outer component is really supposed to be a shell or wrapper. An exercise Peter and I try to do when creating new components is to make sure they are truly aggregations. IOW, <js:Image source="foo.png" /> Which loads ImageModel and ImageView by default, should be replaceable in your MXML with <js:UIBase> <js:beads> <js:ImageModel source="foo.png" /> <js:ImageView /> </js:beads> </js:UIBase> All Image does is subclass UIBase and proxy the model's source property to the component's API surface. It sounds like in your app, you want one single Image component that takes a url or binary blob. We can't overload the source property right now, so you'll have to use a different property name like "binary", but essentially I think you want to allow: <js:UIBase> <js:beads> <js:ImageModelWithBlob binary="bunchofbytes" /> <js:ImageViewWithBlob /> </js:beads> </js:UIBase> Or even: <js:Image> <js:beads> <js:ImageModelWithBlob binary="bunchofbytes" /> <js:ImageViewWithBlob /> </js:beads> </js:Image> And then you could aggregate the last pattern by having ImageWithBlob subclass Image and proxy the binary property and maybe add a src property that switches between source and binary. That's why I would expect ImageModelWithBlob could subclass ImageModel and ImageViewWithBlog could subclass ImageView and only add support for "binary". FWIW, I used the property name "source" for Image because Flex did, and I don't like using abbreviations like "src" like the <img/> tag does, but if folks would rather use "src" or "url" for the String source and "source" as an Object that can take Blob or String, that's fine with me. -Alex
