tsquini
04-07-2008, 09:57 PM
I am having an issue calling public functions between classes.
I have 2 classes: FLVPlaybackCaptioningExample and DynamicButton.
In the DynamicButton class I am defining all of the mouseEvents on the dynamic buttons. On MouseEvent.CLICK I call a function from FLVPlaybackCaptioningExample that should .seekSeconds() to the FLV
player on frame 1 of the timeline.
To create the buttons I am loading a MovieClip from the Library
and using the class "videoCap.DynamicButton"
When I compile the movie it gives me an error:
1180: Call to a possibly undefined method seekToMovie.
package videoCap{
import fl.video.CaptionChangeEvent;
import fl.video.FLVPlayback;
import fl.video.FLVPlaybackCaptioning;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.system.*;
public class FLVPlaybackCaptioningExample extends MovieClip {
private var videoPath:String = "TESTVid.flv";
private var captioningPath:String = "caption.xml";
public function FLVPlaybackCaptioningExample() {
player.source = videoPath;
captioning.flvPlayback = player;
captioning.source = captioningPath;
captioning.autoLayout = false;
captioning.addEventListener(CaptionChangeEvent.CAP TION_CHANGE, onCaptionChange);
writeNav();
}
//--------------------------//
I can't seem to call this function
public function seekToMovie(mySeekNum:Number):Number{
player.seekSeconds(mySeekNum);
}
//--------------------------//
private function onCaptionChange(e:CaptionChangeEvent):void {
var tf:* = e.target.captionTarget;
var player:FLVPlayback = e.target.flvPlayback;
// move the caption below the video
tf.y = 210;
}
public function writeNav(){
for (var i:int = 0; i < 1; i++) {
var newCircle:videoCap.DynamicButton = new videoCap.DynamicButton();
newCircle.name = "nav" + i;
newCircle.setLabel(newCircle.name);
newCircle.setInternalVar(i);
newCircle.y = 25 * i;
newCircle.myNum = i;
newCircle.x = 120;
addChild(newCircle);
}
}
}
}
package videoCap{
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.display.MovieClip;
import flash.system.*;
public class DynamicButton extends MovieClip {
private var clicked:Boolean = false;
public function DynamicButton() {
this.buttonMode = true;
this.mouseChildren = false;
clicked = false;
this.addEventListener(MouseEvent.MOUSE_OVER, rollover);
this.addEventListener(MouseEvent.MOUSE_OUT, rollout);
this.addEventListener(MouseEvent.MOUSE_DOWN, mouseClickDown);
this.addEventListener(MouseEvent.MOUSE_UP, mouseClickUp);
this.addEventListener(MouseEvent.CLICK, mouseClick);
}
public function setLabel(thisLabel:String){
visibleLabel.text = thisLabel;
}
public function setInternalVar(thisNum:int){
myNum = thisNum;
}
public function rollover(event:MouseEvent) {
if (clicked) {
gotoAndStop("down");
} else {
gotoAndStop("over");
}
}
public function rollout(event:MouseEvent) {
gotoAndStop("normal");
}
public function mouseClickDown(event:MouseEvent) {
clicked = true;
gotoAndStop("down");
}
public function mouseClickUp(event:MouseEvent) {
clicked = false;
gotoAndStop("over");
}
public function mouseClick(event:MouseEvent) {
trace("HHHHH");
trace(myNum + " myNum");
//--------------------------//
Calling the function here.
seekToMovie();
//--------------------------//
}
}
}
I have 2 classes: FLVPlaybackCaptioningExample and DynamicButton.
In the DynamicButton class I am defining all of the mouseEvents on the dynamic buttons. On MouseEvent.CLICK I call a function from FLVPlaybackCaptioningExample that should .seekSeconds() to the FLV
player on frame 1 of the timeline.
To create the buttons I am loading a MovieClip from the Library
and using the class "videoCap.DynamicButton"
When I compile the movie it gives me an error:
1180: Call to a possibly undefined method seekToMovie.
package videoCap{
import fl.video.CaptionChangeEvent;
import fl.video.FLVPlayback;
import fl.video.FLVPlaybackCaptioning;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.system.*;
public class FLVPlaybackCaptioningExample extends MovieClip {
private var videoPath:String = "TESTVid.flv";
private var captioningPath:String = "caption.xml";
public function FLVPlaybackCaptioningExample() {
player.source = videoPath;
captioning.flvPlayback = player;
captioning.source = captioningPath;
captioning.autoLayout = false;
captioning.addEventListener(CaptionChangeEvent.CAP TION_CHANGE, onCaptionChange);
writeNav();
}
//--------------------------//
I can't seem to call this function
public function seekToMovie(mySeekNum:Number):Number{
player.seekSeconds(mySeekNum);
}
//--------------------------//
private function onCaptionChange(e:CaptionChangeEvent):void {
var tf:* = e.target.captionTarget;
var player:FLVPlayback = e.target.flvPlayback;
// move the caption below the video
tf.y = 210;
}
public function writeNav(){
for (var i:int = 0; i < 1; i++) {
var newCircle:videoCap.DynamicButton = new videoCap.DynamicButton();
newCircle.name = "nav" + i;
newCircle.setLabel(newCircle.name);
newCircle.setInternalVar(i);
newCircle.y = 25 * i;
newCircle.myNum = i;
newCircle.x = 120;
addChild(newCircle);
}
}
}
}
package videoCap{
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.display.MovieClip;
import flash.system.*;
public class DynamicButton extends MovieClip {
private var clicked:Boolean = false;
public function DynamicButton() {
this.buttonMode = true;
this.mouseChildren = false;
clicked = false;
this.addEventListener(MouseEvent.MOUSE_OVER, rollover);
this.addEventListener(MouseEvent.MOUSE_OUT, rollout);
this.addEventListener(MouseEvent.MOUSE_DOWN, mouseClickDown);
this.addEventListener(MouseEvent.MOUSE_UP, mouseClickUp);
this.addEventListener(MouseEvent.CLICK, mouseClick);
}
public function setLabel(thisLabel:String){
visibleLabel.text = thisLabel;
}
public function setInternalVar(thisNum:int){
myNum = thisNum;
}
public function rollover(event:MouseEvent) {
if (clicked) {
gotoAndStop("down");
} else {
gotoAndStop("over");
}
}
public function rollout(event:MouseEvent) {
gotoAndStop("normal");
}
public function mouseClickDown(event:MouseEvent) {
clicked = true;
gotoAndStop("down");
}
public function mouseClickUp(event:MouseEvent) {
clicked = false;
gotoAndStop("over");
}
public function mouseClick(event:MouseEvent) {
trace("HHHHH");
trace(myNum + " myNum");
//--------------------------//
Calling the function here.
seekToMovie();
//--------------------------//
}
}
}