Skip to main content
Inspiring
September 16, 2008
Question

Need Help Loading RSS pics

  • September 16, 2008
  • 7 replies
  • 1390 views
I have an RSS feed parsed and displaying text into 5 Dynamic Text Fields on my stage. Now I want to display the jpeg images from the RSS feed into MovieClip instances on my stage. I have named my MovieClip instances picHoldera, picHolderb, etc. How do I define and load that information in AS3? Here is my AS 3 code, and the RSS feed string;


This topic has been closed for replies.

7 replies

Participating Frequently
September 17, 2008
If you made the borders movieclips you could scale them as needed from your code. Just a thought.

Another thought is you may want to consider looking into Flex and FlexBuilder in the future when you have time. Some of this stuff might be easier to implement using those.
Participating Frequently
September 17, 2008
Draw the border on stage and line it up behind the UILoader?
GumpsterFAuthor
Inspiring
September 17, 2008
I wish I could border them like that but the pics come in at different sizes so I have to use a percentage to get them close. That is why I originally wanted to import the jpgs into existing movieclips and size them to fit and center them. But I will live with what I have. Cheers!
Participating Frequently
September 17, 2008
Setting x and y for aLoader:
aLoader.x = 10;
aLoader.y = 10;

A good way to learn AS 3 and to know what objects do and what properties you can set is to check out the language reference: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/

I have that open all the time.

GumpsterFAuthor
Inspiring
September 17, 2008
Yes JP, thanks.
That is what I used to find out how to set the X and Y properties.
AS3 is not very intuitive, but I am starting to understand it a little bit.
Thanks so much for your guidance and patience, I really appreciate it'
Forrest
GumpsterFAuthor
Inspiring
September 16, 2008
OK I replaced the code I had with the UILoader component. Still no ability to scale and place the image where I want and nowhere to add a border that IU can see. I read all the info from the link you sent me. Here is my new code;

Participating Frequently
September 16, 2008
Maybe try setting the width and the height of the UILoader?
GumpsterFAuthor
Inspiring
September 17, 2008
OK never mind JP I solved that one. Grasshopper is learning. :)
I just have to change the instance name of the ULLoader for the next 4 pics. Seems like lots of code.
Now I just need to get a border around the thing and I am happy. I will look for that too. :)
(Unless you have some words of wisdom.)
Here is the latest code.

Participating Frequently
September 16, 2008
GumpsterFAuthor
Inspiring
September 16, 2008
OK, I made an instance of a UILoader on the stage and called it "picLoadera"

And I adjusted my code to;
import flash.display.Loader;

var loadera:Loader = new Loader();
loadera.load(new URLRequest(xml.channel.item.enclosure[0].@url));
picLoadera.addChild(loadera);

It does exactly the same thing except it comes in at the 0,0 point now. It says that by default it is supposed to scale to the size of the UILoader but it is not doing that.
Participating Frequently
September 16, 2008
From the xml you get urls to the jpgs. You need to load the jpgs from those urls. You will most likely do this with a Loader object.

So, something like this:

var loader:Loader = new Loader();
loader.load(new URLRequest(xml.channel.item.enclosure[0]);
// you can addChild a Loader because it descends from DisplayObject
picHoldera.addChild(loader);

note: you will need to import the loader class:
import flash.display.Loader;
GumpsterFAuthor
Inspiring
September 16, 2008
Thank JP, I was actually already there when you answered, but that does not work either.
I get this error message; Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
I have been doing some web searching about the "enclosure url" nodes. Have not found anyone so far who has figured out how to access that node. Nothing I have tried so far will.
enclosure:url
enclosure@url
GumpsterFAuthor
Inspiring
September 16, 2008
I tried adding the line of code; "picHoldera.addChild(xml.channel.item.enclosure[0]);"
And I got this error message;
TypeError: Error #1034: Type Coercion failed: cannot convert XML@28d85ee1 element <enclosure url=" http://media.canada.com/395bd2ba-75fc-451e-b76b-69e0b3295a9f/1demo.jpg" type="image/jpeg"/> to flash.display.DisplayObject.