开发者

flash actionscript loadMovie

It works if I use

loadMovie("http://graph.facebook.com/100000108805716/picture", "imageLoader2");

but as I try to pass that link as variable from server this way:

loadVariables("http://paulius.shnaresys.com/suktukas/kodas.php", this, "GET"); loadMovie(draugas_1, "imageLoader");

It doesn't work. I know that the variable is passed as I can output in 开发者_如何学Cto text field. What do I do wrong?


Try this:

loadVariables("http://paulius.shnaresys.com/suktukas/kodas.php", this, "GET");
onEnterFrame = function()
{ 
     if( draugas_1 ) 
     { 
         loadMovie(draugas_1, "imageLoader");  
         delete this.onEnterFrame
     }
}

loadVariables happens asynchronously, which means that some time passes between the call of loadVariables and the return of the values which loadVariables retrieves. This means you need to wait until the variable exists before using it in loadMovie. The onEnterFrame is more or less the same way that the docs recommend. They use a setInterval, which technically makes fewer calls, but I personally prefer enterFrame to setInterval in AS2, especially in these circumstances.

The good news? Either way, you shouldn't have to wait too long that the user notices (or cares)


Have you tried using the example for the documentation? http://help.adobe.com/en_US/AS2LCR/Flash_10.0/00001319.html#390433

loadVariables("http://paulius.shnaresys.com/suktukas/kodas.php", this, "GET"); 
function checkVarsLoaded() {
    if(draugas_1 != undefined) {
        clearInterval(param_interval);
        loadMovie(draugas_1, "imageLoader");
    }
}
var param_interval = setInterval(checkVarsLoaded, 100);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜