Forum Moderators: open
i an trying to learn the whole Classes thing.. So far all is working fine, now i have a question. i have a couple of Buttons(MCs) on the stage and have this class:
import mx.transitions.Tween;
import mx.transitions.easing.*;
class RollOverOutFader extends MovieClip {
public function RollOverOutFader() {
this.onRollOver = this.over;
this.onRollOut = this.out;
this.onLoad = this.onload;
this.onPress = this.onpress;
}
private function over(){
var cic:Tween = new Tween(this,"_alpha",Strong.easeOut,0,50,1,true);
}
private function out(){
var cic:Tween = new Tween(this,"_alpha",Strong.easeOut,50,0,1,true);
}
private function onload(){
this._alpha = 0;
}
private function onpress(){
if(this.link!= ""){
_root.gotoAndStop(this.link);
}
}
}
That all works, some of the button do not have a link there are just for highlighting and effects. But if i do not define a link on them, i get an error.
Any idea how to prevent that?
Thank you
if(this.link!= ""){
please post teh EXACT error, without it we're just spinning our wheels. Perhaps the link is null not "" (blank string) maybe you can try changing your if statement to be:
if(this.link!= null){
... do stuff
}
but really, if you have an error from compiling code you should post the error message. Just telling us that there is an error is hardly enough information.
mcm
i was just frustated, here is my error:
**Error** /Volumes/work2/STUFF/ASSETS/FLASH/CLASSES/RollOverOutFader.as: Line 27: There is no property with the name 'link'.
if(this.link!= null){
**Error** /Volumes/work2/STUFF/ASSETS/FLASH/CLASSES/RollOverOutFader.as: Line 28: There is no property with the name 'link'.
_root.gotoAndStop(this.link);
Total ActionScript Errors: 2 Reported Errors: 2
and each of the MCs on the stagen has:
onClipEvent (load) {
this.link = "START";
}
Thank you again!