Skip to main content
Known Participant
November 27, 2012
Question

air for ios / android feeds

  • November 27, 2012
  • 1 reply
  • 1316 views

ive saw this on adobe site

http://cookbooks.adobe.com/post_Integrating_an_RSS_feed_into_an_Adobe_AIR_applicat-17926.html

i put the code into a frame , and removed the public tags for a package .

then compiled  and the erorr appeard to me is this

Scene 1, Layer 'Actions', Frame 6, Line 151046: Type was not found or was not a compile-time constant: ResultEvent.

this the whole code added into android project

function getFeed()

{

var service:mx.rpc.http.HTTPService = new mx.rpc.http.HTTPService();

   feedURL = "http://ameerw.com/feed/";

   service.method = "POST";

                  service.contentType = "application/x-www-form-urlencoded";

                  service.resultFormat = "e4x";

                 

        service.requestTimeout = 48;

                     service.send(feedUrl);

                     service.addEventListener(ResultEvent.RESULT, this.feedPosts);

}

 

// Then create the function that will manage the response:

function feedPosts(e:ResultEvent)

{

  var result:XML = e.result as XML; 

              // assign the items you want, to the component you want, below is sample 

   this.dataGrid = result.item;

}

on the feed url place ive tried all other possible options

such

//http etc

http etc with out //

This topic has been closed for replies.

1 reply

Legend
November 28, 2012

No mystery to that.

Essentially, the compiler needs to know where to find the ResultEvent class and you have clearly not provided that information. The cookbook probably had some import statements that you didn't copy in...

For example:

import mx.rpc.events.ResultEvent;

Place that at the top of your script and it should all work.

G

gus93222Author
Known Participant
November 28, 2012

same issue . this didnt fix it .

i added this

import mx.rpc.events.ResultEvent;

function getFeed()

{

var service:mx.rpc.http.HTTPService = new mx.rpc.http.HTTPService();

   feedURL = //your RSS url

   service.method = "POST";

                  service.contentType = "application/x-www-form-urlencoded";

                  service.resultFormat = "e4x";

                 

        service.requestTimeout = 48;

                     service.send(feedUrl);

                     service.addEventListener(ResultEvent.RESULT, this.feedPosts);

}

 

// Then create the function that will manage the response:

function feedPosts(e:ResultEvent)

{

  var result:XML = e.result as XML; 

              // assign the items you want, to the component you want, below is sample 

   this.dataGrid = result.item;

}

------

but i got  the same error message.

tip : the cookbook code is a package , might the problem be because i didnt use it as a package ?

Legend
November 29, 2012

Is this a pure AS project or a Flex one?

The error you are seeing (#1046: Type was not found or was not a compile-time constant: ResultEvent.) is always and only because the compiler cannot find a definition for the type ResultEvent. The import statement _would_ have worked if you had the class defined in mx.rpc.events package (as it is in my FB).

So...

If you are still seeing the error, it is probable that you haven't included the RPC package into your project (although, you should be seeing the error for mx.rpc.http.HTTPService as well).

Which means either:

a) You have the RPC library in your project but have put the import statement in the wrong place

b) You have not included the RPC library in your project at all

If this was a Flex project, the RPC stuff would (I think) be included automatically by default. If it is a pure AS project, you may need to add the .SWC file for RPC to your project manually. (I had a look and mine would be <program file>\Adobe\Adobe Flash Builder 4.6\sdks\<sdk version>\frameworks\projects\rpc\src\rpc.swc

G