Results 1 to 5 of 5
  1.    #1  
    I was hoping someone could help me with this, as I have created an imageView with 3 images, one centred and one on the left, the other on the right. However, when I swipe to the image on the left, I can go to the centre image but not the right image (and vice versa)

    Can anyone help me with this?

    Also, I built this using project Ares, I was thinking of doing an onLeftFnction and onRightFunction but, I'm a new dev and not sure what to do with it (if I even should be using it).

    Thanks!
    Last edited by diov; 02/18/2010 at 04:54 PM.
  2. #2  
    i just put an app in the catalog that heavily utilizes this... can't help if you're in ares though i can let you know what i did if you can either 1) transfer it to ares or 2) want to do it in the sdk.
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  3.    #3  
    Quote Originally Posted by shanerooni View Post
    i just put an app in the catalog that heavily utilizes this... can't help if you're in ares though i can let you know what i did if you can either 1) transfer it to ares or 2) want to do it in the sdk.
    Sure that would be great, as ares can export to the SDK.

    Thanks!
    Why wait for "official" updates, when you can roll your own
  4. #4  
    i'll throw something together tomorrow morning
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  5. #5  
    EDIT: forgot an important part (but you probably already have it... you need to initialize the leftUrl, centerUrl and rightUrl... i do mine either with a tap event on 'myPhotoDiv', or just have it done automatically in the activate function. i think palm uses a button.

    this is in your scene:

    Code:
    <div style="width:320px;height:480px" id="myPhotoDiv" x-mojo-element="ImageView"></div>
    note i have the width and height because i also used a tap event to change the pic in addition to the left and right swipe, and wanted to have the whole screen be "tappable".

    here is what you put in the setup:

    Code:
    this.model = {
         onLeftFunction: this.wentLeft.bind(this),
         onRightFunction: this.wentRight.bind(this)
    }
    
    this.controller.setupWidget('myPhotoDiv',attributes,this.model);
    this.myPhotoDivElement = $('myPhotoDiv');
    this.imageViewChanged = this.imageViewChanged.bindAsEventListener(this);
    Mojo.Event.listen(this.controller.get('myPhotoDiv'),Mojo.Event.imageViewChanged,this.imageViewChanged);
    note i don't have any attributes - see the note in palm's example code if you want to turn on the 'noExtractFS'. i didn't use it, but kept the attributes var in the widget setup.

    now for the functions.

    i have an imageViewChanged function that all that happens is when the picture changes, i play a sound for that respective picture. you can do the same, but you technically don't need to do anything when the image is changed. if you have any questions about this let me know.

    next is the wentLeft function. this is where you want to have an image ready to the left and the right of the current image when you swipe right:

    Code:
    GameAssistant.prototype.wentLeft = function(event){
    
         this.myPhotoDivElement.mojo.leftUrlProvided('images/icons/0.png');
         this.myPhotoDivElement.mojo.rightUrlProvided('images/icons/2.png');
    
    }
    
    same for the wentRight function:
    
    GameAssistant.prototype.wentRight = function(event){
    
         this.myPhotoDivElement.mojo.leftUrlProvided('images/icons/0.png');
         this.myPhotoDivElement.mojo.rightUrlProvided('images/icons/2.png');
    
    }
    both assume the current center image is 1.png, which you can check with this.myPhotoDivElement.mojo.getCurrentParams() set to a variable like 'result', and then another variable will be then set to result.sourceImage. something like this:

    Code:
    result = this.myPhotoDivElement.mojo.getCurrentParams();
    image = result.sourceImage;
    hopefully that helps. i change the image each time i move to the left or right when i'm pulling random images, but i want to keep them in order when i am moving through them sequentially. you'll see the app, Small Wonders, when it's in the catalog in a few days (hopefully). you can buy it for $1 and check it out if you'd like. that's all i've got. hopefully it clears things up for you a bit. took me a bit to realize i'm not picking the left image as i move left - that it was already picked. when i move to the left, i'm picking the NEXT left image (and right image in my case).

    so, when i mentioned i use the tap event, it's so that if a smaller kid/baby touches the screen, it will update the image. in that case i update left and right, but set the current image to this.myPhotoDivElement.mojo.centerUrlProvided(your path and file name).

    let me know if you have any questions.
    Last edited by shanerooni; 02/20/2010 at 05:28 AM.
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix

Posting Permissions