On Wed, Sep 11, 2013 at 10:58 AM, Alex Harui <aha...@adobe.com> wrote:

> Maybe, or in FlexJS, where we don't try to make a one-size-fits-all
> component, there will be a separate component called EmbeddedImage.


I had a usecase in the past where I grab an bitmap data from the hard disk
and while it is uploading in the background, I show that bitmap in an Image
component.  And when the upload was finished, I would swap it out with the
downloaded(processed) image from the server.  Swapping an EmbeddedImage
component with an Image component would result in more unnecessary object
creations and destructions.


> FWIW, most usage of embedded images in Flex via Image/SWFLoader was a
> waste of
> memory.  A much lighterweight class is possible.  For FlexJS, embedded
> images on the AS side should not require much wrapping if at all, but then
> I think that makes your app un-portable to JS.
>

Totally agree.  Which is why proposed this change on the IImageModel and
not Image.  This way, we can create an EmbeddedOrRemoteImage component
without having to create a new model.

Also, on the JS side, this change is moot because you can pass in a string
or an object or whatever.  That will need to be taken care of in the setter
on the javascript version.

Thanks,
Om


>
> On 9/11/13 10:53 AM, "OmPrakash Muppirala" <bigosma...@gmail.com> wrote:
>
> >IImageModel should perhaps define the getter/setter for sources as:
> >
> >function get source():Object;
> >function set source(value:Object):void;
> >
> >instead of:
> >
> >function get source():String;
> >function set source(value:String):void;
> >
> >In the Flash based implementation, we need to have the option of setting a
> >bitmap object as source as well.  I dont think that is possible with HTML,
> >though.  But keeping it generic would be beneficial for sure.
> >
> >Thanks,
> >Om
> >
> >
> >On Wed, Sep 11, 2013 at 8:48 AM, <p...@apache.org> wrote:
> >
> >> Updated Branches:
> >>   refs/heads/develop a1f8929b3 -> 426c2e1eb
> >>
> >>
> >> Changed property name from "url" to "source" to be compatible with Flex
> >> and HTML.
> >>
> >>
> >> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> >> Commit:
> http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/426c2e1e
> >> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/426c2e1e
> >> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/426c2e1e
> >>
> >> Branch: refs/heads/develop
> >> Commit: 426c2e1ebc17fc271b34aa856c2cfe6423240c4d
> >> Parents: a1f8929
> >> Author: Peter Ent <p...@apache.org>
> >> Authored: Wed Sep 11 11:48:06 2013 -0400
> >> Committer: Peter Ent <p...@apache.org>
> >> Committed: Wed Sep 11 11:48:06 2013 -0400
> >>
> >> ----------------------------------------------------------------------
> >>  frameworks/as/src/org/apache/flex/core/IImageModel.as   |  4 ++--
> >>  .../as/src/org/apache/flex/html/staticControls/Image.as |  8 ++++----
> >>  .../apache/flex/html/staticControls/beads/ImageView.as  |  2 +-
> >>  .../flex/html/staticControls/beads/models/ImageModel.as | 12
> >>++++++------
> >>  4 files changed, 13 insertions(+), 13 deletions(-)
> >> ----------------------------------------------------------------------
> >>
> >>
> >>
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426c2e1e/frameworks
> >>/as/src/org/apache/flex/core/IImageModel.as
> >> ----------------------------------------------------------------------
> >> diff --git a/frameworks/as/src/org/apache/flex/core/IImageModel.as
> >> b/frameworks/as/src/org/apache/flex/core/IImageModel.as
> >> index 07dfd56..dc924eb 100644
> >> --- a/frameworks/as/src/org/apache/flex/core/IImageModel.as
> >> +++ b/frameworks/as/src/org/apache/flex/core/IImageModel.as
> >> @@ -22,7 +22,7 @@ package org.apache.flex.core
> >>
> >>         public interface IImageModel extends IEventDispatcher,
> >>IBeadModel
> >>         {
> >> -               function get url():String;
> >> -               function set url(value:String):void;
> >> +               function get source():String;
> >> +               function set source(value:String):void;
> >>         }
> >>  }
> >> \ No newline at end of file
> >>
> >>
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426c2e1e/frameworks
> >>/as/src/org/apache/flex/html/staticControls/Image.as
> >> ----------------------------------------------------------------------
> >> diff --git
> >> a/frameworks/as/src/org/apache/flex/html/staticControls/Image.as
> >> b/frameworks/as/src/org/apache/flex/html/staticControls/Image.as
> >> index 297e847..eebfe40 100644
> >> --- a/frameworks/as/src/org/apache/flex/html/staticControls/Image.as
> >> +++ b/frameworks/as/src/org/apache/flex/html/staticControls/Image.as
> >> @@ -28,14 +28,14 @@ package org.apache.flex.html.staticControls
> >>                         super();
> >>                 }
> >>
> >> -               public function get url():String
> >> +               public function get source():String
> >>                 {
> >> -                       return IImageModel(model).url;
> >> +                       return IImageModel(model).source;
> >>                 }
> >>
> >> -               public function set url(value:String):void
> >> +               public function set source(value:String):void
> >>                 {
> >> -                       IImageModel(model).url = value;
> >> +                       IImageModel(model).source = value;
> >>                 }
> >>         }
> >>  }
> >> \ No newline at end of file
> >>
> >>
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426c2e1e/frameworks
> >>/as/src/org/apache/flex/html/staticControls/beads/ImageView.as
> >> ----------------------------------------------------------------------
> >> diff --git
> >>
> >>a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ImageView.a
> >>s
> >>
> >>b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ImageView.a
> >>s
> >> index 2fed3e6..bcb6044 100644
> >> ---
> >>
> >>a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ImageView.a
> >>s
> >> +++
> >>
> >>b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ImageView.a
> >>s
> >> @@ -59,7 +59,7 @@ package org.apache.flex.html.staticControls.beads
> >>                 {
> >>                         loader = new Loader();
> >>
> >> loader.contentLoaderInfo.addEventListener("complete",onComplete);
> >> -                       loader.load(new URLRequest(_model.url));
> >> +                       loader.load(new URLRequest(_model.source));
> >>                 }
> >>
> >>                 private function onComplete(event:Object):void
> >>
> >>
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/426c2e1e/frameworks
> >>/as/src/org/apache/flex/html/staticControls/beads/models/ImageModel.as
> >> ----------------------------------------------------------------------
> >> diff --git
> >>
> >>a/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/Imag
> >>eModel.as
> >>
> >>b/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/Imag
> >>eModel.as
> >> index e5821f8..c6e3e80 100644
> >> ---
> >>
> >>a/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/Imag
> >>eModel.as
> >> +++
> >>
> >>b/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/Imag
> >>eModel.as
> >> @@ -37,15 +37,15 @@ package
> >> org.apache.flex.html.staticControls.beads.models
> >>                         _strand = value;
> >>                 }
> >>
> >> -               private var _url:String;
> >> -               public function get url():String
> >> +               private var _source:String;
> >> +               public function get source():String
> >>                 {
> >> -                       return _url;
> >> +                       return _source;
> >>                 }
> >> -               public function set url(value:String):void
> >> +               public function set source(value:String):void
> >>                 {
> >> -                       if (value != _url) {
> >> -                               _url = value;
> >> +                       if (value != _source) {
> >> +                               _source = value;
> >>                                 dispatchEvent( new Event("urlChanged")
> >>);
> >>                         }
> >>                 }
> >>
> >>
>
>

Reply via email to