我正在关注这篇文章,其中有一个非常简单的代码,可以从flex应用程序发布推文。
http://rjdesignz.com/adobe-flex/twitter-api-in-air-mobile-app/
这适用于AIR Mobile App,但我在Flex中制作AIR WindowedApplication,上面的帖子依赖于以下外部库:
1)AS3 oAuth Library http://code.google.com/p/oauth-as3
2)AS3 Crypto https://code.google.com/p/as3crypto/
以下是代码:
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();
对于所有变量我收到以下错误,因此我无法编译我的代码:
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.
如何解决此编译时常量问题?
答案 0 :(得分:0)
Alhamdulillah,我从adobe文档中找到了我遗漏的地方。这就是:
Error 1046
用作类型声明的类要么是未知的,要么是在运行时可能具有不同值的表达式。检查您是否正在导入正确的类,并且其包位置未更改。另外,请检查是否正确定义了包含代码(而不是导入的类)的包(例如,确保使用正确的ActionScript 3.0包语法,而不是ActionScript 2.0语法)。如果引用的类未在正在使用的名称空间中定义或未定义为public,则也会发生错误:
public class Foo{}