[Papervision3D] i cant load external pvd3D swf

blackdice ih32_32 at hotmail.com
Thu Oct 11 13:20:48 PDT 2007


thank you zeh
i serched this forum and found this code
it load external swf contains pv3d without error but
when the swf contains collada file it gives Error #1009 again


var myIntroURL:String            = loaderInfo.parameters.introURL    ||
'boxDemo.swf';
var myIntroRequest:URLRequest    = new URLRequest(myIntroURL);
var ourIntro:Loader                = new Loader();
addChild(ourIntro);
ourIntro.load(myIntroRequest);




Zeh Fernando-2 wrote:
> 
>> i get Error #1009 when i load external swf contains papervision3D
>> TypeError: Error #1009: Cannot access a property or method of a null
>> object
>> reference.
> 
> It's hard to say without a look at your code, but a huge/common problem 
> with loaded SWFs on AS3 is that you cannot access the stage on a the 
> constructor of a class that extends displayobject/movieclip/sprite. So 
> if you create your whole scene on the constructor, it will work if you 
> run that inside the main document, but it won't work when you load it on 
> another movie. If you specially try to do "stage.something" on the 
> constructor, that's the error you'll get.
> 
> You have to remove the code from the constructor, put it on some other 
> method, and then add that method as the ADDED_TO_STAGE event on the 
> constructor. More or less like this
> 
> 
> public class Whatever extends MovieClip {
> 
> 	public function Whatever() {
> 		addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
> 	}
> 
> 	protected function onAddToStage(e:Event = null): void {
> 		// This object has been added to the stage
> 		// Actual initialization goes here
> 	}
> }
> 
> That's also the correct way to create 'attachable' movieclips.
> 
> Zeh
> 
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> 
> 

-- 
View this message in context: http://www.nabble.com/i-cant-load-external-pvd3D-swf-tf4607603.html#a13163942
Sent from the Papervision3D mailing list archive at Nabble.com.




More information about the Papervision3D mailing list