PDA

View Full Version : Flash Player 10 Problem



jarvas99
April 8th, 2009, 09:24 PM
I have a movieclip that displays a slideshow. Starting a few days ago I get a error message from Flash Player 10 saying
"TypeError: Error #2007: Parameter url must be non-null.
at flash.display::Loader/_load()
at flash.display::Loader/load()
at slides/switchPhoto()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()"

Here is the actionscript package for the error

package
{
import flash.display.MovieClip;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.utils.Timer;
import fl.transitions.Tween;
import fl.transitions.easing.*;

public class slides extends MovieClip
{
var loader:URLLoader;
var theXML:XML;
var photos:XMLList;
var photoLoader:Loader;
var photoArray:Array;
var fade:Tween;
var curr:Number;
var timer:Timer;
var timey:timeDisplay;

public function slides():void
{
loader = new URLLoader();
loader.load(new URLRequest("photos.xml"));
loader.addEventListener(Event.COMPLETE, getXML);
photoArray = new Array();
curr = 0;
timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, switchPhoto);
timey = new timeDisplay();
timey.x = 235;
timey.y = 93.5;
}

private function getXML(e:Event):void
{
theXML = new XML(e.target.data);
photos = new XMLList(theXML.photo);
for(var i:int=0;i<photos.length();i++)
{
photoArray.push(photos[i].@url);
}
timer.start();
switchPhoto(null);
}

private function switchPhoto(e:TimerEvent):void
{
if(curr < photoArray.length)
{
photoLoader = new Loader();
curr = Math.ceil(Math.random() * photoArray.length);
photoLoader.load(new URLRequest(photoArray[curr]));
photoLoader.contentLoaderInfo.addEventListener(Pro gressEvent.PROGRESS, showProgress);
photoLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE, removeTimey);
}
else
{
curr = 0;
switchPhoto(null);
photoLoader.unload();
}
}

private function showProgress(e:ProgressEvent):void
{
this.addChild(timey);
var perc:Number = Math.floor(e.bytesLoaded / e.bytesTotal * 100);
timey.timerText.text = perc + "%";
}

private function removeTimey(e:Event):void
{
this.addChild(photoLoader);
fade = new Tween(photoLoader,"alpha",None.easeNone,0,1,2,true);
}

}
}




Any help in solving this issue will be appreciated.

senocular
April 9th, 2009, 09:25 AM
whatever photoArray[curr] is, is null. You'll need to do some debugging to find out why. It's likely because curr is out of the range of the possible values in photoArray

jarvas99
April 9th, 2009, 02:18 PM
I have 11 images in the xml file, so how do I change the null for 11? This sounds right because it usually takes some time for this message to pop up. It's probably eventually trying to pull images out side of the range. Sorry but I don't know much about actionscript so as much help as you can give me on this subject is appreciated.

jarvas99
April 9th, 2009, 06:32 PM
Maybe it has something to do with the code I used for the movieclip?


var loader:Loader = new Loader();
clip.addChild(loader);

loader.contentLoaderInfo.addEventListener(
Event.COMPLETE,function(evt:Event):void {
clip.x = 15.6;
clip.y = 289.6;
}
);
loader.contentLoaderInfo.addEventListener(
ProgressEvent.PROGRESS, function(evt:ProgressEvent):void {
(evt.bytesLoaded);
}
);
loader.load(new URLRequest("slides.swf"));

jarvas99
April 14th, 2009, 12:57 PM
are any of you having similar problems. I seem to be seeing a lot of error pop up in flash player 10 on other websites as well?

DFdou
April 15th, 2009, 03:36 AM
private function switchPhoto(e:TimerEvent):void
{
if(curr < photoArray.length)
{
photoLoader = new Loader();
curr = Math.ceil(Math.random() * photoArray.length);
photoLoader.load(new URLRequest(photoArray[curr]));
photoLoader.contentLoaderInfo.addEventListener(Pro gressEvent.PROGRESS, showProgress);
photoLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE, removeTimey);
}
else
{
curr = 0;
//switchPhoto(null);maybe you should use timer.stop() here
photoLoader.unload();
}
}