Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Book Story
Started by sabir.ahmed59 Apr 06 2013 09:33 AM

4 replies to this topic
storing current page is
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

sabir.ahmed59

[GLOBAL: userInfoPane.html]
sabir.ahmed59
  • Enthusiast

  • 75 posts
  • Corona SDK

Hi,

I am creating comic story using director book framework and want to store the recent id in sandbox file.

But I am facing problem in storing recent id because the framework is loading three pages at a time i.e previous, current and next and when i am storing it. It's store next id. When there is last last page it's store 1st id.

So, how can i get current id or page ?

Any help will be appreciated.

 

Thanks,.

 

 



[TOPIC: post.html]
#2

CraftyDeano

[GLOBAL: userInfoPane.html]
CraftyDeano
  • Contributor

  • 314 posts
  • Corona SDK

I'm not sure on Director, but if you use Corona's native storyboard API, you can call command

local current = storyboard.getCurrentSceneName()



[TOPIC: post.html]
#3

sabir.ahmed59

[GLOBAL: userInfoPane.html]
sabir.ahmed59
  • Enthusiast

  • 75 posts
  • Corona SDK

Thanks Crafty,

I know about the storybook API. But I want to stick with director because I have already implemented my code using this API.

If I go through the storybook API then I need to rewrite my code.

There might be some solution or way in director library to find out the current scene name.

 

Thanks,



[TOPIC: post.html]
#4

CraftyDeano

[GLOBAL: userInfoPane.html]
CraftyDeano
  • Contributor

  • 314 posts
  • Corona SDK

Hmm... Maybe have a global variable declared when the app runs and update it at the start of every scene? 



[TOPIC: post.html]
#5

sabir.ahmed59

[GLOBAL: userInfoPane.html]
sabir.ahmed59
  • Enthusiast

  • 75 posts
  • Corona SDK

Hi,

I have fixed the above issued and now want to know that,

Is there any way to detect multi-touch and simple touch on same object.

Because I want to assign different functionality on both the touch(single touch, multi-touch) event.

In my project, I have assigned page flip or swipe method using director book framework on touch event and I also want to do pinch zoom on same object on multi-touch or when user touches with two fingers. 

I'm stuck now for couple of days. 

Any help will be appreciated.

 

I am using this code for multi-touch but unable to get the number of touches > 2.

Is I am doing something wrong? 

<lua>

 

 
function bookBackground:touch( event )
    if event.phase == "began" then
    print("in began phase"..self.numTouches )
        display.getCurrentStage():setFocus( self, event.id )
        self.numTouches = self.numTouches + 1
 
        if self.numTouches >= 2 then
            print( "This object is being multi-touched." )
        end
 
    elseif event.phase == "cancelled" or event.phase == "ended" then
 
        self.numTouches = self.numTouches - 1
 
        if self.numTouches <= 0 then
            display.getCurrentStage():setFocus( nil )
        end
    end
    return true
end
-------------------------------------------------------------------------
-------------------------------------------------------------------------
       

        local bookBackground = display.newRect( 0, 0, _W, _H )
        bookBackground.alpha = 0.01
        bookBackground:addEventListener( "touch", moveBookPage )
        currView:insert( bookBackground )
        bookBackground.numTouches = 0
        bookBackground:addEventListener( "touch", bookBackground )

 

</lua>

 

Thanks,




[topic_controls]
[/topic_controls]