Java Reference
In-Depth Information
backgroundLoading: background;
}
imageMap.put(classpath, image);
}
if (image == null){
println("WARNING: image not found at: {classpath}");
}
return image;
}
public function getImageSequence(classpathBase:String,imageCount:Integer,
background:Boolean):ImageSequence{
var key = "{classpathBase}{imageCount}";
var sequence:ImageSequence = sequenceMap.get(key) as ImageSequence;
if (sequence == null){
sequence = ImageSequence{
classpathBase:classpathBase
imageCount:imageCount
backgroundLoading: background;
};
sequenceMap.put(key, sequence);
}
return sequence;
}
}
In Listing 7-2 we can see on the first line that an instance of MediaLoader is created. This will be the
instance used by all subsequent calls to the static functions defined in this class. The static methods
image and imageSequence call getImage and getImageSequence on the default MediaLoader respectively.
The function image takes two arguments: The first is the path to the image file with the jar, and the
second indicates if the image should be loaded in the background. If the parameter background is true,
then function getImage will return before the Image is fully loaded. Figure 7-7 shows the path of the
application NetBeans.
Search WWH ::




Custom Search