Storyboard question

Hi all,

I have a question about the following line in the storyboard scene template:

[lua]local group=self.view[/lua]

I’m trying to add an item to the same view group in a callback from media.playVideo and when I do that, I get a nil reference for self in the callback function.

[lua]function onVidComplete( event )
local viewGroup = self.view – self is nil here and an error is thrown
– code to add new image goes here
end

function scene:enterScene( event )
local viewGroup = self.view
media.playVideo(“video/start.mov”, false, onVidComplete)
end[/lua]

What are others doing in situations similar to this? I was thinking of making a reference to self.view that is local to the scene, rather than local to the methods, then setting its value in enterScene. But it seems to me that the template was designed to have the methods with their own local viewGroup variables for a reason. Help?

Thanks,
Jay [import]uid: 89562 topic_id: 21615 reply_id: 321615[/import]

From what I know, since group is just self.view which (if your storyboard scene is called scene) is scene.view, you would need to change

local viewGroup = self.view  

to

local viewGroup = scene.view [import]uid: 69700 topic_id: 21615 reply_id: 85718[/import]

Thanks, that does work and I understand why.

But I’m hoping one of the Corona devs or someone else that may know can tell me why the template doesn’t use a scene scoped reference to self.view, and why they chose to use a new local reference in each method. [import]uid: 89562 topic_id: 21615 reply_id: 85733[/import]