Display random image

Hey all. Creating my first form in LiveCycle. Haven't a clue as to what I'm doing... maybe someone can help.
I don't know javascript, so I usually just use trial and error until I figure it out... but I just can't get this to work.
I have 20 images on my form (named ImageField#hg), invisible. I want to display a random image when I click a button.
Here is the code I thought would work.... it's placed in the Click script section on a button.
var one = "ImageField";
var two = "hg";
var rannumb = Math.floor(Math.random() * 19+1);
var showg = one + rannumb + two;
showg.presence = "visible";
If I test the output in a text box, I get ImageField#hg (# being the random number), so why doesn't it actually execute the .presence action?
Thank you.
-James

I've been trying to change my thinking on this and came up with different code, but it still won't work properly.
This frist script actually does change the images to visible... however, it's processing the variable for some reason and both images become visible on click. I didn't know variable would do anything unless called.
var one = ImageField1hg.presence = "visible";
var two = ImageField2hg.presence = "visible";
var rannumb = Math.floor(Math.random() * 19+1);
var newnumb = WordNum(rannumb);
testing.rawValue = newnumb; // test field to see output doesn't show anything
newnumb;
So I changed the script to the following and it does nothing.
var one = ImageField1hg.presence;
var two = ImageField2hg.presence;
var rannumb = Math.floor(Math.random() * 19+1);
var newnumb = WordNum(rannumb);
testing.rawValue = newnumb; // test field to see output doesn't show anything
newnumb = "visible";
Back to the drawing board...

Similar Messages

  • Bridge displaying random image

    I have a MacPro with 10.5.2 and CS3. I work mostly in the Horizontal Filmstrip mode and I am having serious issues with previews. I click on a thumbnail and a random image from a completely different folder shows in the large window. Anyone else have this issue? Suggestions? Thanks.

    Yes, Scott is right. We either put up with spurious thumbnails or with blurry previews. Obviously the latter is the lesser of the two evils.
    After
    UNchecking High-quality Previews in Bridge, you need to quit and re-launch Bridge, then painstakingly Purge the Cache for each darned folder, one by one, through the Tools menu in Bridge.
    DO NOT use the global Purge Cache command because that one is broken. If you use it, the cache will NOT rebuild properly.
    Unfortunately, I've given up all hope of Adobe fixing it, as CS4 is around the corner, a version to which I have no plans to upgrade. :/

  • Display Random Images in Website

    I'm looking for a relatively simple way to randomize images
    in a website. This would appear in the same spot on each web page.
    I'm not a strong code-writer (yet). Thansk!

    "tspencer" <[email protected]> wrote in
    message
    news:g3gd7h$34o$[email protected]..
    > I'm looking for a relatively simple way to randomize
    images in a website.
    > This would appear in the same spot on each web page.
    >
    > I'm not a strong code-writer (yet). Thansk!
    This guy sells a good script for this for $9.95 -
    http://www.kaosweaver.com/extensions/details.php?id=5
    It might be worth the $10, since it'll be way easier than
    finding and
    installing a free script.
    Patty Ayers | www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet

  • Random images display strong yellow/green cast

    system - 24" intel iMac, 3ghz, 2gb, 500bg hd, NVIDIA GeForce 8800 GS with 512MB memory, OS 10.5.4. Just purchased.
    System runs fine, and I love the machine. Problem is random images, jpegs, raw, illustrator files, display an awful yellowish tint, both in the preview and when opened in PS or preview. Just random, sometimes a whole folder of images, sometimes just a few. I, of course tested some of the same images on another mac, and they viewed correctly. If I save a copy to the desktop, the icon looks correct, but when opened it looks like puke. Also happens in front row when displaying certain album covers and video trailer art.
    Anyone else run into this?
    -h

    Hello Double H Media
    Welcome to Apple Discussions!
    Unfortunately the OP and others appear to have the same issue possibly related to the GeForce 8800 GS, see the following thread!
    http://discussions.apple.com/thread.jspa?messageID=7224138&#7224138
    Dennis

  • Random display of images!!

    Hi
    I'm following the previous post and accordingly i was able to display a image on the iView.
    Now I've a list of images
      say image1.jpg, image2.jpg, image3.jpg and so on..
    Now i want to pick any one of them and display any one of them. how do i go about this.
    Following is the code which i wrote can't find the error in it.
    <script type="javascript">
    var images = new Array();
    images[0] = "/images/birds.jpg";
    images[1] = "/images/child.jpg";
    images[2] = "/images/dolphin1.jpg";
    images[3] = "/images/dolphin2.jpg";
    images[4] = "/images/fish.jpg";
    images[5] = "/images/kayak.jpg";
    images[6] = "/images/man.jpg";
    images[7] = "/images/pasture1.jpg";
    images[8] = "/images/pasture2.jpg";
    images[9] = "/images/pasture3.jpg";
    images[10] = "/images/runner.jpg";
    var rannum = Math.floor(Math.random()*11)
    var choice = images[rannum];
    </script>
    <% String image2 = componentRequest.getWebResourcePath() + "/images/insidetrack3.gif"; %>
    <% String image1 = componentRequest.getWebResourcePath() + "/images/pasture1.jpg";%>
    <IMG SRC="<%=image1%>" WIDTH="340" HEIGHT="238" BORDER="0" ALIGN="left">
    <IMG SRC="<%=image2%>" WIDTH="360" HEIGHT="238" BORDER="0">
    can anyone help me out.
    Thanks in advance
    Srikant

    Hi,
    what are you trying to achieve?
    You render static images on the page and some JavaScript
    that holds a collection of URL's to other images.
    From this collection you basically pick 1 with the Math.random() call and store the url in a variable choice. Well... storing a URL string in a variable does usually not make any Image Object visible.
    If you want to apply the image to an existing image on the page you have to do that via JavaScript,
    basically like this:
    <script type="javascript">
    var images = new Array();
    images[0] = "/images/birds.jpg";
    images[1] = "/images/child.jpg";
    images[2] = "/images/dolphin1.jpg";
    images[3] = "/images/dolphin2.jpg";
    images[4] = "/images/fish.jpg";
    images[5] = "/images/kayak.jpg";
    images[6] = "/images/man.jpg";
    images[7] = "/images/pasture1.jpg";
    images[8] = "/images/pasture2.jpg";
    images[9] = "/images/pasture3.jpg";
    images[10] = "/images/runner.jpg";
    var rannum = Math.floor(Math.random()*11)
    var choice = images[rannum];
    <b>document.getElementById("myimage1").src=choice;
    document.getElementById("myimage2").src=choice;</b>
    </script>
    <% String image2 = componentRequest.getWebResourcePath() + "/images/insidetrack3.gif"; %>
    <% String image1 = componentRequest.getWebResourcePath() + "/images/pasture1.jpg";%>
    <IMG <b>id=myimage1</b> SRC="<%=image1%>" WIDTH="340" HEIGHT="238" BORDER="0" ALIGN="left">
    <IMG <b>id=myimage2</b> SRC="<%=image2%>" WIDTH="360" HEIGHT="238" BORDER="0">
    If you like to do the random part on the server side you should also have you Array of URL's and the random call on the server side.
    Best Regards
    Martin

  • Using PHP to display semi-random images?

    Hello,
    I'm looking for help using PHP and MySQL to generate semi-random images on my web site. Here's what I'm trying to do: I have 60 images, but I only want to display 16 at a time (for examlpe http://artisdead.net/antelopegardens.php).
    The way I imagine this is, the design has 16 image placeholders. I want Placeholder 1 (the first image) to randomally pull record ID 1, 2, or 3 from the SQL database, while Placeholder 2 pulls record ID 4-6, etc. It's important that one of the first 3 images displays first, while one of the second 3 images displays next, etc.
    I've found various ways to randomize all the images, but I'm not understanding how to constrain the randomization the way I'm looking to. Any help would be greatly appreciated. Thanks in advance.

    Alamo_Melt wrote:
     The way I imagine this is, the design has 16 image placeholders. I want Placeholder 1 (the first image) to randomally pull record ID 1, 2, or 3 from the SQL database, while Placeholder 2 pulls record ID 4-6, etc. It's important that one of the first 3 images displays first, while one of the second 3 images displays next, etc.
    Before offering a possible solution, I should point out that your plan has a minor flaw. If you display only 16 images, and want the random choice to come from incremental sets of three, the maximum number you can have in your set is 48. The final 12 images will never be selected. For 60 images, you need 20 placeholders. The alternative is to have a total set of 64 images, and make the random choice come from incremental sets of four images.
    With that caveat, here's how I would do it. The primary keys of your records might not be consecutive, particularly if records are deleted and new ones added, so it might be a good idea to have a separate column with consecutive numbers from 1 to the the maximum. To select random numbers from incremental groups of three, use the following:
    $id = array();
    $min = 1;
    $max = 3;
    for ($i = 0; $i < 16; $i++) {
      // generate random number from current set
      $id[$i] = mt_rand($min, $max);
      // increment the minimum and maximum numbers for the next set
      $min += 3;
      $max += 3;
    // join the selected values as a comma-separated string
    $vals = implode(',', $id);
    $sql = "SELECT image FROM images WHERE id IN ($vals)";
    // excecute the SQL query

  • Random Image not displaying in Live View.

    My page is at:
    www.andrewjamesartist.co.uk
    There's a random image script on the front page.
    <img src="randomimages/rotate.php" alt="A Sample Image from the work of Andrew James" />
    That's how it is placed in the page.
    It shows in preview in browser and it's OK live but it doesn't show in LiveView.
    I use a testing server set up with virtual hosts.
    Martin

    My page is at:
    www.andrewjamesartist.co.uk
    There's a random image script on the front page.
    <img src="randomimages/rotate.php" alt="A Sample Image from the work of Andrew James" />
    That's how it is placed in the page.
    It shows in preview in browser and it's OK live but it doesn't show in LiveView.
    I use a testing server set up with virtual hosts.
    Martin

  • JPG won't display in Image box.

    Trying to add a logo in JPG format to the top of the form using the Image control, but it won't display the image nor print it. If I use a GIF file it works fine, but looks horrible. I'm new at this, any ideas?

    I finally figured it out after posting another frustrating comment to this thread. I can't take the credit, however, as it was quickly solved by Irv Kanode in another thread. I have copied his exact post below. It solved this issue in seconds:
    ADOBE SUPPORT REPLY:
    Irv Kanode - 4:15pm May 5, 06 PST (#1 of 2)
    Check some of your JPEGs for CMYK vs RGB.
    Might the ones that fail be CMYK and the ones that work be RGB?
    When images don't work are you seeing a broken image icon or...?
    Irv
    Adobe Support
    USER FOLLOWUP TO ADOBE SUPPORT SUGGESTION:
    Kurt Wedberg - 5:27pm May 5, 06 PST (#2 of 2)
    Irv,
    Thanks for the reply. The images that didn't work were CMYK. When I converted to RGB they worked.
    The images that didn't work were coming up with random grey scale colors.
    Thanks again,
    Kurt
    Hope this helps everyone!

  • Pull random images from iPhoto library folders

    I'm trying to come up with a script to pull random images from my iPhoto library and copy them to another folder that I can then use with another program (GeekTool) to display them on my desktop.
    What I'd like to be able to do is pull 30-50 of these images at a time. I can use GeekTool to call the script at a given interval (eg. every half hour) and have a completely different set of images everytime the script is run.
    I'm a complete obliviot when it comes to applescripting, so I'm at the mercy of the experts. I've managed to find a couple of scripts that can do something similar with the screensaver, but I'm unable to figure out the script enough to make it do what I need.
    Any help would be much appreciated. Thanks.
    brad

    You should post your question on the iPhoto forum.
    http://discussions.apple.com/category.jspa?categoryID=143
    Make sure you post your question in the appropriate iPhoto forum based on which version of iPhoto you have (4, 5 or 6).

  • Choose random image script

    I'm creating a small movie with a set of random images that all appear in the same spot (no horizontal or vertical movement). I want each image to appear onscreen for two seconds, then be replaced by another randomly-chosen image. There are 17 images in the set. Here is the script I'm using:
    on enterFrame
      channel=random(17)
      _movie.delay(2*60)
    on exitFrame
      go to the Frame
    end
    This script works well. However, because the population is small - only 17 - what happens when I run the script is that a little too often it randomly chooses the same image once, twice, sometimes up to five times in a row, which gives the effect that the movie is either stuck or not working properly. I would like to find out how to modify the script so that on exitFrame it chooses randomly any of the other 16 images but not the current image. At first I thought if the script read random(16) or random(17-1) that might work, but it doesn't.
    Any thoughts would be welcome.
    Dallas

    Hi Sean,
    This randomizing project of mine is becoming more complex than I first realized and I now have another question that I hope you might be able to help me with.
    The project breaks down into class, category, group and member. There are 9 classes (and perhaps a possibility in the future that further classes could be added). The structure and naming convention within each class is identical down to the member level. For example, Cat. 1 of Class 2 and Cat 1 of Class 7 both have the same names. Group 3 of Cat. 1 of Class 2 and Group 3 of Cat 1 of Class 6 both have the same names. However, the members of these groups do not have the same names.
    In each class there are 4 categories, each with a different name. Each category contains a number of groups (each group has a different name). Each group contains a number of members. Each member in categories 1 and 2 is a bitmap image. The total number of bitmap members in the project is 21.
    To give a fictionalized example (this project is not about clothing, but I'm using it as an example):
    Class 1 = shirts
    Class 2 = hats
    Class 3 = pants
    Class 4 = socks
    Class 5 = shoes
    etc.
    Category 1 = British
    Category 2 = Japanese
    Category 3 = Turkish
    Category 4 = Brazilian
    Group 1 = Cotton
    Group 2 = Synthetic
    Group 3 = Speed
    Group 4 = Sound
    and so forth.
    In Class 1 (shirts) there are British, Japanese, Turkish and Brazilian shirts and these could be made of either cotton or synthetic. In addition, there are a variety of speeds and sounds from which to choose when displaying the shirts.
    In my project:
    Cat. 1 has 7 groups and each group varies in the number of members with either 7, 14 or 21 (but no other alternative to these numbers).
    Cat. 2 has 13 groups and each group has 7 members.
    Cat. 3 does not randomize images but lets me choose any one of 12 different speeds for randomization in half-second increments.
    Cat. 4 does not randomize images but lets me choose any one of 6 different sounds. Whenever the randomized image changes, this triggers the sound. The sound is not randomized but is consistent once the choice for what KIND of sound has been made. In short: tick, tick,tick, or tock, tock, tock but not tick, tock. It is possible that in the future more sounds could be added.
    Navigation should allow me to start with any of the four categories. For randomization to work, I must choose within either Cat. 1 or Cat. 2 (but not both) and I must make a choice of some sort within Cat. 3 (speed of randomization) while Cat. 4 is entirely optional (sound on or off, but not required to be on and, if it's to be on then choice for which kind of sound).
    There are also an additional two buttons for sound on or off than run the length of the score within any class, meaning that while randomization is occuring anywhere within a class, I can choose to turn the sound on if it's currently off or off if it's currently on. Turning it on while randomization is taking place will also probably require a choice of which kind of sound (meaning a floating window I suppose) so as not to exit the frame where randomization is taking place.
    Now for my question: should I create one massive behaviour script for all classes that includes a series of nested if/else statements for each category, group and member, or should I create 4 large behavior scripts, one for each category with if/else instructions for its groups and members, or should I script at the group level, which will result in 180 separate behaviour scripts for image randomization plus additional scripts for speed and sound?
    Further, I understand how to apply at the group level the script you gave me earlier (and it works beautifully), but if you think it would be more efficient now to work at the category or class level, I'm not sure how to script the if/else statements. I'm assuming that in whichever of these solutions turns out to be best, it is applied to a single sprite which will serve to display the randomly-chosen image. Bear in mind that the script you gave me randomizes the image change every two seconds. Now I'm looking to have a choice of it changing within a range of once every half-second to once every 5 seconds (e.g. 0.5 sceonds, 1 second, 1.5 seconds, 2 seconds, etc.).
    An ancillary question: could this be done a different way? A friend suggested using subroutines but wasn't able to tell me how to do this because he doesn't know anything about Lingo. I was wondering whether the if/then syntax structure is Lingo's way of doing subroutines.
    Your thoughts would be most welcome. If you think you can't help me with this, do you have any suggestions as to where I might turn for help (apart from the nuthouse at this point)?
    Cheers,
    Dallas

  • Need Random Image Script with Links

    I am needing a script for random images on my homepage. I
    need the image to have its own link depending on what image is
    displayed. I would like a php script (non database) if
    possible

    See comments on DW forum about random includes and this
    particular markup
    shown below.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "newhorizonhosting.com" <[email protected]>
    wrote in message
    news:e29on1$buf$[email protected]..
    >I figured it out by doing a random include
    >
    > <?
    > srand(time());
    > $random = (rand()%3);
    > print("$random");
    > require_once("./$random.php");
    > ?>

  • Need Random Image Script with Link

    I am needing a script for random images on my homepage. I
    need the image to have its own link depending on what image is
    displayed. I would like a php script (non database) if
    possible

    Not sure about the PHP but there are some good scrips on
    www.kaosweaver.com
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "newhorizonhosting.com" <[email protected]>
    wrote in message
    news:e28rpm$8is$[email protected]..
    >I am needing a script for random images on my homepage. I
    need the image to
    >have its own link depending on what image is displayed. I
    would like a php
    >script (non database) if possible

  • PHP random image

    Hello everyone,
    Im trying to use (for the first time) random images generated
    by PHP. I
    installed a Technorama extension and then followed thru the
    steps to place a
    random image in the page, but there is nothing there when I
    browse the page.
    Please forgive my ignorance, but I have never done any php
    stuff before.
    And yes, the files are uploaded to my server. (which does
    have php enabled).
    The practice page I am using is
    www.fionahayward.com/interiordesign/practice.php
    I have the effect working with javascript on this page
    www.fionahayward.com/interiordesign but am trying to use php
    incase people
    have javascript turned off.
    Maybe its something to do with how Ive set up Server
    Behaviours or something
    (only guessing)
    Thanks for listening
    Fiona

    1) create a php file named rotate.php in the folder where the
    images are.
    2) paste this code (between the [code ] and [/code]
    markers... into that file and save it.
    [code]
    <?php
    $folder = '.';
    $extList = array();
    $extList['gif'] = 'image/gif';
    $extList['jpg'] = 'image/jpeg';
    $extList['jpeg'] = 'image/jpeg';
    $extList['png'] = 'image/png';
    // --------------------- END CONFIGURATION
    $img = null;
    if (substr($folder,-1) != '/') {
    $folder = $folder.'/';
    if (isset($_GET['img'])) {
    $imageInfo = pathinfo($_GET['img']);
    if (
    isset( $extList[ strtolower( $imageInfo['extension'] ) ] )
    file_exists( $folder.$imageInfo['basename'] )
    $img = $folder.$imageInfo['basename'];
    } else {
    $fileList = array();
    $handle = opendir($folder);
    while ( false !== ( $file = readdir($handle) ) ) {
    $file_info = pathinfo($file);
    if (
    isset( $extList[ strtolower( $file_info['extension'] ) ] )
    $fileList[] = $file;
    closedir($handle);
    if (count($fileList) > 0) {
    $imageNumber = time() % count($fileList);
    $img = $folder.$fileList[$imageNumber];
    if ($img!=null) {
    $imageInfo = pathinfo($img);
    $contentType = 'Content-type: '.$extList[
    $imageInfo['extension'] ];
    header ($contentType);
    readfile($img);
    } else {
    if ( function_exists('imagecreate') ) {
    header ("Content-type: image/png");
    $im = @imagecreate (100, 100)
    or die ("Cannot initialize new GD image stream");
    $background_color = imagecolorallocate ($im, 255, 255, 255);
    $text_color = imagecolorallocate ($im, 0,0,0);
    imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color);
    imagepng ($im);
    imagedestroy($im);
    ?>
    [/code]
    4) in whichever file you want the random images to appear,
    reference the image so:
    src="path/to/that/image/folder/rotate.php"
    I tend to use root-relative pathing, but that part is up to
    you.
    NOTE: I've found that random image references are quirky in
    IE browsers - they seem to want the image width and height to
    display images that are dynamically selected... I've used this
    script to display images that are all the same size and groups that
    aren't. When the image size is unknown, I use width:100%
    height:100% in my css)
    email me if you have any issues with using the script. I use
    it a lot with WordPress sites, but it isn't a WP only solution.
    syncbox AT gmail DOT com (do the obvious)
    HTH

  • PHP Random Image extension

    I am trying to use the PHP random image generator but I don't
    know where to specify the size I want all the pictures to come up
    in the code. I created a "php" test page and inserted said code
    where I want the images to display but they are too large and throw
    the entire page off. Is there a way to tell it that all pictures
    should be called up at 240(width) x 350(height)? Any help would be
    greatly appreciated. The reason I am doing this is because there
    are about 200 images (of students) in this folder and coding each
    picture seperately is too time consuming.
    Regards,
    RM (using DW MX2004)

    Disregard....I figured it out. As it turns out the best
    solution would be to have your original pictures saved with the
    desired dimensions. I was able to point the PHP to a directory that
    contained pictures with said dimensions and it worked like a charm.
    regards.

  • Random image

    hi,
    i am wondering, how can i make images in grid, any image for example 10 different flowers. this flowers should displayed in grid and these flowers should displayed randomely in grids. can any one help me in source code. please!!!!!!!!!!!!!!!!.
    thank you in advance.

    The basic idea is as follows, (but please let me know if there is a more effective way to do this)
    You need have, say.. 10 Label objects (or whatever objects that is most appropriate for your program).
    BUT, before you construct these objects, that is before you call the JLabel(Icon image) constructor, you will need a method that randomly returns the path of a jpg image as an String object based on an integer value produced by an object of the Random Class. So the implementation for that method might look something like this:
    public String getRandomImage()
         Random rg = new Random();
         int numRandom = rg.nextInt(9)+1;
         switch (numRandom){
         case 1: return "images/photo1.jpg";
         case 2: return "images/photo2.jpg";
            //bla bla bla
    }and then in for constructing the label images:
    new JLabel(new ImageIcon(getRandomImage()));If you don't understand any part of this please feel free to ask.

Maybe you are looking for

  • ITunes freezes when I plug my iPod in. Please HELP

    I have a 4G 8GB iPod touch, and it hasn't been synced into iTunes for about 2 months now because iTunes always freezes when I plug my iPOd into it.(I have iTunes 10.1 or which ever one is the latest version and it just freezes). Can anyone help or ha

  • Manually edit volume of MIDI file in Java

    Hey all, I'm trying to find a way to manually change the volume (velocity) of a midi file before playback, i.e. directly in the code. This is the code I'm using to play my midi files: import javax.sound.midi.*; import java.io.*; /** Plays a midi file

  • Mail adapter - how to dinamically change attachment file name in sending

    How can I dynamically change the attachment filename when preparig email to be sent? The attachment is an invoice in XML format and I have to put the invoice number into the attachment file name. Thanks in advance. Giuseppe.

  • Mail problem serveur d'envoi OS X 10.9.2

    Mail problem I can receive the emails ...but I can't send the emails ???

  • Return value of beasvc

    Hi, If i run beasvc using 'system' command of perl, the return value i get is always '0', irrespective of whether service installation failed or succeeded. Is this a bug? Thanks, Tarkeshwar