Example 1:
In this example, both Image1 and Image2 will display at the same time, unlike a standard script where Image1 would be shown first followed by Image2. This is particularly useful if there is a transition on the images because both images can be displayed simultaneously without you having to wait for the transition on the first image to finish before the next image is displayed.
function DisplayObject()
{
this.Show()
}
function ShowBothImages()
{
fork(DisplayObject,Image1)
fork(DisplayObject,Image2)
}
Example 2:
In the second example below, the fork is used to show Image1 and hide Image2 at the same time. This shows that the fork function can be used to call different functions at the same time. Also note that the forked functions do not take parameters, so they use a specific the object name rather that the special keyword this:
function ShowObject()
{
Image1.Show()
}
function HideObject()
{
Image2.Hide()
}
function ShowHideObjects()
{
fork(ShowObject)
fork(HideObject)
}