UIEvolutin Inc.
UJML Language Reference
Resource Management Events

UJML provides events which fire for network activity and resource availability.

Because resource loading over a network may involve latency and may fail, UJML provides events which fire for network actions and resource availability. See Resources, Handling Events. You can use these events to provide visual information for the user that network activity is ongoing, to cause the application to not perform actions until a resource is available, and to respond appropriately if a resource fails to load. 

There are two sets of events. The 'onRequest' events are generalized and fire for all network activity in an application. To discover which URL is related to the event firing you can call the _getStringEventData() function with the &_EVENT_STRING_ONREQUEST_URL; predefined entity. See _getStringEventData() function, Event Entities. The 'onResource' events are only used inside of a resource element and fire when the resource that element refers to is available or has failed to load. See resource.

Event Purpose 
Events 
Contained by 
Capture network activity for a resource 
A visual element. See Handling Events, Visual Elements
Capture resource availability 
A resource element. See Resources

The following example shows how to handle an onRequestFailed event by showing a message. It is part of the events.ujml sample.

<event name="onRequestFailed">
    <script>
        showMessage(_strcat("onRequestFailed: ",
            _getStringEventData(&_EVENT_STRING_ONREQUEST_URL;)));
    </script>
</event>

 

The following example shows how to handle an onResourceAvailable event by showing a message and setting a variable. It is part of the events.ujml sample.

<event name="onResourceAvailable">
    <script>
        showMessage(_strcat("onResourceAvailable: ", mSoundURL));
        mSoundLoaded = true;
    </script>
</event>
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
What do you think about this topic? Send feedback!