Cairngorm - problem resulthandling

We use the Cairngorm framework in our Flex 2.0 App and now meet a problem related to the resulthandling. If I trace the result in the onResult handler in the command class, once the first time traces I call service, the second two times, three times third and so on. It could be related to the code that adds the event handler, but I'm not sure.

Any of you encounter the same problem, or maby see some errors in the code below?

Event class:

SerializableAttribute public class GetCategoriesEvent extends CairngormEvent
{
public void GetCategoriesEvent() {}
Super (GetCategoriesEvent.EVENT_GET_CATEGORIES);
}
public static var EVENT_GET_CATEGORIES:String = 'getCategories ';
}


Command class:

/ public class GetCategoriesCommand implements Command {responder
private var model: ModelLocator = ModelLocator.getInstance ();

public void execute (event: CairngormEvent): void {}

var delegate: GetCategoriesDelegate = new GetCategoriesDelegate (this);
var getCategoriesEvent: GetCategoriesEvent = GetCategoriesEvent (event);
delegate.getCategories ();
}

public function onResult (event: * = null): void {}
Application.application.trace ("onResult:" + event.result);
}

public function onFault (event: * = null): void {}
Application.application.trace ("onFault:" + event.result);
}
}



Delegate class:

public class GetCategoriesDelegate
{
private var responder: responder;
private var service: Object;

public void GetCategoriesDelegate (responder: responder)
{
This.service = ServiceLocator.getInstance () .getHTTPService ("getCategories") like HTTPService;
This.Responder = responder;
}

getCategories() public void: void {}
service.addEventListener (ResultEvent.RESULT, getCategories_onResult);
service.addEventListener (FaultEvent.FAULT, getCategories_onFault);
service. Send();
}

private function getCategories_onResult (event: ResultEvent): void {}
responder.onResult (event);
}

private function getCategories_onFault (event: ResultEvent): void {}
responder.onFault ();
}
}

Service:

"" < mx:HTTPService id = 'getCategories' url = ' http://localhost:9081 / saver/fondtilbud/action? action = list_verdipapir_kategorier '
showBusyCursor = "true".
useProxy = "false" / >

Hello

Do you want a new instance of GetCategoriesDelegate response to demand. It seems that you keep to add listeners to your service. Try

getCategories() public void: void {}
var token: AsyncToken = service.send ();
If (token! = null)
{
token.addResponder (responder);
}
}

Do your GetCategoriesCommand implements IResponder, and result and fault functions

William Chan

Tags: Adobe LiveCycle

Similar Questions

  • problem during build source cairngorm

    Hello

    I checked cairngorm SVN and try to build using Maven 3.0.3. But I have encountered these problems:

    1, mvn complaints that brought 'external' is not recognized. (see annex 1)

    cairngorm_1.png

    2, perhaps because point 1 above, the generation cannot resolve the dependencies and failed (see attachment 2)

    cairngorm_2.png

    3, in the libraries/pom.xml, the version of the flex sdk is still 4.1. How can I make it work with flexsdk 4.5.1?

    Can you help me understand how to compile the cairngorm3 correctly?

    Thank you!

    York

    you're referncing trunk? Trunk is here earlier:

    http://sourceforge.NET/Adobe/Cairngorm/code/827/tree/cairngorm3/trunk/

    You can use the web based SVN via the 'Code' button in the menu bar on SF or http://sourceforge.net/adobe/cairngorm/code/

    I don't see Flex 4.5 in the pom of high-level in the trunk.

    Popup library is available in different versions. Popup itself does not contain a reference to the parsley, but there is also a PopupParlsey version. This is really useful in the old version of parsley which are provided via the wiki because that in later versions of parsley, parsley added the tag PopUp that makes this obsolute.

    The distribution of parsley only made reference to Popup library non - parsley.

  • Cairngorm login authentication problem

    Hello

    Currently I am doing an application that allows a user to log on and according to their level of authorization, they may have full access to the application or have limited access.

    Currently I have implemented so that when the user submits their login information, I send an event that calls the order login and connection delegate validates the result, if successful, then it updates a variable called loginAccess in the model.

    In the main mxml, I put in place so that when loading first the currentState property is related to the loginAccess in the model, so when we connect and succeeds then the variable loginAccess is updated, which then updates the current state of the main application. It works fine, totally in function logout simple connection, but I need to present the viewer with something different based on their permission level - allowing the entire application to be accessible if you are an administrator and one that is destined to a comments user who can only see parts of the application.

    So what, in my opinion, would be the easiest is if the user is prompted, then I can hide or remove some controls and components like tabs, buttons and labels that are not allowed if the user is an administrator and do nothing are.

    This is my problem, I have no way to determine if a user is a guest or an admin at the point when the user first connects.

    In other words, if I do an if/else statement such as: If the user is prompted and then remove the 2nd child of the tab navigation, then I have no the case in my main application to call it, because if I call to creationComplete it is too early, the user has not connected...

    I am making sense here?

    I wonder if I can send some sort of an event of the LoginCommand once the authorization of the user is determined that will then trigger a function in the main mxml which will exercise a function to remove components (if they are a guest), but I don't know how to do this as when the user first connects the connection event is dispatched by the connection component and not the main mxml.

    I do not know if my approach is the best way or if there is a better way.

    Please if anyone has any suggestions that would be great,

    I created this application a few weeks ago completely in flex and am now converted to cairngorm as an exercise and everything is done except for this part.

    Thanks in advance for any help!

    Fuyuko

    public var openTasksComp:OpenTasks;

    his only declaring a variable, uninitialized.

    you have to match to your model by


  • Parameter problem library persistence using associations

    Hello

    I have recently begun to use the Cairngorm persistence library and ran into a problem with the settings sometimes doesn't work does not correctly when you are using associations.  I use the library of persistence 0.10, 3.5 Flex and AIR 2.0.

    The problem seems to be related to parameter names, and I was able to get around by renaming some of my settings.  I write about this here to try to determine the cause (and if it's a bug, hopefully get it fixed).

    Here's a simplified example where I see the problem.

    I create two classes, ObjectAssociatedWithPath and access path:

    package
    {
        public class Path
        {
            [Id]
            [Mapped]
            public var pathId:int;
    
            [Mapped]
            public var path:String = "C:/";
    
            public function Path()
            {
            }
        }
    }
    

    package
    {
        public class ObjectAssociatedWithPath
        {
            [Id]
            [Mapped]
            public var objectId:int;
    
            [Association]
            public var path:Path;
    
            public function ObjectAssociatedWithPath()
            {
            }
        }
    }
    

    In my SqlMap, I have statements to create and insert elements into an array of path and a table OBJECTASSOCIATEDWITHPATH:

    <grammar:Create id="createPathTable">
         CREATE TABLE IF NOT EXISTS PATH( PATHID INTEGER PRIMARY KEY, PATH TEXT )
    </grammar:Create>
    
    <grammar:Create id="createObjectAssociatedWithPathTable">
         CREATE TABLE IF NOT EXISTS OBJECTASSOCIATEDWITHPATH( OBJECTID INTEGER PRIMARY KEY, PATHID INTEGER )
    </grammar:Create>
    
    <grammar:Insert id="insertPath" type="{ Path }">
         INSERT INTO PATH ( PATH ) VALUES ( :path )
    </grammar:Insert>
    
    <grammar:Insert id="insertObjectAssociatedWithPath" type="{ ObjectAssociatedWithPath }">
         INSERT INTO OBJECTASSOCIATEDWITHPATH ( PATHID ) VALUES ( :pathId )
    </grammar:Insert>
    

    Finally, I have a function that creates the tables and inserts an object in each of them:

    private function parameterTest():void
    {
         var sqlSession:ISqlSession = persistenceClient.createSqlSession();
    
         sqlSession.beginTransaction();
    
         sqlSession.create("createPathTable", new CreateResponder(resultHandler, faultHandler));
         sqlSession.create("createObjectAssociatedWithPathTable", new CreateResponder(resultHandler, faultHandler));
    
         var path:Path = new Path();
         var objectAssociatedWithPath:ObjectAssociatedWithPath = new ObjectAssociatedWithPath();
         objectAssociatedWithPath.path = path;
    
         sqlSession.insertItem("insertPath", path, new InsertResponder(insertResultHandler, faultHandler));
         sqlSession.insertItem("insertObjectAssociatedWithPath", objectAssociatedWithPath, new InsertResponder(insertResultHandler, faultHandler));
    
         sqlSession.commitTransaction(new CommitTransactionResponder(resultHandler, faultHandler));
    }
    
    private function resultHandler():void
    {
    }
    
    private function insertResultHandler(rowId:Number, rowsAffected:Number):void
    {
    }
    
    private function faultHandler(error:SQLError):void
    {
         var errorMessage:String = "Message: " + error.message + "\nOperation: " + error.operation + "\nDetails: " + error.details;
         Alert.show(errorMessage);
    }
    

    When I run this function, I get the following error:

    Mismatch in parameter count. Found 1 in SQL specified and 2 value(s) set in parameters property.
    Expecting values for ':pathId'
    

    When attempting to execute the instruction at 'insertObjectAssociatedWithPath '.  If I rename "pathId' to 'thePathId' property, or specify a different setting for this property, i.e., name

            [Id]
            [Mapped(parameter="thePathId")]
            public var pathId:int;
    

    It seems to work correctly.

    For the association of the way, I think the constructor parameter to add pathId AND path to the settings property, even if I'm only using the pathId parameter.

    Anyone have any idea why this is happening?

    Thank you

    Jay

    This is caused by the hasNamedParameter @ NamedParameterBuilder function that checks for the existence of the already added parameters.

    You have already added the 'path' parameter in your mapping, unfortunatelly hasNamedParameter() checks if sqlStatement.text.indexOf (parameter) >-1

    and because *: pathId *.indexOf(":path") >-1 the pathId is omitted.

  • Cairngorm - ModuleViewLoader question?

    Hello

    Don't know if it's really a mistake...

    I use the following to insert a module into a MXML file

    < module: ModuleViewLoader width = "100%" height = "21".

    moduleManager = "{counterpartySearchModule}".

    skinClass = "com.adobe.cairngorm.module.ModuleViewLoaderSkin" > "

    < module: loadPolicy >

    < module: BasicLoadPolicy / >

    < / module: loadPolicy >

    < / module: ModuleViewLoader >

    While it works well... at first when the module is about to load... I get a text saying 'Landing' and then 'Loading'... "and I can not understand why.

    The module is basically a module of AutoComplete using AutoComplete of Hillel Coren library.

    It is a behavior of Cairngorm Modules or is it something I need to study with AutoComplete of Hillel Coren library?

    Thank you

    I solved my problem

    Landing and loading channels come from the ModuleViewLoaderSkin. If you do not want these you need to create your own.

  • Cairngorm 3 in Flex4

    Hello

    I'm new in flex4 and want to use an architectural setting. But there is confusion in using the framework.

    Can U please suggest me that I can use Cairngorm 3 in flex4. Is there no problem to use it.

    Or else should I have to go with parsley 2.2 only in flex4.

    Or parsley 2.3.1 and Cairngorm 3 (combination)

    What is the best...

    Thanks and greetings

    Hello

    Please click the link: http://rushmeflex.blogspot.com/2010/09/cairngorm-3-example.html

    Hope this helps

    Rush me

  • Help me complete my first Login of Cairngorm example.

    Hello

    I'm still fearing to make an application using Cairngorm. Help, please

    This will be my sketch of my Caringorm request.

    This will is a LoginExample where on a successful connection is displayed as WELCOME or INVALID CONNECTION in the case of a bad connection.

    Please go through my code:

    It's my hand mxml file


    <? XML version = "1.0" encoding = "utf-8"? >
    < mx:Application xmlns:controller = "uk.co.clockobj.cairngormdemo.controller. *" >
    < controller: AppController / >
    < mx:Script >

    user: UserDTO var = new UserDTO();
    public function login (): void
    {
    User.UserName = UNAMETI.text;
    User.Password = PASSTI.text;
    systemManager.dispatchEvent (LoginEvent.LOG_USER_IN, user);

    }
    < / mx:Script >
    < / mx:Application >

    It's my UserDTO object:

    package dto
    {
    [Bindable]
    [RemoteClass(alias="namespace.to.some.server.dto")]
    public class UserDTO
    {
    public var username: String;
    password public var: String;

    public void UserDTO()
    {
    }
    }
    }

    This is my controller class:

    controller package
    {
    SerializableAttribute public class AppController extends FrontController
    {
    public void AppController()
    {
    Super();
    initialiseCommands();
    }

    private void initialiseCommands(): void
    {
    addCommand (LOG_USER_IN, LogUserInCommand);
    }
    }
    }

    This is my class of the event:

    package events
    {
    import com.adobe.cairngorm.control.CairngormEvent;

    SerializableAttribute public class LoginEvent extends CairngormEvent
    {

    public static const var LOG_USER_IN:String = "LOG_USER_IN";

    the user public var: UserDTO

    public void LoginEvent (type: String, user: UserDTO, bubbles: Boolean = false, cancelable: Boolean = false)
    {
    Super (type, bubbles, cancelable);

    This.User = UserDTO;
    }

    }
    }

    This is my command class:

    package controls
    {
    public class LogUserInCommand implements ICommand, IResponder
    {

    Service myremoteservice;
    public void LogUserInCommand()
    {
    }

    override public function execute(event:CairngormEvent):void
    {

    myRemoteService = ServiceLocator.getInstance () .getRemoteObject ("docsServices");
    }

    public void result(data:Object):void
    {

    ModelLocator.getInstance (.welcome = property ResultEvent (data));

    }

    public void fault(info:Object):void
    {

    ModelLocator.getInstance (.invalid = property ResultEvent (data));


    }

    }
    }

    This is my ModelLocator class:

    package template
    {[Bindable]
    / public class ModelLocator implements IModelLocator
    {
    private static var _instance:ModelLocator;

    Public Shared function getInstance (): {ModelLocator}
    If (_instance == null) {}
    _instance = new ModelLocator();
    }
    return _instance;
    }

    public void ModelLocator()
    {
    If (_instance! = null)
    {
    throw (new Error ("class Singleton has already been instantiated"));
    } else
    {
    session = new SessionModel();
    }
    }

    the user public var: UserDTO

    public var welcome: String;
    public var invalid: String;

    }
    }


    I have my file services.mxml defined in connection with my java file:


    < mx:RemoteObject
    ID = "docsServices".
    destination = "ToRemote.

    source = "cairngormcf.com.cf.CairngormJava" > "
    < / mx:RemoteObject >

    my questions to what is above the code are:

    1. How can I call the FrontController of my connection function of the main Application under the container form.

    2. after sending my logon function event, who should listen to this event. (How to do here)

    3.
    3. after obtaining the DTO user details in my Java layer, I validate the data and I sends a string either valid or invalid connection Login as String, here's how my main Application gets it data?

    Please help me in all these things, really, it will be a great help.

    While waiting for the responses from the experts

    Thanks a lot for reading long code.

    Hi Kiran, this is your class in place of the stuff as mentioned in the classes below that it's

    or if you can change it yourself here I use the custom component and I import this component custom demand... so use custom component to send event cairngorm...

    the best practice is to create a display component, and then import this view in your application and which will reduce the file size of your application and file size of download... so if you have any problem using this code let me know

    company
    ------------
    1 MyServices
    ------------

    http://www.Adobe.com/2006/mxml '.
       
    xmlns:Cairngorm = "" com.adobe.Cairngorm.Business. * ">"
       
       
        <>
    destination = "user".
    ID = "userRO" >
           
       
       

    2 UserDelegate
    --------------
    business package
    {
    import com.adobe.cairngorm.business.ServiceLocator;
       
    Import mx.rpc.AsyncToken;
    Import mx.rpc.IResponder;
    Import mx.rpc.remoting.RemoteObject;
       
    import Vos. UserVO;
       
    public class UserDelegate
    {
           
    public var myServices:ServiceLocator;
           
    public void UserDelegate()
    {
    TODO: to implement the function
    myServices = ServiceLocator.getInstance ();
               
    }
           
    Create a function to communicate with the server here

    public void validateUser(userObj:UserVO,responder:IResponder):void {}
               
    Check out the service you want
    communicate the servicelocator
               
    var userRO:RemoteObject = myServices.getRemoteObject ("userRO");
    var resMsg:AsyncToken = userRO.validateUser (userObj);
               
    join the answering machine
               
    resMsg.addResponder (responder);
               
               
    }

    }
    }

    LoginCommand
    ------------
    package controls
    {
    import business. UserDelegate;
       
    import com.adobe.cairngorm.commands.ICommand;
    import com.adobe.cairngorm.control.CairngormEvent;
       
    How to import events. LoginEvent;
       
    Import model. MyModelLocator;
       
    Import mx.controls.Alert;
    Import mx.rpc.IResponder;
    Import mx.rpc.events.ResultEvent;
       
    import Vos. UserVO;

    public class LoginCommand implements ICommand, IResponder
    {
    public var myModel:MyModelLocator;
    public var userDelegate:UserDelegate;
           
    public void LoginCommand()
    {
    TODO: to implement the function
    This allows to manipulate data in the
    model
               
    myModel = MyModelLocator.getInstace ();
    }

    public void execute(event:CairngormEvent):void
    {
    TODO: to implement the function
    We will do our logic here
               
    var loginEvent:LoginEvent = event as LoginEvent;
    var userObj:UserVO = loginEvent.userDtl;
               
    / * If (userObj.userName == "[email protected]" &)
    {userObj.password == "naresh") "}
    do something
    myModel.userDtl = userObj;
    myModel.APP_STATE = "login";
                   
    } else {}
    do something else
    Alert.Show ("connection failed");
    }*/
               
    create the delegate user instance
               
    userDelegate = new UserDelegate();
    userDelegate.validateUser (userObj, this);
                
    }
           
    public void result(event:Object):void {}
               
    var resultEvent:ResultEvent = event as ResultEvent;
               
    {if(resultEvent.Result!=null)}

    myModel.userDtl = resultEvent.result as UserVO;
    myModel.APP_STATE = "login";
                
    } else {}
                   
    Alert.Show ("connection failed");
    }
               
    }
           
    public void fault(event:Object):void {}
               
    }
           
           
    }
    }

    LoginPanel
    ----------

    <>
    "xmlns:MX ="http://www.adobe.com/2006/mxml"
    title = "Login here" >
       
       
            How to import events. LoginEvent;
    import Vos. UserVO;
    Import model. MyModelLocator;
    Import mx.events.ValidationResultEvent;
               
    public void loginUser(event:MouseEvent):void {}
                   
    var emailValEvnt:ValidationResultEvent
    = emailVal.validate ();
    var pswdValEvnt:ValidationResultEvent
    = pswdVal.validate ();
                               
    If (emailValEvnt.type is ValidationResultEvent.VALID
    (& pswdValEvnt.type == ValidationResultEvent.VALID) {}
                       
    as the validation is made
    communicate the data on the server
                       
    the failure of the value object
    var userObj:UserVO = new UserVO();
    userObj.userName = userNameTI.text;
    userObj.password = passwordTI.text;
                       
    var loginEvent:LoginEvent =
    new LoginEvent (LoginEvent.LOGIN_EVENT, userObj);
    dispatches the event
    loginEvent.dispatch ();

    CairngormEventDispatcher.getInstance.dispatch (loginEvent);  //Import com.adobe.cairgorm.CairngormEventDispatcher CairngormEventDispathcer
    } else {}
    display error message
    this.errorString = 'Pleae enter valid details';
    }
                   
    }
               
    ]]>
       
       
    <>
    source = "{userNameTI}".
    property = "text".
    ID = "emailVal".
    required = "true".
    triggerEvent =""
    />

    <>
    source = "{passwordTI}".
    ID = "pswdVal".
    maxLength = "16".
    minLength = "6".
    property = "text".
    triggerEvent =""
    />


           

               
           
           
               
           

           
       
           
       

       

    MyFrontController
    -----------------
    controller package
    {
    import com.adobe.cairngorm.control.FrontController;
       
    How to import events. LoginEvent;
    import controls. LoginCommand;

    SerializableAttribute public class MyFrontController extends FrontController
    {
    public void MyFrontController()
    {
    Super();
    addCommand (LoginEvent.LOGIN_EVENT, LoginCommand);
               
    }
           
    }
    }

    LoginEvent
    -----------
    package events
    {
    import com.adobe.cairngorm.control.CairngormEvent;
       
    import flash.events.Event;
       
    import Vos. UserVO;

    SerializableAttribute public class LoginEvent extends CairngormEvent
    {
    public static const = "loginEvent"; LOGIN_EVENT:String
            
    public var userDtl:UserVO;
           
    public void LoginEvent (type: String, userObj:UserVO)
    {
    TODO: to implement the function
    Super (type);
    this.userDtl = userObj;
    }
           
    override public function clone (): Event {}
               
    return of new LoginEvent (type, userDtl);
    }
    }
    }

    MyModelLocator
    --------------
    package template
    {
    import com.adobe.cairngorm.CairngormError;
    import com.adobe.cairngorm.model.IModelLocator;
       
    import Vos. UserVO;
       
    [Bindable]
    / public class MyModelLocator implements IModelLocator
    {
    public static var instance: MyModelLocator;
           
    public void MyModelLocator(enforcer:SingletonEnforcer)
    {
    TODO: to implement the function
    {if(Enforcer==null)}
                   
    trace ("you cannot create more than one instance of ModelLocator");
    throw new CairngormError ("initializing Multiple");
                                   
    }
               
    }
           
    public static function getInstace (): {MyModelLocator}
               
    {if(instance==null)}
    create a new instance
    Return it
    instance = new MyModelLocator (new SingletonEnforcer());
    return instance;

    } else {}
    return the existing instance
    return instance;
    }
               
    }
           
    Declare the Variables here
    Don't forget to initialize them
           
    contains the user data
    public var userDtl:UserVO = new UserVO();
    check the status of the application
    public var APP_STATE:String ="";
           
    }
    }
    Class SingletonEnforcer {}

    UserVO
    -------
    package vo
    {
    [Bindable]
    [RemoteClass(alias="com.test.lcds.vo.UserVO")]
    public class UserVO
    {
    public var userName:String;
    password public var: String;
           
    public void UserVO()
    {
    }

    }
    }

    Cairngorm2
    -----------

    <>
    "xmlns:MX ="http://www.adobe.com/2006/mxml"
    layout = "absolute".
    xmlns:comp = "comp.*.
    xmlns:control = "controller.*".
    xmlns:vo = "vo.*".
    xmlns:business = "mentoring."
    Initialize = "initApp () '"
    currentState = "{myModel.APP_STATE}" > "
       
       
       
       
       
       
       
       
       
       
            Import model. MyModelLocator;
               
    [Bindable]
    public var myModel:MyModelLocator;
               
    public function initApp (): void {}
                   
    myModel = MyModelLocator.getInstace ();
                   
                   
    }
               
    ]]>
       

       
           
               
               
                   
    text = fontWeight "Congratulation {myModel.userDtl.userName}" = "bold" fontSize = "18" / >
               

           

       

       
        <>
    horizontalCenter = "0".
    Red = "0" id = "loginpanel1" >
           
       
       

    Place these classes in relavent ane packages try it... you must implement service locator in the pakage delegate as well as the UserDelegate class

  • I get this error with my login form, I did, but I'm not sure if this is a problem with my php code or

    I get this error with my login form when I try to log in, but I'm not sure if this is a problem with my php code or my flex code!

    ReferenceError: Error #1069: loginsuccess property not found on string and there is no default value.
    CBC::main/checkLogin()
    CBC::main/__login_user_result()
    to flash. events::EventDispatcher / dispatchEv...
    to flash. events::EventDispatcher / dispatchEv...
    to HTTPOperation / http://www.Adobe.com/2006/Flex/MX/internal:dispatchRpcEvent ()
    to mx.rpc::AbstractInvoker / http://www.Adobe.com/2006/Flex/MX/internal:resultHandler ()
    at mx.rpc::Responder/result()
    at mx.rpc::AsyncRequest/acknowledge()
    to the DirectHTTPMessageResponder/completeHandl...
    to flash. events::EventDispatcher / dispatchEv...
    to flash. events::EventDispatcher / dispatchEv...
    at flash.net::URLLoader/onComplete()


    my php code is:


    [php] <? PHP

    define ("DATABASE_SERVER", "localhost");

    define ('DATABASE_USERNAME","f4r");

    define ('DATABASE_PASSWORD', 'cool23');

    define ('database_name', 'bignixs1');

    connect to the database

    $mysql = mysql_connect (DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD) or die (mysql_error ());

    Select the database

    @mysql_select_db (DATABASE_NAME);

    re-branded the data passed from Flex to variables

    $username = mysql_real_escape_string ($_POST ["usernam...)

    $password = mysql_real_escape_string ($_POST ["passwor...)

    Ask the database to see if the combination of username/password given name is valid.

    $query = "SELECT * from users WHERE username = 'username' AND password = 'password" ";

    $result = mysql_fetch_array (mysql_query ($query));

    start generating XML

    $output = "< loginsuccess > ';

    If the query returned true, exit < loginsuccess > Yes < / loginsuccess > other output < loginsuccess > not < / loginsuccess >

    if(!$result)

    {

    $output. = « no » ;

    } else {}

    $output. = "yes";

    }

    $output. = "< / loginsuccess > ';

    all the XML for output

    print ($output);

    ? > [/php]

    $query = "SELECT * from users WHERE username = 'username' AND password = 'password" ";

    should be

    $query = "SELECT * FROM users WHERE username = '$username' AND password =  '$password'";
    

    example of a system of working with the correct connection code flex & php to ensure:

    http://www.mattlefevre.com/viewExample.php?tut=flexPHP&proj=simple%20Login%20Application

  • Problems with the database, on delete cascade

    Hello

    I am in a project with the Flahs CS4 with air and as3. I create a database by code, everything is ok. I have 2 tables,
    a main table with a code field as primary key and other details of the table, named e.g. DetailTable, with 3 fields as the primary key. What I want to do, this is a deletion of a row in MainTable, all lines of DetailTable, where the field code is the same as the field in MainTable code should be deleted also.

    Here's the SQL code to create the tables.

    var sql2:String = "CREATE TABLE If NOT EXISTS MainTable ('+ '.
    "code INTEGER PRIMARY KEY AUTOINCREMENT, ' +.
    "quote," +
    'date ' +.
    "  " +
    ")";

    var sql3:String = "CREATE TABLE If NOT EXISTS DetailTable ('+ '.
    "code INTEGER, INTEGER position, type INTEGER, ' +.
    "path of TEXT, TEXT document, ' +.
    'PRIMARY KEY (code, position, type) +.
    'FOREIGN KEY (code) REFERENCES Detallesecuencia (code) ON DELETE CASCADE ' +.
    ")";


    Thus, when the tables are created, insert data. I connect without a problem, remove a line in MainTable (see code), to remove the line with the example code = 4, but in the DetailTable, all with code = 4 lines are NOT deleted, why?

    [CODE]
    Inside of a class

    private var conn: SQLConnection;

    public void constructorClass() {}
    Conn = new SqlConnection ();
    ConexionBD();
    }

    function ConexionBD() {}

    conn.addEventListener (SQLEvent.OPEN, openHandler);
    conn.addEventListener (SQLErrorEvent.ERROR, errorHandler);
    var dbFile:File = File.applicationDirectory.resolvePath ("mydatabase.db");
    conn.openAsync (dbFile, SQLMode.UPDATE);
    }

    function deleteRow() {}
    selectData:SQLStatement = new SQLStatement();
    selectData.sqlConnection = conn;
    selectData.text = "" DELETE FROM MainTable WHERE code =: param1 ";"
    selectData.addEventListener (SQLEvent.RESULT, resultHandler);
    selectData.addEventListener (SQLErrorEvent.ERROR, errorHandler);

    Delete line in MainTable code = 4, but not to delete all the rows in DetailTable with code = 4
    selectData.parameters [": param1"] = 4;

    selectData.execute ();
    }
    [/ CODE]

    Thanks in advance

    Hmmm, well then maybe it's you must go down the road of the old school and delete individual tables as needed, rather than rely on the cascade delete.

  • Problem in update of views presentation models

    Hi all

    I am trying to create a login using cairngorm screen and presentation model. I created a main screen that has two components - the screen logon and member. They appear according to the connection process. The problem is that even after the successful - connection, I can not update view.

    I know why - because I create two instances of presentation model for Main.mxml in Main.mxml and format for it.

    // Presentation model for Main.mxml
    public class MainModel {
         public var prop:String;
         public function callbackFunc( value:String ) {
              prop = value;
         }
    }
    

    // Presentation model for Login.mxml
    public class LoginModel {
         public function doLogin( username:String, password:String ) {
              var mainModel:MainModel = new MainModel(); // Instance created
              var event:LoginEvent = new LoginEvent( mainModel.callbackFunc, username, password );
              event.dispatch();
         }
    }
    

    <!-- Main.mxml -->
    <mx:Script>
    <![CDATA[
         [Bindable]
         public var model:MainModel = new MainModel(); // Another instance created
    ]]>
    <mx:ViewStack id="views" selectedIndex="{model.prop}">
         <views:MemberScreen />
         <views:Login />
    </mx:ViewStack>
    

    <!-- Login.mxml -->
    <mx:Script>
    <![CDATA[
         [Bindable]
         public var model:LoginModel = new LoginModel();
    ]]>
    <!-- form elements here -->
    <mx:Button label="login" id="btnLogin" click="{model.doLogin( 'abc', 'def' )}" />
    

    In this scenario, I make use of the callback function to the display to get updated when the loginEvent fires. But the view not updated because of two separate proceedings.

    How should I use the presentation model pattern in this scenario, as well as callback functions?

    Thanks and greetings

    ShiVik

    You could do a Singleton to the principal so that way everywhere, you use it, you use the same instance of it. Or if you use the Cairngorm ModelLocator (not that I recommend) has a single instance of the principal and you access anywhere else via the ModelLocator.

  • Problem to update the views by using templates

    Hi all

    I'm trying to implement the model of presentation using Cairngorm in my flex application. I have a problem to update the views using the presentation model.

    Here's what I do.

    1. I am trying to create a login screen.
    2. To store the current of the user logged in ModelLocator, I created a "currentUser" property
    3. My Member information screen (the screen is displayed after successful login) displays the username like this.
      • < mx:Label label = "{memberUI.fullname}" / > "
    4. I created a template, memberUI for Member information screen. It has a property called "name", which stores the full name of the current user.
    5. I created a method in the presentation model called setFullname() which does the work of definition of the fullname property. This function is called in the answering machine for the connection event.

         public function setFullname():void {
              var appModel:AppModelLocator = AppModelLocator.getInstance();
              appModel.currentUser = event.result as UserVO;
              var uim:memberUI = new memberUI();
              uim.fullname = appModel.currentUser.firstname + " " + appModel.currentUser.lastname;
         }
    

    But even when I was able to login, I am unable to display the full name in the view. Why is this happening?

    Can someone tell me what I am doing wrong?

    Thanks and greetings

    ShiVik

    I've seen two approaches to this within the PM + Cairngorm architectures.

    (1) pass a reference of your MP in your Cairngorm event to allow the command / responder call Update with the results of a service. It's an approach simple but tie your orders and the speakers to your PM class, which makes them less versatile.

    (2) have your PM record reminders with your Cairngorm event to allow results to be returned to your MP. Reminders may take the form of event, function references listeners or an object that implements IResponder.

    Unfortunately, I'm not aware of many examples online for this, but the following link to get (2) passing references to functions:

    http://www.allenmanning.com/?p=31

  • Problems in HTTPService with PHP

    Hello

    It's the Flex code that I have.

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="absolute"creationComplete =" do_work () "> "

    "< mx:HTTPService id ="find_college"fault =" errorhandler (event) "result =" resulthandler (event) "showBusyCursor ="true"method ="GET"useProxy ="false">

    < / mx:HTTPService >

    < mx:Script >

    <! [CDATA]

    Import mx.collections.ArrayCollection;
    Import mx.rpc.events.ResultEvent;
    Import mx.controls.Alert;
    Import mx.rpc.events.FaultEvent;

    [Bindable] private var collegeData:ArrayCollection = new ArrayCollection();

    private function do_work (): void
    {
    ' find_college.url = ' http://localhost/Take2.php?name=PQR "
    find_college. Send();
    }

    private void errorhandler(e:FaultEvent):void
    {
    Alert.Show (e.fault.message, "Server" error);
    }

    private void resulthandler(e:ResultEvent):void
    {
    collegeData = e.result.mydata;

    }
    []] >
    < / mx:Script >
    < mx:ComboBox id = "college_list" x = "464" y = "229" dataProvider = "{collegeData}" = 'name' labelField >
    < / mx:ComboBox >

    < / mx:Application >

    -----

    and contains the take2.php-

    ECHO ("< mydata >". $_GET ['name'].) "" < / mydata > ");"

    ---

    Problem is that the ComboBox control does not come with the value of the GET variable, it says transfer of localhost indefinitely.


    http://www.Adobe.com/2006/mxml"layout ="absolute"creationComplete =" do_work () ">"


    Fault = "ErrorHandler (Event)" "
    result = "resultHandler (Event)" "
    resultFormat = "xml".
    showBusyCursor = "true".
    method = 'GET '.
    useProxy = "false" >
       
       
       
       
                   
    Import mx.collections.ArrayCollection;
    Import mx.rpc.events.ResultEvent;
    Import mx.controls.Alert;
    Import mx.rpc.events.FaultEvent;
           
    [Bindable] private var collegeData:XMLList = new XMLList();
           
    private function do_work (): void
    {
    find_college. "URL ="http://localhost/take2php?name=pqr"
    find_college. Send();
    }
           
    private void errorhandler(e:FaultEvent):void
    {
    Alert.Show (e.fault.message, "Server" error);
    }
           
    private void resulthandler(e:ResultEvent):void
    {
    collegeData = XML (e.result) .mydata;
    }
    ]]>
       

       
       

    /* ----------------------------------------------------------------------------------------- -----------*/

    / * take2.php

    /* ----------------------------------------------------------------------------------------- -----------*/

    <>
    $x  = "";
    $x .= "";
    $x. = "«. $_GET ['name']. »« ;
    $x. = "«. $_GET ['name']. »« ;
    $x. = "«. $_GET ['name']. »« ;
    $x .= "
    ";

    Header ("Content-Type: text/xml");
    Header ("' Content-Length:".strlen ($x) ");
    Print ($x);

  • Help the Flex, Blaze and Cairngorm

    I have using Blaze, Flex3, and Cairngorm, I have a simple application at the present time, in which I send a Cairngorm event, he gets from the picked up that the command is executed and the delegate can send data to the RemoteObject. I can see in the output that Blaze does what it is supposed to do and the return of what it is supposed to return, but the returned data never makes it to the function result IResponder. What I am doing wrong? Can you send the code if necessary.

    Found the problem. ... in my delegate I forgot to addResponder to the AsyncToken.
    Before:
    public function getUsers (): void {}
    var call: AsyncToken;
    Call = service.getUsers ();
    Alert.Show ("Get users has been called");
    }

    After:
    public function getUsers (): void {}
    var call: AsyncToken;
    Call = service.getUsers ();
    call.addResponder (this.responder);
    Alert.Show ("Get users has been called");
    }

  • Problem of generation of XML?

    Hi, I'm relatively new to Flex 2 and I have a question.

    I am generating a view of oracle xml file and I hope to use it as a base for a grid of data in the chart.

    My generation yields process data something like this:
    < list >
    < product name = 'Laptop' total = '0' >
    < name of the warehouse = onhand 'California' = "10" / >
    < name of the warehouse = onhand "Virginia" = "20" / >
    < name of the warehouse = onhand 'Washington' = '0' / >
    < / product >
    < product name = "Desktop computer" total = '0' >
    < name of the warehouse = onhand 'Washington' = '9' / >
    < / product >
    < / list >

    I took this generated XML and put it in a local file for now.

    When I try to load this data, I get this error:
    TypeError: Error #1009: cannot access a property or method of a null object reference.
    to the TestFileAccess / TestFileAccess::resultHandler()
    to TestFileAccess / __srv_result)
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    ...
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()

    My mxml file looks like this:
    <? XML version = "1.0" encoding = "utf-8"? >
    "" "< mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout ="absolute"xmlns =" "*" paddingTop = "3" creationComplete = "initApp ()" pageTitle = 'Warehouse levels' >
    < mx:Script >
    <! [CDATA]
    Import mx.collections.ArrayCollection;
    Mx.rpc.events import. *;
    [Bindable]
    private var commodData:Array;
    [Bindable]
    private var warehouseData:Array;
    [Bindable]
    public var slicedCommodData:ArrayCollection;

    private function initApp (): void
    {
    SRV. Send();
    slicedCommodData = new ArrayCollection();
    }
    private void resultHandler(event:ResultEvent):void
    {
    commodData = event.result.list.name.source in the table;
    warehouseData = new Array (commodData.length);
    slicedCommodData.source = commodData;

    var commodTotal:Number;
    for (var x: Number = 0; x < commodData.length; x ++)
    {
    warehouseData [x] = {name: commodData [x] .name, onhand:0};
    var warehouses: Array = commodData [x].warehouse.source in the table;
    commodTotal = 0;
    for (var j: Number = 0; j < warehouses.length; j ++)
    {
    commodTotal += warehouses [j] .onhand;
    }
    .total commodData [x] = commodTotal;
    }
    }
    []] >
    < / mx:Script >
    < mx:HTTPService id = "srv" url = "result.xml" useProxy = "false" result ="resultHandler (event)" / > "
    < mx:Panel layout = "absolute" >
    < mx:ColumnChart id = dataProvider = "{slicedCommodData.source"WarehouseTotals"}" >
    < mx:horizontalAxis >
    < mx:CategoryAxis dataProvider = "{slicedCommodData.source}" categoryField = "Name" / > "
    < / mx:horizontalAxis >
    < mx:series >
    < mx:ColumnSeries xField = "Name" yField = "Total" / >
    < / mx:series >
    < / mx:ColumnChart >

    < mx:DataGrid dataProvider = "{slicedCommodData.source}" >
    < mx:columns >
    < mx:DataGridColumn headerText = "Commodity" dataField = "Name" / >
    < mx:DataGridColumn headerText = "Total" dataField = "Total" / >
    < / mx:columns >
    < / mx:DataGrid >
    < / mx:Panel >
    < / mx:Application >

    I wonder if something is wrong with my generated xml data or if his thing. I noticed that my generation xml product still not 3 labels warehouse for each product. Could be the problem?
    Also, the reason for which the label of the products of total is always 0 in the xml file is because this information is not in the view... I use mxml to calculate that.

    Thank you!

    It seems that I played with him for a while and that fixed it. The problem was my xml data and format that my httpservice returned. First of all my xml data to be surrounded and no Tags no and tags. Then my httpservice to be a result of e4x format. It also made me to change how I manage myself properties individual xml data.

    In any case, the fixed code looks like this for anyone who cares and got a similar error.

    "http://www.adobe.com/2006/MXML" xmlns = "" * "paddingTop ="3"creationComplete =" initApp () ' pageTitle 'Warehouse levels' = >

    Import mx.collections.XMLListCollection;
    Mx.rpc.events import. *;
    [Bindable]
    private var commodData:XMLList;
    [Bindable]
    public var slicedCommodData:XMLListCollection;

    private function initApp (): void
    {
    SRV. Send();
    }
    private void resultHandler(event:ResultEvent):void
    {
    commodData = event.result.commodity;
    slicedCommodData = new XMLListCollection (commodData);
    var commodTotal:Number;
    var nextNum:Number;
    for (var x: Number = 0; x)< commoddata.length();="">
    {
    var warehouses: XMLList = commodData [x] .warehouse as XMLList;
    commodTotal = 0;
    for (var j: Number = 0; j< warehouses.length();="">
    {
    nextNum = 0;
    nextNum = new Number (warehouses [j] .@onhand);
    commodTotal = commodTotal + nextNum;
    }
    var firstItem:Object = slicedCommodData.getItemAt (i);
    firstItem.@total = commodTotal;
    }
    }
    ]]>




















    Thanks for all your help!

  • Flex 3 Incompatible with Cairngorm?

    I used the import data tools code generate a WSDL in an empty project.

    It worked and I could make calls to the service successfully.

    I then tried to generate the WSDL language even in a Flex 3 project which uses the Cairngorm.swc previously I had recompiled with success of Flex 2.

    In the project that uses Cairngorm, the code generated for the service Web fails to compile.

    First of all there errors on the multiname for all classes mx.rpc.soap and mx.rpc.soap.wsdl references

    After the BaseService component in the generated code and change all these references to their full path a whole new ridiculous game of construction errors come which cannot be resolved.

    For example:

    1046: type was not found or is not a constant of compilation: WSDLOperation

    1046: type was not found or is not a constant of compilation: schema


    Those who are two of the many errors I got by trying different combinations of imports to get rid of the errors reference multiname.

    Unfortunately I never found the magic combination that would make it compiles.

    I'm not a big fan of Cairngorm and would probably prefer not to use it given the choice, but given that the company I use already made a year of development on their project, it would be a huge hassle to go through the whole project to remove all references.

    Any suggestions?


    BTW: There is also a certain glaring bugs in my Flexbuilder 3 Beta 3 installation.

    Projects import fails completely. The wizard goes through the first two steps, then the next button it does nothing.

    Also in project properties does not display the path of generation tab. No poster not the tab modules. And the project reference tab alone, nearly half of the time and when it displays does not work. Which means even if I have another project to reference, I can't use the code in this project.

    Hello

    Nevermind on the Cairngorm. I downloaded the latest source and used instead of the SWC. I did not know before, but the project was using an outdated version of the EFA. Using the new sources the project compiled correctly.

    With regard to Flexbuilder:

    Yes, I have the 2 and 3 is installed on the same computer.

    The workspace may be the same thing. I don't think than before. I create a new workspace and try to recreate the project.

    I tried to import a flex project that previously lived in Flexbuilder 2. So far, no luck.

    I had to create a new project that uses the old code and I had to modify the build path when I created it because it was the only time wherever I could. After that, it is no longer displayed.

    Anyway I am able to bypass the problems if this isn't a huge problem, but it is a bit annoying.

    Thanks for the quick response.

    You guys will be off soon. Wish you a good holiday! Happy Saturnalia.

Maybe you are looking for

  • Helps the system standby

    I'm trying to disable the day before on my computer. After 30 minutes, it goes into sleep mode. I have a toshiba with windows xp satellite. I can provide more information if it helps. I go to control panel and click on power options and it says to ch

  • Updated Windows and now I can not run other programs on my PC

    Updated Windows and now I can not run other programs on my PC!  What can I do?

  • mode standby lights up when

    Dell dimension e510 with xp home edition 5 years reference. When you turn power button on it goes into mode standby instead of turning on. it flashes yellow when you press it again once nothing happens, it keeps flashing yellow HELP!

  • bricked sansa e260: do not format (or do something else besides)!

    First of all, I want to apologize to ask you this question often, but I assure you, that my problem is a little different from the others. In short, I am able to get into recovery mode, access to 16 MB-FORMAT drive in Windows XP and Ubuntu 8.04 and s

  • Microsoft Digital Media Keyboard 3000 bilingual

    I am running WIN Vista Home Premium 64 Bit and installed Microsoft Digital Media Keyboard 3000 bilingual using English.  Whenever I use the keyboard, it starts to type French after only a few minutes and I don't know how to change it back to English.