Graphics Reference
In-Depth Information
Last, but far from least, is the clickOut method that was
referenced in the activate method. This method is called when the
user clicks on the BorderButton (if the BorderButton is active).
Once again, we have a very simple and straightforward method
sitting in front of us. This one uses a try catch statement to make an
attempt at taking the user to the targeted URL by first trying to use
navigateToURL . If it succeeds, that
t, then it cur-
rently traces out a message letting you, the developer, know about it.
You may want to put some proper error handling in the catch.
private function clickOut(e:MouseEvent):void {
try {
navigateToURL(_request, _targetWindow);
}catch (e:Error){
trace( " An error occurred trying to navigate to the
target url.
'
sgreat.Ifitdoesn
'
"
);
}
}
Sample Use of BorderButton
The following code is the full code from the Document class
named BorderButtonSample in the com.flashadbook.base package.
It
s pretty simple and takes care of everything in just a few steps: a
new BorderButton is instantiated, a clickTag is assigned to a private
variable, and the BorderButton is drawn and activated. That
'
'
s it.
package com.flashadbook.base {
import com.flashadbook.display.BorderButton;
import flash.display.Sprite;
import flash.events.MouseEvent;
public class BorderButtonSample extends Sprite {
private var _borderButton:BorderButton = new
BorderButton();
private var _clickTag:String =
" http://www.flashadbook.com " ;
public function BorderButtonSample(){
_borderButton.draw(this);
_borderButton.activate(_clickTag);
}
}
}
The SimpleMenu Class
The following SimpleMenu class is a single-dimension (no drop-
downs) menu that has limited styling properties that can be set by the
developer. One of the styles that is changeable is the TextFormat used
Search WWH ::




Custom Search