Topic: RSS Reader Image Resizing

Hello!
I was trying to use the RSS reader as... well an RSS reader.
However, most of the images are too large, and I was wondering if anyone knew some actionscript to fix it. I have tried a lot, but when I do, the image never appears.


If anyone is curious, I wrote a little thing to separate the image from the body on most RSS feeds, where the image is part of the description.


function GetImage(des){
   
    var del:Array ;
    del = des.split('<img src="');
    des = del[1];
    var img:Array;
    img = des.split('"/>');
    var image:String;
    image = img[0];
    return(image);
}
function GetDes(ddd){
   
   
    thing = ddd.toString();
    var del1:Array;
    del1 = thing.split('.jpg"/>');
    var des2:String;
    des2 = del1[1];
    var img1:Array;
    img1 = des2.split("<br/>");  //change <br/> to something at the end.
    var image1:String;
    image1 = img1[0];
    return(image1);
}



I used some weird variables. GetImage gets the URL, GetDes gets the description content.

Re: RSS Reader Image Resizing

There are a couple of techniques for this:

1) have an onEnterFrame handler that monitors the size of the movieclip into which the image is being loaded which scales the image to fit if it's not already.  One must be careful with FlashLite -  I've noticed that occasionally the _width and _height properties on a loaded clip can appear at different times.

2) if you know the size of the image in advance (say, from an img tag), create a movieclip of the same dimensions, scale it, then load the image into it.  Unlike most other properties, the _xscale and _yscale properties survive loads.

I'll see if I can dig up some example code to help with this.

Re: RSS Reader Image Resizing

Thanks. I don't know the size of the images, as they can be nearly anything.

And I have tried just saying:


but that doesn't work, because the image never appears.

And I also have tried just:
proxy._width = 80;
proxy._height = 60;

Re: RSS Reader Image Resizing

Hi Zachinme...When you get this "thing" working please add it to the chumby wiki...Thanks!

Re: RSS Reader Image Resizing

Sure!
This RSS reader I am using is designed to use a specific site's RSS feed, and it is designed off of its specific "quarks".
I don't know how this would do in the wiki, as it isn't much different than the listed RSS reader.
I was also doing this alongside the site's developer, so I was able to add the necessary crossdomain.xml file.

I would be glad, however, to add in a polished version of GetImage and GetDescription commented out on the .fla file :-)

Re: RSS Reader Image Resizing

zachninme wrote:

And I also have tried just:
proxy._width = 80;
proxy._height = 60;

Right, because those properties don't survive the image being loaded - the _width and _height become the size of the loaded movie.  You *could* put an onEnterFrame handler on the proxy's parent movie that sets the values every frame if they're different.

7 (edited by zachninme 2006-12-21 14:12:19)

Re: RSS Reader Image Resizing

For all curious:


onClipEvent(data){
   if (this._width!=80)
    this._width = 80;
   if (this._height!=60)
         this_height = 60;
}

Under the proxy instance should do the trick smile


Edit: Duane provided the if... statements to save processing power. Thanks Duane!