Graphics Reference
In-Depth Information
private function clickOut(e:MouseEvent):void{
var clickedIndex:int;
var destination:String;
clickLoop: for(var obj:Object in _clickObjects){
if(e.target == _clickObjects[obj].clickElement){
clickedIndex = _clickObjects[obj].tagIndex;
destination = _clickObjects[obj].fallBack;
break clickLoop;
}
}
if(_playerType==
"
activex
"
|| _playerType==
"
plugin
"
){
if(_clickTags[clickedIndex]){
if(secureTag(_clickTags[clickedIndex].tagUrl)){
destination =
_clickTags[clickedIndex].tagUrl;
}
}
_extInterfaceAvailable =
ExternalInterface.available;
}
if (_extInterfaceAvailable) {
ExternalInterface.call(
'
window.open
'
,destination,
targetWindow);
}else{
navigateToURL(new
URLRequest(destination),targetWindow);
}
}
The final items in ClickTagger are the
secureTag
method and a get-
ter and setter to allow the
_targetWindow
to be changed. We
'
ve already
pretty much covered what
secureTag
does (
in
the clickTag), and it either returns
true
or
false
based on its findings.
“
http://
”
or
“
https://
”
private function secureTag(targetURL:String):Boolean {
var resultObj:Object = _securePattern.exec(targetURL);
if (resultObj == null || targetURL.length
>
= 4096) {
return false;
}
return true;
}
public function get targetWindow():String{
return _targetWindow;
}
public function set targetWindow(value:String):void{
_targetWindow = value;
}