flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Ent <p...@adobe.com>
Subject Re: git commit: [flex-asjs] [refs/heads/develop] - Changed property name from "url" to "source" to be compatible with Flex and HTML.
Date Wed, 11 Sep 2013 18:41:54 GMT
I started with the source being Object but then I realized it might not
make any sense on the JavaScript side so I made it a String. If someone
wanted to load in a SWF, it would make the app unusable on the JavaScript
side, so I would think they would change the beads or there would be a
Flash-specific component for that.

Peter

On 9/11/13 2:21 PM, "Alex Harui" <aharui@adobe.com> wrote:

>
>
>On 9/11/13 11:08 AM, "OmPrakash Muppirala" <bigosmallm@gmail.com> wrote:
>
>>On Wed, Sep 11, 2013 at 10:58 AM, Alex Harui <aharui@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.
>A completely valid scenario, but, keeping with the pay-as-you-go
>philosophy of FlexJS, you would create a custom component like the
>EmbeddedOrRemoteImage you mention below, but it doesn't have to use the
>same model.  I'm not clear the cost of having a different model is such
>that FlexJS should give up type-checking for the 80% case, especially
>because when migrating old Flex code, we should make it clear that this
>simple FlexJS image component only knows about urls and that embeds are
>probably better handled some other way (not sure what that way is just
>yet).
> 
>>
>>
>>> 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.
>I was thinking the embedded image component (if we even have one since
>these object might just get "new"-ed and addChild'd) would have a model
>where the source is of type bitmapData or bytearay.  And this
>EmbeddedOrRemoteImage component would have a different model with both an
>embeddedSource and remoteSource properties.  But that's just a first
>guess.
>
>>
>>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.
>I'm not sure I understand your point.  Yes, there is no type-checking in
>JS, but in FlexJS folks aren't writing JS code directly so the only thing
>that should be passed in is the URL that got cross-compiled.
>
>>
>>Thanks,
>>Om
>>
>>
>>>
>>> On 9/11/13 10:53 AM, "OmPrakash Muppirala" <bigosmallm@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, <pent@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 <pent@apache.org>
>>> >> Authored: Wed Sep 11 11:48:06 2013 -0400
>>> >> Committer: Peter Ent <pent@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/framework
>>>s
>>> >>/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/framework
>>>s
>>> >>/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/framework
>>>s
>>> >>/as/src/org/apache/flex/html/staticControls/beads/ImageView.as
>>> >> 
>>>----------------------------------------------------------------------
>>> >> diff --git
>>> >>
>>> 
>>>>>a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ImageVie
>>>>>w
>>>>>.a
>>> >>s
>>> >>
>>> 
>>>>>b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ImageVie
>>>>>w
>>>>>.a
>>> >>s
>>> >> index 2fed3e6..bcb6044 100644
>>> >> ---
>>> >>
>>> 
>>>>>a/frameworks/as/src/org/apache/flex/html/staticControls/beads/ImageVie
>>>>>w
>>>>>.a
>>> >>s
>>> >> +++
>>> >>
>>> 
>>>>>b/frameworks/as/src/org/apache/flex/html/staticControls/beads/ImageVie
>>>>>w
>>>>>.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/framework
>>>s
>>> 
>>>>>/as/src/org/apache/flex/html/staticControls/beads/models/ImageModel.as
>>> >> 
>>>----------------------------------------------------------------------
>>> >> diff --git
>>> >>
>>> 
>>>>>a/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/I
>>>>>m
>>>>>ag
>>> >>eModel.as
>>> >>
>>> 
>>>>>b/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/I
>>>>>m
>>>>>ag
>>> >>eModel.as
>>> >> index e5821f8..c6e3e80 100644
>>> >> ---
>>> >>
>>> 
>>>>>a/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/I
>>>>>m
>>>>>ag
>>> >>eModel.as
>>> >> +++
>>> >>
>>> 
>>>>>b/frameworks/as/src/org/apache/flex/html/staticControls/beads/models/I
>>>>>m
>>>>>ag
>>> >>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")
>>> >>);
>>> >>                         }
>>> >>                 }
>>> >>
>>> >>
>>>
>>>
>


Mime
View raw message