0
votes

I am following this post which has a very simple code to post tweets from flex application.

http://rjdesignz.com/adobe-flex/twitter-api-in-air-mobile-app/

This is for AIR Mobile App but i am making AIR WindowedApplication in Flex, the above post is dependent on the following external libraries:

1) AS3 oAuth Library http://code.google.com/p/oauth-as3

2) AS3 Crypto https://code.google.com/p/as3crypto/

Here is the code:

import org.istashan.oauth.OAuthConsumer;
import org.istashan.oauth.OAuthRequest;
import org.istashan.oauth.OAuthSignatureMethod_HMAC_SHA1;
import org.istashan.oauth.OAuthToken;
import org.istashan.utils.OAuthUtil;

private var requestToken:OAuthToken;
private var accessToken:OAuthToken;
private var oAuthConsumer:OAuthConsumer;
private var accessRequest:OAuthRequest;
protected var signature:OAuthSignatureMethod_HMAC_SHA1 = new OAuthSignatureMethod_HMAC_SHA1();

for all the variables i am getting the following error and therefore i am unable to compile my code:

1046: Type was not found or was not a compile-time constant: OAuthConsumer.
1046: Type was not found or was not a compile-time constant: OAuthRequest.
1046: Type was not found or was not a compile-time constant: OAuthSignatureMethod_HMAC_SHA1.    
1046: Type was not found or was not a compile-time constant: OAuthToken.
1046: Type was not found or was not a compile-time constant: OAuthToken.

How can i resolve this compile-time constant issue?

1
Is the OAuth library .swc-file properly placed in the /libs/ folder in your Project path?Pete TNT
yes it is, and that is the reason it is not giving any hint at import line but on the variable line where i am creating the instancewakqasahmed
Are you using Flash Builder or similar IDE, does it give you the autofill for the variables if you type OAuth and press CTRL+Space? Did you compile the .swc yourself or was it pre-compiled (I do notice that oauth-as3-site doesn't have a pre-compiled option...)?Pete TNT
Ya it is showing me autofillwakqasahmed
I have download source and added all "AS" files in my project to use directly. Ya i am using Flash Builder IDEwakqasahmed

1 Answers

0
votes

Alhamdulillah, i found where i was missing from the adobe documentation. Here that is:

Error 1046

The class used as a type declaration is either unknown or is an expression that could have different values at run time. Check that you are importing the correct class and that its package location has not changed. Also, check that the package that contains the code (not the imported class) is defined correctly (for example, make sure to use proper ActionScript 3.0 package syntax, and not ActionScript 2.0 syntax). The error can also occur if the class being referenced is not defined in a namespace that is in use or is not defined as public:

public class Foo{}