Reputation: 1
Even I am programmer I am very, very, new to as3. Problem: I have define a classA in aA.sp file.
package{
import flash.display.Sprite
.......
public class aA extends Sprite{
function aA{ .... } //constructor
functio playVideo(url){.....}
}
I have defined Main in the document class in the cs4 .flv file The Main class is defined in the Main.as file. package{ import flash.display.Sprite; ....
public class Main extends Sprite{
public function Main(){
var v:Sprite = new aA();
v.playVideo("clip.flv");
addChild(v);
}
}
}
When test on cs4 (contol>enter) I get following error
1061: Call to a possibly undefined method playVideo through a reference with static type flash.display:Sprite
Please help me. I am stuck! ( may be its a simple error ) Thanks in advance.
Upvotes: 0
Views: 1972
Reputation: 22604
Make playVideo public or make sure aA is in the same package as Main.
Upvotes: 1
Reputation: 8705
Make sure that your Main class is in the same package as the aA class (or otherwise use import to import that package). Set the type for your v to aA ( var v:aA = new aA();
) .
Upvotes: 1