Phrozen
06-05-2008, 02:10 PM
Ok, this problem is really starting to irk my nerves. I have an MXML file in Flex that I am trying to call a custom class I have written that is within a package. The constructor of this class, clearly has 3 arguments that need to be provided.
package com.ryancrocker
{
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class VideoLibrary
{
// instantiate variables
private var p_loader:URLLoader;
private var p_xmlData:XML;
private var p_videoID:int;
private var p_libraryURL:String;
public function VideoLibrary(url:String, file:String, videoID:int = 0)
{
this.ps_libraryURL = url;
this.p_videoID = videoID;
this.p_loader = new URLLoader();
this.p_loader.addEventListener(Event.COMPLETE, onXMLLoaded);
this.p_loader.load(new URLRequest(this.p_libraryURL + file));
}
.....
and here is the script that I have embedded in the MXML to instantiate a VideoLibrary object.
private var vl:VideoLibrary;
private function initApp():void
{
vl = new VideoLibrary("http://vpatraining.brinkster.net/video_library/", "videoLibrary.xml");
vl.selectVideo(0);
videoPlayer.source = vl.getSource();
videoPlayer.play();
}
And here are the three errors I receive from Flex Builder when I try to build the project.
- 1061: Call to a possibly undefined method getSource through a reference with static type VideoLibrary.
- 1061: Call to a possibly undefined method selectVideo through a reference with static type VideoLibrary.
- 1137: Incorrect number of arguments. Expected no more than 0.
If anyone has any ideas on why this could be happening I would greatly appreciate your input. Thanks in advance!
package com.ryancrocker
{
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class VideoLibrary
{
// instantiate variables
private var p_loader:URLLoader;
private var p_xmlData:XML;
private var p_videoID:int;
private var p_libraryURL:String;
public function VideoLibrary(url:String, file:String, videoID:int = 0)
{
this.ps_libraryURL = url;
this.p_videoID = videoID;
this.p_loader = new URLLoader();
this.p_loader.addEventListener(Event.COMPLETE, onXMLLoaded);
this.p_loader.load(new URLRequest(this.p_libraryURL + file));
}
.....
and here is the script that I have embedded in the MXML to instantiate a VideoLibrary object.
private var vl:VideoLibrary;
private function initApp():void
{
vl = new VideoLibrary("http://vpatraining.brinkster.net/video_library/", "videoLibrary.xml");
vl.selectVideo(0);
videoPlayer.source = vl.getSource();
videoPlayer.play();
}
And here are the three errors I receive from Flex Builder when I try to build the project.
- 1061: Call to a possibly undefined method getSource through a reference with static type VideoLibrary.
- 1061: Call to a possibly undefined method selectVideo through a reference with static type VideoLibrary.
- 1137: Incorrect number of arguments. Expected no more than 0.
If anyone has any ideas on why this could be happening I would greatly appreciate your input. Thanks in advance!