开发者

where wrong in my flash source (action script 3 )?

myMC.buttonMode=true;
myMC.addEventListener(MouseEvent.CLICK, fl_onClick);
myMC.addEventListener(MouseEvent.MOUSE_OUT, fl_onMouseOut);
var visited=false;


function fl_onClick(evt:MouseEvent):void {
    navigateToURL(new URLRequest("fa/index.html"),"_self");
    visited=true;
}
function fl_onMouseOut(evt:MouseEvent):void {
    if (visited) {
        myMC.gotoAndStop("visited");
    }
}
myMC2.buttonMode=true;
myMC2.addEventListener(MouseEvent.CLICK, f2_onClick);
myMC2.addEventListener(MouseEvent.MOUSE_OUT, f2_onMouseOut);
var visited2=false;

function f2_onClick(evt:MouseEvent):void {
    navigateToURL(new URLRequest("en/index.html"),"_self");
    visited2=true;
}
function f2_onMouseOut(evt:MouseEvent):void {
    if (visited2) {
        myMC.gotoAndStop("visited");
    }
}

TypeError: Er开发者_如何学Goror #1009: Cannot access a property or method of a null object reference.


First thing I noticed is that when you click on th MC, the whole page is replaced by another (_self). Therefore you can't expect Flash to remember the value of a variable (visited or visited2) next time it is displayed. To do this you will have to use a cookie or a session variable serverside.

And then, are you sure myMC and myMC2 exist? Try to trace them before doing anything. Are they clips on your stage (Flash), are they class properties?...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜