Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
ilanb

LoaderMax error with "videoItem.content"

Recommended Posts

Hi,

I have a error when I addChild content of loader:

 

trace ("c") don't show, and error is:

 

route_2_menu_1.flv

a

b

TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul.

at view::Route2MenuView/completeHandler()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at com.greensock.loading.core::LoaderCore/_completeHandler()

at com.greensock.loading::LoaderMax/_loadNext()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at com.greensock.loading.core::LoaderCore/_completeHandler()

at com.greensock.loading::VideoLoader/_loadingProgressCheck()

 

Problem are "videoItem.content;" but I don't know why.

 

 


	private var videoItem:VideoLoader;
	private var queue:LoaderMax;
	private var vidcontent:ContentDisplay;

private function initVideo():void
	{	
		LoaderMax.activate([VideoLoader]);

		queue = LoaderMax.parse(["files/flv/route_2_menu_1.flv","files/flv/route_2_menu_2.flv","files/flv/route_2_menu_3.flv","files/flv/route_2_menu_4.flv","files/flv/route_2_menu_5.flv","files/flv/route_2_menu_6.flv","files/flv/route_2_menu_7.flv","files/flv/route_2_menu_8.flv"], null, {autoPlay:false});
		queue.addEventListener(LoaderEvent.COMPLETE, completeHandler);
		queue.load();

		btnIdontknow.visible = 
		btnImNot.visible = 
		btnIam.visible = 
		title.visible = false;

		currentRouteId = Main.instance.playerData.currentRouteId;
		currentItemId = Main.instance.playerData.getRouteById(currentRouteId).currentItemId;			
		flv = Main.instance.gameData.listRoute.getRouteById(currentRouteId).getItemById(currentItemId).flv;
	}

	private function completeHandler(event:LoaderEvent):void 
	{
		trace(Main.instance.gameData.listRoute.getRouteById(currentRouteId).getItemById(currentItemId).flv);
		trace("a");
		videoItem = LoaderMax.getLoader(Main.instance.gameData.listRoute.getRouteById(currentRouteId).getItemById(currentItemId).flv);
		trace("b");

		vidcontent = videoItem.content;
		vidcontent.x = DevData.FLV_POSITION_X + Main.instance.mainStage.x;
		vidcontent.y = DevData.FLV_POSITION_Y + Main.instance.mainStage.y;
		addChild(vidcontent);

		trace("c");
		btnIdontknow.init(3);
		btnImNot.init(2);
		btnIam.init(1);

		setChildIndex(btnIdontknow, numChildren - 1);
		setChildIndex(btnImNot, numChildren - 1);
		setChildIndex(btnIam, numChildren - 1);

		initTitle();
		openSubtitle();
		videoItem.playVideo();

		btnIdontknow.visible = 
			btnImNot.visible = 
			btnIam.visible = 
			title.visible = true;
		removeChild(loop);					
	}

 

Thanks for help !

Link to comment
Share on other sites

Sounds like this line is returning null:

LoaderMax.getLoader(Main.instance.gameData.listRoute.getRouteById(currentRouteId).getItemById(currentItemId).flv);

 

Which means you probably don't have a loader associated with that name or URL. Check your code to make sure you are feeding in the right value(s). I can't tell based on what you posted here.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×