2 thoughts on “Books

  1. Hello Peter

    I have a question to ask that’s been bothering me for the 2nd project i do in Flex.

    If i want to synchronize with a service response, that is wait until i get an answer and then go on with the client execution, the only way i know is to write a resultEventHandler(event:ResultEvent) and then do the rest of the execution there (of course, it’s not really synchonous).

    while this is ok for certain scenarios, i think there are very common situations where you don’t want to handle this outside your caller function. in fact, you might not want to do anything until the service sends a response!

    for example, suppose i want to make a user registration form. part of it is checking whether the selected username already exists. i don’t want to let the user do anything else until i get the response. so i define the service:

    in my caller function, i write something like:
    remoteService.checkUsername(_tiUsername.text);

    and then i implement the response handler:

    private function checkUsernameResultHandler(event:ResultEvent):void {
    ….
    }

    now, here’s what i think is wrong with this technique. apart from having unnecessary code (in this case i just want to wait for the thread to return the response, i.e make the call synchronously), there is another problem – what happens if i need to call that service method on different contexts within the same class? i will have to define the service twice just because i’ll need two different result handlers.

    i’m aware this can be solved within the same function by dynamically adding a listener + anonymous handler function (that will also remove the listener after handling the ResultEvent), but this is ugly. i was wondering if there’s a nicer, cleaner way to solve this. ideally, something like:

    var result:Result = remoteService.checkUsername(_tiUsername.text);

    where the checkUsername method is defined as synchronous, so only this thread and the UI thread are active.

    of course, this question may also apply for HttpService or URLLoader methods, not just RemoteObject calls.

    many thanks
    Yuval Ron

  2. Hi there

    is it possible to use dxf files in flex?
    Do you have a hint maybe? :/

    Following does not work (can not be transcoded + mimetype not registered)
    [Embed(source=”resources/icons/bridge.dxf”, mimeType=”application/dxf”)]
    private var saveIcon:Class;

    I would really apreciate it.

    Thanks & regards
    Marc

Comments are closed.