10/6/2010 6:48:19 AM
Title:
Air-cairngorm With Flex4
Hello All,
I am using Air-cairngorm With Flex, and i am facing some problem here, i used this type of code in flex3 but the same code is not working in flex4.
i am facing the fallowing problem.
1.In my "SQLStatementConfiguration.as" i got error
"Call to a possibly undefined method getResourceBundle through a reference with static type Class"
2.Might be the problem with fallowing code in "SQLStatementConfiguration.as".
[ResourceBundle('sql')]
private static const resource:ResourceBundle;
Can any one solve my problem ?
Thanks in advance
10/7/2010 12:19:50 AM
just spesify your resource bundles in project properties-> Flex Compiler put this lines to additional compiler: -locale=en_US,ja_JP -source-path=locale/{locale}
10/7/2010 1:54:25 AM
can any one suggest the solution. plz
10/7/2010 2:56:53 AM
i think you need to configure your resource bundle in flex , see these article for more details about using resource bundle in flex
http://www.visible-form.com/blog/flex-localization-with-resource-bundles/
http://www.deitte.com/archives/2006/10/using_resource.htm
10/7/2010 3:52:02 AM
Thank i use this code, still i did not got solution can any one solve my problem
package rws.cairngorm.langomax.business
{
import mx.resources.IResourceBundle;
import mx.resources.IResourceManager;
import mx.resources.ResourceBundle;
import mx.resources.ResourceManager;
public class SQLStatementConfiguration
{
[ResourceBundle('sql')]
private static const resource:ResourceBundle;
private static const rm:IResourceManager = ResourceManager.getInstance();
public static const CREATE_TABLE:String = ResourceManager.getInstance().getString("sql", "CREATE_TABLE1");
public static const GETALLUSERS:String = ResourceManager.getInstance().getString("sql", "GETALLUSERS");
public static const INSERT:String = ResourceManager.getInstance().getString("sql","INSERT");
public static const LOGINUSER:String = ResourceManager.getInstance().getString("sql","LOGINUSER");
public static const UPCOMINGWORDS:String = ResourceManager.getInstance().getString("sql","UPCOMINGWORDS");
}
}
12/9/2010 7:34:50 AM
1.Remove your Services and Controller from main.mxml
<!--
<business:Services id="services" />
<control:Controller id="controller" />
-->
then add these three as in business folder
12/9/2010 7:35:17 AM
package cairngorm.business
{
import com.adobe.cairngorm.CairngormError;
import com.adobe.cairngorm.CairngormMessageCodes;
import com.ericfeminella.air.cairngorm.business.SQLService;
import flash.filesystem.File;
import mx.controls.Alert;
import mx.states.OverrideBase;
public class MySQLService extends SQLService
{
private static var instance:MySQLService;
private const DBFile:String="users.db";
public function MySQLService()
{
super();
if ( instance != null )
{
throw new CairngormError( CairngormMessageCodes.SINGLETON_EXCEPTION , "MySQLService" );
}
instance = this;
init();
this.openAsync();
}
public static function getInstance() : MySQLService
{
if (instance == null)
{
instance = new MySQLService();
}
return instance;
}
private function init():void
{
var dbFileTest:File = File.applicationDirectory.resolvePath("users.db");
var dbWorkedFile:File = File.applicationStorageDirectory.resolvePath("users.db");
if(!dbWorkedFile.exists)
{
dbFileTest.copyTo(dbWorkedFile);
}
this.databaseFileName=DBFile;
//this.databaseFilePath=File.documentsDirectory.nativePath;
this.databaseFilePath=File.applicationStorageDirectory.nativePath;
//Alert.show(""+File.applicationStorageDirectory.nativePath);
}
}
}
12/9/2010 7:37:07 AM
public class SQLStatementConfiguration
{
public static const CREATE_TABLE:String = "CREATE TABLE users(first_name VARCHAR(30),last_name VARCHAR(30),password VARCHAR(30),email VARCHAR(30),profile VARCHAR(30),dob DATE)"
public static const GETALLUSERS:String = "select * from users where status=1";
}
------------------------
public class UserServiceDelegate
{
protected var responder:ISQLResponder;
private var sql:MySQLService=MySQLService.getInstance();
private var myservice:SQLService;
public function UserServiceDelegate(responder:ISQLResponder)
{
this.responder=responder;
//myservice=sql.getSQLService();
//this.sql= AIRServiceLocator.getInstance().getSQLService(Services.USERS_SERVICE);
}
protected function execute(statement:String) :void
{
//sql.openAsync();
sql.executeAsync( statement, responder );
}
}
}
12/9/2010 7:37:57 AM
You can try with this code ....this will having some problem but you can update and apply
1/9/2012 7:57:44 AM
Hi,
I am getting a same problem, can you help me in this?
Thanks