Graphics Reference
In-Depth Information
_targetY = _imageLoader.scaleX == 1 ?
_pointVector[pointIndex(_imageLoader)].y : _halfHeight -
(_imageLoader.content.height/2);
if(_targetScale == 1){
swapChildren(_imageLoader, getChildAt(numChildren -
1));
}
_imageLoader.scaleX = _imageLoader.scaleY =
_targetScale;
_imageLoader.x = _targetX;
_imageLoader.y = _targetY;
_imageLoader = null;
}
ve reached the pointIndex and imageLoadError
methods. There
Finally, we
'
'
s not much going on at all in either one of these,
but I felt they still deserved a quick mention. First is the pointIndex
method. If you remember earlier in the class, we called on this
method and passed in the name of the Loader (image) whose
index we were in search of. The workings inside pointIndex are
very simple because they are doing nothing more than stripping
the number off the end of the Loader
s name and returning it as
an int . As for the imageLoadError method, I only placed a couple
of trace statements in there and thought I
'
d leave it up to you to
handle that error in the best way you see fit for your particular
needs.
'
private function pointIndex(loader:Loader):int {
return
int(loader.name.substring(_imageNamePrefix.length));
}
private function imageLoadError(e:IOErrorEvent):void{
trace( " !!! There was an error loading an image !!! " );
trace(e.text);
}
I placed at the end of the class. The fact that these variables have
getters but no setters makes them read-only properties. I decided
on numberOfImages, galleryPath, and imageArray because I saw
those as the most useful pieces of information that needed to be
made available. Of course, none of this is set in stone, and you can
obviously change it up as needed.
One last group of items for the SimpleGallery are the
getters
public function get numberOfImages():int {
return _numberOfImages;
}
Search WWH ::




Custom Search