Display one div at a time from an array?
I am trying to make a multiple choice quiz. I have each question and answer in a div. There are 20 divs. All are set to not display on the stage, and I want to call one randomly to display as the user answers that question.
For the moment, I am trying to get even one question to display on the stage. Here is my code, which is at the top in the edgeActions.js file inside the first function.
//Edge code
(function($, Edge, compId){
var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes
//my code
var divs = new Array( 'div.ques1', 'div.ques2', 'div.ques3', 'div.ques4', 'div.ques5', 'div.ques6', 'div.ques7', 'div.ques8', 'div.ques9', 'div.ques10', 'div.ques11', 'div.ques12', 'div.ques13', 'div.ques14', 'div.ques15', 'div.ques16', 'div.ques17', 'div.ques18', 'div.ques19', 'div.ques20' ), idx;
var idx = Math.floor(Math.random()*divs.length);
function getQuestion() {
//the following commands do not work
$('idx').show();
$('idx').css('display','inline');
$('divs[idx]').appendTo(document.body);
$('sym.que2').show();
$('que2').show();
$('div.ques1').show();
$('ques2').show();
//these do work
alert("blah");
console.log('this is working');
console.log('id=%d', idx);
getQuestion();
Since the console is returning the random number from the array, I have a feeling Edge cannot distinguish the array number from the corresponding div. Converting them to symbols does nothing. I am starting to think it would have been easier to just hand code this rather than using Edge.
Hi Elaine,
Thank you for your response!
Your new randomize line worked beautifully
I have tried defining my array elements in every connotation I can think of, inlcuding changing them to symbols. I did figure out today that an element has to be displayed before it will even be hit by jQuery, [.show() will not work] and if autoplay is checked while they are off, they will show, and vice versa. Confusing, but it narrowed it down enough for me to see I really just needed to figure out how to call the elements, then figure out all the on/off/autoplay stuff from there.
Here is my new code in its new location, the compositionReady panel:
var divs = new Array( 'Symbol_1', 'Symbol_2', 'Symbol_3', 'Symbol_4', 'Symbol_5', 'Symbol_6', 'Symbol_7', 'Symbol_8', 'Symbol_9', 'Symbol_10', 'Symbol_11', 'Symbol_12', 'Symbol_13', 'Symbol_14', 'Symbol_15',
'Symbol_16', 'Symbol_17', 'Symbol_18', 'Symbol_19', 'Symbol_20' ); // display is on for all symbols
sym.setVariable("myArr", divs);
var random = Math.floor(Math.random() * 100) % 20;
console.log( divs ); //works
console.log( "myArr" ); //works
console.log( random ); //works
function getQuestion() {
sym.$("myArr").hide(); // doesn't work
sym.$("myArr").hide(); //doesn't work
console.log('this is working'); //works
console.log('id=%d', random); //works
getQuestion();
All of the questions are showing at once and I want to be able to hide all of them.
Array[20]
0: "Symbol_1"
1: "Symbol_2"
2: "Symbol_3"
3: "Symbol_4"
4: "Symbol_5"
5: "Symbol_6"
6: "Symbol_7"
7: "Symbol_8"
8: "Symbol_9"
9: "Symbol_10"
10: "Symbol_11"
11: "Symbol_12"
12: "Symbol_13"
13: "Symbol_14"
14: "Symbol_15"
15: "Symbol_16"
16: "Symbol_17"
17: "Symbol_18"
18: "Symbol_19"
19: "Symbol_20"
length: 20
myArr
17
this is working
17
Similar Messages
-
Displaying one record at a time
Is any body able to help me? I need to display one record at a time from a Select statement.
Could I copy the results of the Select query from a table into an array for later display or is there a better alternative.
Please, any part knowledge with regard to the above would be usefull.
Regards
EddieWhat application do you want to use to display the data?
You can use "rownum" in your SQL statement to ensure that you only get record N of a query. Asktom has a good article on this sort of windowing
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
More commonly, however, you'll write a SQL query that returns all the rows, fetch a small number, display those to the user, and then fetch more records.
Justin -
**HOW DO I DELETE ONE CALL AT A TIME FROM MY IPHONE 4???**
Please help I can't delete one call at a time from my call log!!
Lol! I'm not cheating on anyone, never have... I just delete multiples of calls so my phone doesn't get too filled up.. But I'm also guessing now that I have an iPhone and not an htc I won't have a space issue. Thanks very much!!
-
I would like to share a tip about how to play a playlist one song at a time from iTunes on a computer. The tip I am sharing is simple, but I was not able to find it in the iTunes Help. After searching on the internet I found the idea for this solution in a discussion in which this was presented as a frustrating problem rather than a desired behavior. This tip relies on the checkbox for each song in iTunes. For a song in a playlist to play automatically, the checkbox must be checked. To keep a song from playing in a playlist, simply uncheck it. Therefore, to keep all songs from playing automatically in a playlist, simply uncheck them all. Now you have a list of desired songs in a desired order but none of them will play automatically. You can play each one when you want to play it without having to search for the next song and without having to be at the computer to stop the playing after each song.
Step by step:
1. Create the playlist.
2. Uncheck all of the check boxes in the playlist (In iTunes for Windows, ctrl click one of the check marks to uncheck all of the checkboxes at once)
3. Now double click (or select and press spacebar) a song to play it. It will stop when finished because there is no other song checked to be played next.
4. If you want to change back to normal sequential play, ctrl click one of the check marks again to change all of the checkboxes back to the checked status.
Based on some discussions I found while looking for a solution (including at least one in which the questioner got bashed about why anybody would ever want to do such a thing and in which the proposed solutions were things like creating one song playlists or simply press stop after each song), some may not understand why this would ever be desired. Here's why I wanted to do it:
I was responsible for playing a series of songs at a dance. I needed to stop after each song to have a transition time to allow me to introduce the next song and to give new dancers time to get onto the floor and other dancers an opportunity to leave the floor. Furthermore, I was also dancing and didn't want to have to spend time searching for the next song (which is why I wanted to create a playlist in advance with just the songs I wanted to play in the order I wanted to play them) and I wanted each song to stop after playing since I was not at the computer to press stop.
I hope this will help others who have a similar need.Thank you! I put some self help hypnosis tracks to listen to on my iPod. I did not want to go to the next track automatically, I wanted to listen to them individually, one at a time. (If I fell asleep, I did not want to 'wake up' in the middle of a different track.) Your information helps me understand that I need to re-load this playlist onto my iPod from my Mac computer, only first, I need to UNCHECK the boxes in front of each track so the iPod will STOP each time after playing the selected track. It is too bad that so many functions are not availabvle within the iPod, but that is probably why they can make it so compact.
-
How do I delete one item at a time from trash?
How does one delete one item at a time from trash?
In general, one doesn't.
I suggest you create a new folder (I use "Trash Soon") on the desktop near the trash icon. Move all the stuff out of the Trash bin into the Trash Soon Folder. Then move the things you really want to eliminate to the Trash can. Empty Trash.
DO NOT store anything you want to keep in the real Trash can. There are many activities that may cause "Empty Trash" a a side-effect.
If you have multiple drives, The Trash is an illusion created for your convenience. The actual Items may be on several different drives, but all marked as "in Trash". Moving them to a folder on a different drive may cause unexpected copying. -
TS3899 How do I delete more than one email at a time from my i phone 5C
How do I delete more than one email at a time from my i phone 5C
With your Mail app open and the listing of the messages, tap Edit at the top right. Then check each circle on the left side of the messages to delete. When you have checked those to delete, tap Trash at the lower right.
Next tap Mailboxes upper left, under accounts select the account, then for the account tap Trash. Select Edit upper right, and at the bottom, Delete All, and confirm Delete All and all will be removed at one time. -
Copy more than one clip at a time from iPhoto to iMovie?? Please help!
Is it possible to copy more than one clip at a time from iPhoto to iMovie? I can't find a way to select/copy more than one.
OK you can leave them in iPhoto and access them from the iMovie Event for iPhoto.
If you prefer to move them to a regular iMovie Event, you can do the following.
1) right-click on one of the iPhoto clips and select "Reveal in Finder". This will open a finder window showing the clips in the iPhoto Library.
2) In a different Finder window, create a folder to hold your event in iMovie. If you are using an internal drive, create a folder using your desired Event Name under the Movies/iMovie Events Folder.
Note: If you are using an external drive, create a Folder called iMovie Events at the top level of the external drive. Then create the (Event Name) folder under this. The external drive must be formatted as MacOS Extended (journaled) for this to work.
3) Select all the clips in the iPhoto finder window that are part of this event and Move them to the Movies/iMovie Event/(Event Name) folder.
4) After you have done this for all the Events, open iMovie and let it generate thumbnails. This may take a while. -
Deleting more than one file at a time from Nomad Jukebox Zen Xtra 4
Is there a way to delete more than one file at a time from Zen Xtra? Actually, I'd like to delete most of the 800+ files and the only way I've found is to do them one at a time..! Help!
Either use finder to drag and drop those tracks onto
"Library" in iTunes' left "Source" column or from
iTunes Menu Files use "Add to Library ..." then
navigate to a folder that keep a yoru tracks and
select that folder.
This did it! I was doing an "import" which would only let me do one song at a time. But the "add to library" and the drag and drop both worked. Thanks!!!
New Mac user
Scott in Alaska
MacBookPro Mac OS X (10.4.5) -
Read one word at a time from a text file
I want to read one word at a time from a text file as it is done by "scanf &s" function in text based programme. It is not possible by " read from text" function. Suggest me function or method to solve this.
The simplest way is to use the spreadsheet string to array function with the space character as the delimiter.
Note that this won't work unless there is a space character between the words - it won't work with line feeds / carriage returns between the words but you could always split the string into lines first. You may also want to trim whitespace to remove any other non-visible characters (e.g. tab, line feeds) from around the word.
If you need something more sophisticated that splits based on whitespace (e.g. tab, new line) then you'll probably need to do something with searching the string for these characters (e.g. using a regular expression) and then splitting them yourself into an array.
Of course...if you actually want to just read one word at a time from the file rather than just split the file into words (I assumed you meant this), you will need to read the file byte by byte using the low level file IO functions, build a buffer of the bytes and check the character you've read to see if it a space.
Certified LabVIEW Architect, Certified TestStand Developer
NI Days (and A&DF): 2010, 2011, 2013, 2014
NI Week: 2012, 2014
Knowledgeable in all things Giant Tetris and WebSockets -
Can you add one picture at a time from a camera to iPhoto?
Is it possible to enter one picture at a time from a camera to iphoto?
I use my Eye-Fi SD card to upload one picture at a atime through its "Direct Mode" option. You can connect an iPhone or iPad to the card's own Wi-Fi network and download pictures.
http://www.eye.fi/
http://www.eye.fi/how-it-works/features/direct-mode
-Doug -
How can I display one line at a time on a PPT slide
I am using OFFICE for the Mac (2008).
In the past, I have known how to do this using PPT on a Windows PC..
But something has changed and I can no longer figure out how to get each line on a PPT slide to appear one line at a time every time I click it.
It's not that difficult, but I can't figured out where they moved the "Appear" option.
I am NOT using KEYNOTE, but PowerPoint from OFFICE for the Mac (2008)
Can someone help me.
Thanks,
TomSince this is a Keynote discussion forum, there may be no one here that knows. I personally hate PP and could care less about how to make one line display at a time. It is easy on Keynote and that is all I need to know. You might want to look for a PP forum and ask there.
-
How to send data one row at a time from xml to flex
I want to setTimerEvent while sending data from xml to flex, one row at a time.
I have attached the xml.
Thanks in advance.Hi Greg,
Thanks for the reply. You must have seen the xml which i have attached.Here is the .mxml code which i have written:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="accountData.send()">
<mx:Script>
<![CDATA[
import mx.controls.*;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.collections.ArrayCollection;
[Bindable]
private var AccountInformation:ArrayCollection;
private function AccountHandler(evt:ResultEvent):void
AccountInformation = evt.result.xml.AccInfo;
private function faultHandler(evt:FaultEvent):void
var faultMessage:String = "Could not connect with XML file";
Alert.show(faultMessage, "Error opening file");
]]>
</mx:Script>
<mx:HTTPService id="accountData" url="pgm1.xml" result="AccountHandler(event)" fault="faultHandler(event)" />
<mx:DataGrid x="20" y="24" width="950" dataProvider="{AccountInformation}" />
</mx:Application>
This reads and displays all the rows. But I want to display single row at a time with sometime time gap between the display of two consecutive rows.I am new to flex and this is my first code, so need your help on this.
I hope i have made myself clear. If there is anything else please let me know.
Looking forward to some solution.
Thanks in advance.
Regards,
praj58 -
Displaying one page at a time in a form
I have a bunch of different single-page forms for people to fill out but they only will be filling out one of them at a time. I want to create one pdf document that contains all the different forms available (about 50 different pages) but only displays one of them at a time. I was wondering if there was a way to have someone chose what form they wanted to fill out when they opened the pdf and then only allow them to view that one page. Any thoughts on how to do this would be a great help!
Thanks for the help so far. I think the solution that I am going to try to go with is creating a file that has all the forms in it and setting it so that all the visibility is off for all layers and fields when it opens. A pop up comes up and prompts the user to chose several options which are necessary to determine the form they should fill out. Then I will extract that page from the main document into a new pdf and turn on the visibility of that page. I've read conflicting things online about extracting a page to create a new pdf. If I don't specify a path to save the new pdf to will it just allow the user to save it on their own or will this solution not work?
-
i am trying to display one record from my database on my jsp page per time using next and previous buttons to navigate. I have tried to implement this by putting the resultset in a vector and then tried to tried to dispaly data with no success.Please somebody help ,i been at this for two days with no success.Could someone give a concreate example to guide me
Please post all code, i dont know how to put my resultset in a vector or arraylist.
I need a First Previous next and Last link in asp it is called recordset paging or recordset navigation.
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="Connections/connEvents.jsp" %>
<%
int index = 0; //or wherever you wish to start
if((String s = request.getParameter("index")) != null)
index = Integer.parseInt(s);
%>
<%
Driver DriverrsEvents = (Driver)Class.forName(connEvents_DRIVER).newInstance();
Connection ConnrsEvents = DriverManager.getConnection(connEvents_STRING,connEvents_USERNAME,connEvents_PASSWORD);
//PreparedStatement StatementrsEvents = ConnrsEvents.prepareStatement("SELECT * FROM hog_evenementen", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
//StatementrsEvents.setFetchSize(10);
//ResultSet rsEvents = StatementrsEvents.executeQuery();
PreparedStatement StatementrsEvents = ConnrsEvents.prepareStatement("SELECT * FROM hog_evenementen");
ResultSet rsEvents = StatementrsEvents.executeQuery();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HD - Evenementen-beheer</title>
<style type="text/css">
<!--
body {
background-color: #333333;
-->
</style></head>
<script>
function post(actValue)
document.MyForm.action.value = actValue ;
document.MyForm.submit() ;
</script>
<body>
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" class="">
<tr>
<td><table width="100%" class="" border="0" cellpadding="6" cellspacing="0">
<tr>
<td width="175" align="center" valign="bottom" bgcolor="#FF6600" class="">Evenementen-beheer</td>
<td bgcolor="#333333" class=""><span class=""><span class="formField">
</span></span></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr bgcolor="#61ABD0" class="verdana10zwart">
<td width="4"> </td>
<td width="512" height="29"> <span class="">Evenementenoverzicht</span></td>
</tr>
<tr bgcolor="#61ABD0" class="">
<td> </td>
<td><table width="100%" border="0" align="center" cellpadding="6" cellspacing="0">
<tr class="">
<td width="252" class="smallText">record 1 van 1 etc moet hier komen <br></td>
<td width="231" align="left" class="smallText"><table width="50%" border="0" align="center">
<tr>
<td width="23%" align="center"> Firs </td>
<td width="23%" align="center"> <a href="index.jsp?index=<%= (index-10)%>">Previous</a></td>
<td width="23%" align="center"><a href="index.jsp?index=<%= (index+10)%>">Next</a></td>
<td width="23%" align="center">Last</td>
</tr>
</table>
<br>
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td>Thema</td>
<td>Datum</td>
</tr>
<%
int rowCount = 0;
while(rsEvents.next() && rowCount < 10) {
rowCount++;
%>
<tr>
<td><a href="event_crud.jsp?ID=<%= rsEvents.getObject(ID")%">"><%= rsEvents.getObject("thema")%></a></td>
<td width="231"><%= rsEvents.getObject("datum")%></td>
</tr>
<% } %>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><form action="event_frm_process.jsp" METHOD="POST" name="MyForm" id="MyForm">
<table width="100%" border="0" cellpadding="6" cellspacing="0" class="verdana10zwart">
<tr bgcolor="#CCCCCC">
<td width="9"> </td>
<td colspan="2"><span class="kop1"><br>
Evenement toevoegen </span><span class="formField"><br>
</span><br>
<span class="formField"> </span></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="9"> </td>
<td width="107" class="downBorder">Thema:</td>
<td width="383" class="downBorder"><input name="thema" type="text" id="thema"></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="9"> </td>
<td class="downBorder">Omschrijving:</td>
<td class="downBorder"><textarea name="omschrijving" cols="40" rows="10" id="omschrijving"></textarea>
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="9"> </td>
<td class="downBorder">Datum:</td>
<td class="downBorder"><input name="datum" type="text" id="datum"></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="9"> </td>
<td class="downBorder">Tijd:</td>
<td class="downBorder"><input name="tijd" type="text" id="tijd"></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="9"> </td>
<td class="downBorder">Lokatie:</td>
<td class="downBorder"><input name="lokatie" type="text" id="lokatie"></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="9"> </td>
<td class="downBorder">Plaatje:</td>
<td class="downBorder"><input name="plaatje" type="text" id="plaatje"></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="9"> </td>
<td class="downBorder"> </td>
<td class="downBorder"><input name="insert" type="button" id="insert" onClick="post('insert');return false;" value="Evenement toevoegen"></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="9"> </td>
<td>
<input name="action" type="hidden" class="" id="action" value="">
<% while(rsEvents.next()){ %>
<input name="ID" type="hidden" class="" id="ID" value="<%=rsEvents.getString("ID")%>">
<%
%>
</td>
<td> </td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
<%
rsEvents.close();
StatementrsEvents.close();
ConnrsEvents.close();
%></a> -
View more than one sheet at a time from the same file?
I'm trying to view two different sheets at the same time from one file. This was possible in excel by opening a "new" window. Does anyone know how to do this in numbers?
Thanks for the help,Skigilboa wrote:
I'm trying to view two different sheets at the same time from one file. This was possible in excel by opening a "new" window. Does anyone know how to do this in numbers?
You know what: Happily, _*Numbers is definitively not a clone of Excel*_ !
It's not forced to duplicate every features of this program !
We may see every tables of a given sheet
but we can't see tables of two sheets simultaneously.
This feature is very important because it's linked to
the one which allow us to have different orientation for different sheets.
Yvan KOENIG (VALLAURIS, France) dimanche 13 septembre 2009 15:04:06
Maybe you are looking for
-
OIM 11g R2 - Setting a field as mandatory while provisioning through catalo
Hi, May I know how i can make a field as mandatory (Red Asterick) while trying to provision an account through catalog wizard.I dont see any option to set required=true while creating a form for an application instance.Thanks.
-
Connect Apple TV to MBP without a router
Hello Apple TV experts, hope you are having a good day. My sister is out in the woods in Virginia in her 5th wheel trailer. She has a nice TV/Stereo setup but only gets over the air TV. She has movies on her MacBook Pro and wants to watch on the TV.
-
Send video to tv with iphone 4s
Hi, how do I send video to my Tv using a component AV cable on my 4s ?
-
SDN is a best-practice example in a Novell success story
Regular SDNers might be interested to see SDN used as a "success story" by Novell for their eDirectory product. Novell produced both a pdf and has the success story easily accessible on the Novell website at http://www.novell.com/success/sap.html I
-
Which functions are not able with yesss supersmart? Thank you very much
Thank you Günther