Alert Javascript using UIAlertSheet

Discussion in 'Jiggy Runtime Development' started by pippin418, Jul 8, 2008.

  1. pippin418

    pippin418 New Member

    Joined:
    Jan 19, 2008
    Messages:
    10
    Likes Received:
    0
    So what I want to do is display an alert with the title as the title instead of "Jiggy", of my app and I have this code but when I run my app it says UIAlertSheet is not defined on line 3 (1 for you guys). Here's the code.

    var sheet = new UIAlertSheet( "" , [ "OK" ] , 0 );
    sheet.setAlertSheetStyle(0);
    sheet.setTitle( "Wallpaper Viewer" );
    sheet.setBodyText( "This app lets you view the wallpaper of your iPod with no icons whatsoever. Tap the home button to see them again." );
    sheet.onButtonClicked = function( button )
    {
    if ( button == 1 )
    {
    sheet.dismiss(true);
    }
    };
    Why doesn't this work??

    Please Register or Log in to view images

    Please Register or Log in to view images

    Please Register or Log in to view images

  2. godogshomie

    godogshomie New Member

    Joined:
    Nov 19, 2007
    Messages:
    558
    Likes Received:
    3
    dont know if this is what you want, or if it will work but try putting it between
    Code:
    var onLoad{
    
    }
    
  3. pippin418

    pippin418 New Member

    Joined:
    Jan 19, 2008
    Messages:
    10
    Likes Received:
    0
    no that didn't work
  4. PAEz

    PAEz New Member

    Joined:
    Jan 29, 2008
    Messages:
    201
    Likes Received:
    10
    Did you remember to put this before all that code?.....
    Plugins.load( "UIKit" );
  5. pippin418

    pippin418 New Member

    Joined:
    Jan 19, 2008
    Messages:
    10
    Likes Received:
    0
    Yes I just remembered and it stopped with the error but my alert doesn't come up. This is what I have:

    // com.thelivexs.wallpaperviewer
    // /Applications/Wallpaper Viewer.app/main.js

    Plugins.load( "UIKit" );

    var sheet = new UIAlertSheet( "" , [ "OK" ] , 0 );
    sheet.setAlertSheetStyle(0);
    sheet.setTitle( "Wallpaper Viewer" );
    sheet.setBodyText( "This app lets you view the wallpaper of your iPod with no icons whatsoever. Tap the home button to see them again." );
    sheet.onButtonClicked = function( button )
    {
    if ( button == 1 )
    {
    sheet.dismiss(true);
    }
    };

    //var window = new UIWindow( UIHardware.fullScreenApplicationContentRect );
    //window.setHidden( false );
    //window.orderFront();
    //window.makeKey();
    //window.backgroundColor = [ 1 , 1 , 1 , 1 ];

    //var mainView = new UIView();
    //window.setContentView( mainView );
    //var button1 = new UITextLabel( [ 20 , 52 , 45, 40 ] );
  6. e.mann30

    e.mann30 New Member

    Joined:
    Nov 13, 2007
    Messages:
    427
    Likes Received:
    8
    Try playing around with it a little. Add a extra } on the end , or remove the ; on the last bracket. I know they come in pairs but some where in your code I think you may have a extra bracket thats not paired up.
  7. pippin418

    pippin418 New Member

    Joined:
    Jan 19, 2008
    Messages:
    10
    Likes Received:
    0
    That didn't work either. And if anyone knows how to do the following...

    1. Get a striped background in your app (like Settings)

    please post.
  8. PAEz

    PAEz New Member

    Joined:
    Jan 29, 2008
    Messages:
    201
    Likes Received:
    10
  9. pippin418

    pippin418 New Member

    Joined:
    Jan 19, 2008
    Messages:
    10
    Likes Received:
    0
    I took what i needed from that but... it didn't work either. Of course that script has things I didn't want like textfields I removed them but it didn't work. So I still have the same old I posted earlier. This is confusing...
  10. spoonforknife

    spoonforknife Retired Moderator

    Joined:
    Nov 15, 2007
    Messages:
    6,896
    Likes Received:
    317
    Load the window first, as in the var window code and what not.
    You must have a window and a mainView to do anything.

    For the title, add this to your alert.

    alert.setTitle("Your Title Here");

    For your alert to show up, add this code where you want it to show up.

    alert.popupAlertAnimated(true);

Share This Page