Graphics Reference
In-Depth Information
Sample Use of ClickTagger
Much like the ReverseClip sample, this one requires you to add
a couple of things to the stage of your .fla. Also like the ReverseClip
sample, you have the option of downloading a .fla from the topic
s
Web site (ClickTaggerTest.fla). If you choose to create your own .fla,
you
'
ll simply need to add three buttons to the stage and give them
instance names of button1, button2, and button3. Once you have
them in place, use the following code for your Document class. If you
have downloaded the code from the Web site, this is the code from
ClickTaggerSample.as in the com.flashadbook.base package. Within
this code, the first couple of things we do are create a new instance of
ClickTagger named _clickTagger and three fallback URLs (one for
each button) called _fallback1, _fallback2, and _fallback3 (again
with the crafty names). Finally, we get to the constructor of
our Document class where we are just calling ClickTagger
'
s assign
ClickTag method once for each button and passing in the variables as
described in the ClickTagger Breakdown section. Obviously, there
wouldbemoreifthiswastheDocumentclassforanactualbanner
ad, but since it
'
'
'
s not, that
sallthereistoit.
package com.flashadbook.base {
import com.flashadbook.utils.ClickTagger;
import flash.display.Sprite;
import flash.events.MouseEvent;
public class ClickTaggerSample extends Sprite {
private var _clickTagger:ClickTagger = new
ClickTagger(stage.loaderInfo);
private var _fallback1:String =
" http://www.flashadbook.com " ;
private var _fallback2:String =
" http://www.jasonfincanon.com " ;
private var _fallback3:String =
" http://www.adobe.com " ;
public function ClickTaggerSample() {
_clickTagger.assignClickTag(button1,_fallback1,1);
_clickTagger.assignClickTag(button2,_fallback2,2);
_clickTagger.assignClickTag(button3,_fallback3,3);
}
}
}
Conclusion
Well, this is definitely the longest chapter in this topic, and we just
finished up with a good amount of code here. As I said earlier,
some of these classes were pulled over from the first edition of
Search WWH ::




Custom Search