2010-01-29 4 views
0

안녕하세요, 작동하는 특정 프레임에서 애니메이션을 멈추는 actionscript 함수를 만들었습니다. 나는 애니메이션을 멈추고 자하는 프레임의 번호를 포함 할 변수를 PHP 파일에로드했다. 이것은 잘로드하고 함수에로드했습니다. 내가 할 수없는 일은 애니메이션 재생을 중지시키는 함수에 변수를 가져 오는 것입니다. 나는 문제가 percentage이 기능 2의 범위 내에서 정의되지 않은 것으로 생각플래시에 php 변수를로드했지만 함수에 적용 할 수 없습니다.

//load variables 
varReceiver = new LoadVars(); // create an object to store the variables 
varReceiver.load("http://playground.nsdesign6.net/percentage/external.php"); 
//load variables 



//function1 
varReceiver.onLoad = function() { 
//value is the var that is created. 
var paul = this.percentage; 
} 
//function1 


//function2 
this.onEnterFrame = function() {  
if(this._currentframe==(percentage)) { 
this.stop(); 
this.onEnterFrame = undefined; 
} 
} 
play(); 
//function2  

환호 폴

답변

0

:

여기 내 코드입니다. 이 같은

시도 뭔가 :

//function1 
varReceiver.onLoad = function() { 
//value is the var that is created. 
var _level0.paul = this.percentage; 
} 
//function1 

//function2 
this.onEnterFrame = function() {  
if(this._currentframe==paul) { 
this.stop(); 
this.onEnterFrame = undefined; 
} 
} 

주의해야 할 또 다른 것은 당신이 이미 당신의 onLoad 함수가 호출되는 시간에 의해 프레임의 몇 가지를 통해 어쩌면 당신이해야 있었던 것입니다 paul이 작은 경우를 대비하여 function2의 테스트를 if(this._currentframe>=paul)으로 변경하십시오.

+0

안녕하세요 난 당신이 말한 시도했지만 작업을 나던 다음과 같은 오류가납니다 : 장면 = 장면 1, 레이어 = 레이어 1, 프레임 = 1 : 12 행 : ';' 예상 된 var _level0.paul = this.percentage; 장면 = 장면 1, 레이어 = 레이어 1, 프레임 = 1 : 라인 14 : 예기치 않은 '}'이 (가) 발생했습니다. –

0
//load variables 
var paul; // <- !!! 
varReceiver = new LoadVars(); // create an object to store the variables 

varReceiver.onLoad = function() { 
//value is the var that is created. 
    paul = this.percentage; // <- !!! 
    play(); 
} 
//function1 


//function2 
this.onEnterFrame = function() {  
    if(this._currentframe==(paul)) { // <- !!! 
     this.stop(); 
     this.onEnterFrame = undefined; 
    } 
} 
//function2 

varReceiver.load("http://playground.nsdesign6.net/percentage/external.php"); 

이상 :

//load variables 
varReceiver = new LoadVars(); // create an object to store the variables 

varReceiver.onLoad = function() { // onLoad 
    if(this.percentage!=undefined){ // check if percentage exist 
     _root.onEnterFrame = function(){ // register event function 
     if(_currentframe == varRecivier.precentage) { // function body 
      _root.stop(); 
      _root.onEnterFrame = null; 
     } 
     play(); 
    }else{ // no variable "precentage" in loaded data 
     gotoAndPlay("error"); // loading error handling 
    } 
} 
관련 문제