Java Reference
In-Depth Information
def artwork = FXDNode{url:"{__DIR__}SymbolsAI.fxz"}
def flare = Duplicator .duplicate(artwork.getGroup("flare"));
Stage {
title: "Targeting"
scene: Scene {
width: 200
height: 200
content:[flare]
}
}
If you attempt to place flare directly on the stage without the duplicator step, it will generate
an error.
Using FXDNode to load object asynchronously
FXDNode is designed to support asynchronous loading of your artwork from the FXZ file.
This is helpful in cases when the FXZ file is either large or being loaded from a remote
location (or both). Doing it asynchronously ensures that the UI stays responsive, even
when the load operation takes a few seconds. The following loads artwork content
from file SymbolsAI.fxz asynchronously:
def artwork = FXDNode {
url: "{__DIR__}SymbolsAI.fxz"
backgroundLoading: true
placeholder: Text{ x:10 y: 10 content: "Loading..."}
}
Event notifications through FXDLoader
Your code can receive event notifications as the FXZ file loads using the FXDLoader class.
The following code will be notified when the FXZ file starts to load and when it is done loading:
def artwork:FXDNode = FXDNode {
url: "{__DIR__}SymbolsAI.fxz"
backgroundLoading: true
placeholder: Text{ x:10 y: 10 content: "Loading..."}
loader: FXDLoader {
onStart :function() {
println ("Image loading started")
}
onDone :function() {
println ("Image loading done");
println ("Loaded "
"{sizeof artwork.getRoot().content} objects");
}
}
}
 
Search WWH ::




Custom Search