Hi,

thanks for the dissection :)
could be possible to handle errors with a throw-catch block to avoid
browser errors and have control over it?
I think you have almost all right?
thanks


El dom., 28 jun. 2020 a las 19:18, Maria Jose Esteve (<[email protected]>)
escribió:

> These are the test results:
>
> - Inject HTML
> The error event is dispatched in all three cases: "", null or "not found".
> The images displayed are as expected.
>
> - Jewel Image / Basic Image control, with the ErrorImage bead
> The error event is received only with "not found".
> The expected image is displayed if it does not exist but if it is "" or
> null, it does not update it and shows the last source displayed.
> (This is the case we are reviewing)
>
> In summary, we did not receive the error event, in the bead, because the
> source is not really being changed (in HTML the source is always assigned
> and therefore the error event always occurs), therefore the ErrorImage bead
> does not work for us .
>
> Viewing the test result confirms that if we don't want to change
> ImageViewBase.as, I think Carlos's second option (create a
> RemoveImageFromDisplay bead) would be the way to go.
>
> When an image is still, the scenarios are only two: The image exists and
> there are no problems, or the image is not found, the error occurs and the
> alternative image is loaded. This need is covered.
>
> When an image is dynamic and the developer does not control the value to
> be assigned, the scenarios are duplicated:
> 1.- Specific image, source is found (ok)
> 2.- Specific image, source is not found (with the bead ErrorImage, ok)
> 3.- No image, source "" / null:
>         3.1.- It may be necessary to "show an alternative image" (for
> example, an image indicating that a source must be added)
>         In this case, we shouldn't remove the DOM element.
>         3.2.- or not show any.
>         In this case, the DOM element could be removed.
>
> I will read your comments.
>
> Hiedra.
>
> -----Mensaje original-----
> De: Maria Jose Esteve <[email protected]>
> Enviado el: domingo, 28 de junio de 2020 18:00
> Para: [email protected]
> Asunto: RE: Image, does not flush when link value is null or blank
>
> Hello,
> When I tried it I also noticed the error but I did not understand it
> because the Image control had the ErrorImage bead.
>
> I am checking the operation with the old html injected because the onerror
> did jump with white or null.
> I tell you what I see.
>
> hiedra
>
> -----Mensaje original-----
> De: Carlos Rovira <[email protected]> Enviado el: domingo, 28 de
> junio de 2020 10:41
> Para: Apache Royale Development <[email protected]>
> Asunto: Re: Image, does not flush when link value is null or blank
>
> Hi,
>
> I'm checking it, and I found that setting src to null makes the browser
> throw an error: Failed to load resource: net::ERR_FILE_NOT_FOUND (also
> tried to set to '' but it didn't change anything)
>
> so that doesn't seem the solution Royale should do by default, since apps
> will be getting lots of errors in browsers console.
>
> Searching on the internet people use to remove the image from the DOM or
> remove from display, I think we can do that. What do others think about it?
>
> Also since we are adding ErrorImage.as bead, we can manage it there. So a
> normal image control only can load an image.
> If people want to set it to null or empty string and remove it add
> ErrorImage bead and display the alternative image.
> Also we could have another "RemoveImageFromDisplay" and
> "RemoveImageFromDOM" bead that instead of add alternative image will remove
> from DOM or display or DOM respectively.
>
> thoughts?
>
>
>
>
> El sáb., 27 jun. 2020 a las 18:10, Maria Jose Esteve (<[email protected]>)
> escribió:
>
> > Do you get the attached screens? I don't see them ...
> > I'm sorry, I put it in text:
> >
> > De: Maria Jose Esteve <[email protected]<mailto:[email protected]>>
> > Enviado el: sábado, 27 de junio de 2020 15:00
> > Para: [email protected]<mailto:[email protected]>
> > Asunto: Image, does not flush when link value is null or blank
> >
> > Hi,
> > Setting up a detail form, where I have a jewel image component, I have
> > noticed that when a "" (empty string) or null is assigned to the src
> > property, the image is not emptied..
> > I have detected the origin of the problem and I present a possible
> > solution, to see how you see it.
> >
> > When the url / src is "" or null it does not enter through the if
> > (_model.url) and consequently it does not call applyImageDate and the
> > img is not updated:
> >
> > [ImageViewBase.as]
> >
> >         protected function handleUrlChange(event:Event):void
> >         {
> >             COMPILE::SWF
> >             {
> >                 if (_model.url) {
> >                     setupLoader();
> >                     loader.load(new URLRequest(_model.url));
> >                 }
> >             }
> >             COMPILE::JS
> >             {
> >                 if (_model.url) {
> >                     setupLoader();
> >                     (host as IImage).applyImageData(_model.url);
> >                 }
> >             }
> >         }
> >
> >
> > [jewel.Image.as]
> >
> >         /**
> >          * @royaleignorecoercion HTMLImageElement
> >          */
> >         COMPILE::JS
> >         override public function
> > applyImageData(binaryDataAsString:String):void
> >         {
> >             (element as HTMLImageElement).src = binaryDataAsString;
> >         }
> >     }
> >
> > If when the url is "" or null we directly call the applyImageData
> > function everything works perfectly (commented lines //)
> >
> >  }else if(sw == 1){
> >                 //avatarTmp.applyImageData("");
> >                 lblStep.text = "Blanco";
> >                 avatarTmp.src = "";
> >             }else if(sw == 2){
> >                 //avatarTmp.applyImageData(null);
> >                 lblStep.text = "Null";
> >                 avatarTmp.src = null;
> >
> >
> > If in ImageViewBase.as we changed the code:
> >
> >         protected function handleUrlChange(event:Event):void
> >         {
> >             COMPILE::SWF
> >             {
> >                 if (_model.url) {
> >                     setupLoader();
> >                     loader.load(new URLRequest(_model.url));
> >                 }
> >             }
> >             COMPILE::JS
> >             {
> >                 if (_model.url) {
> >                     setupLoader();
> >                     (host as IImage).applyImageData(_model.url);
> >                 }
> >             }
> >         }
> >
> > For this other, It would be correct?
> >
> >             COMPILE::JS
> >             {
> >                 if (_model.url)
> >                     setupLoader();
> >                 (host as IImage).applyImageData(_model.url);
> >
> >             }
> >
> > I haven't tested it for SWC but I think it might be feasible too. (In
> > my Flex application it works when I assign a null if it empties the
> > image) As you see?
> >
> > Hiedra.
> >
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Reply via email to