ActionScript 1/2 :: Finding Records In A Xml File?

Jun 18, 2009

I am writing a Flash object which will be an on-line quiz. I got most of it working ok, but it reads the questions sequentially from an xml file. I want it to be random. Each record in the xml file has an 'ID' attribute. This is my code that currently reads the questions in sequential order:
 
var question = new XML();question.ignoreWhite=true;question.load("Questions.xml");
question.onLoad=function(){     question_txt=this.firstChild.childNodes[_root.record].attributes.ques tion;     answer1_txt=this.firstChild.childNodes[_root.record].attributes.answe r1;

[Code]...

There are 300 questions in the xml file. I want to assign a variable with a random number, then look in the xml file for the question which has the ID attribute matching the random number. How do I achieve this?

View 5 Replies


Similar Posts:


ActionScript 3.0 :: Creating File To Show All Records From Table In DB?

Apr 14, 2010

Ive made a php file which shows me all the records from a table in a db

PHP Code:
Actionscript Code:
<?phprequire_once 'db_config.php';$sql="SELECT * FROM guestbook";
$result=mysql_query($sql) or die(mysql_error());
$count=mysql_num_rows($result);while ($data = mysql_fetch_assoc($result)){
$id = $data"[msg_id"]; $sender = $data["msg_sender"]; $subject = $data["msg_subject"];
$text = $data["msg"]; $date = $data["msg_date"]; echo($count);
echo($id); echo($sender); echo($subject); echo($text);echo($date);}?>

Which gives me this result in a browser
Actionscript Code:
21Arnetest 1.2 3hallo, dit is een eerste test berichtje grtzzzzzzzzz2010-04-14 14:03:0022Arne Janssenshallo!test nog een keer2010-04-14 14:03:00

Now is my question:
How can I write this code better, so that flash can handle it? Do I make an array of the results?

View 5 Replies

Flash :: Flashdevelop Is Not Finding Png File

Jan 3, 2010

I am trying to load my png file to my application. here is the code

var map:mapLoader = new mapLoader();
map.loadMap("tile.png");

Then here is my file that loads it. it throws the error right when it gets to

loader.load(new URLRequest(currentMap));

if I comment it out. then the error goes away. below is the code in its entirety

package {
import flash.display.Loader;
import flash.net.URLRequest;

[Code].....

View 1 Replies

ActionScript 3.0 :: Finding The File Size In The Swf Header?

Jul 27, 2009

how to find the file size in the swf header. I am looking at the swf file format spec v10 pdf and it says that "The FileLength field is the total length of the SWF file, including the header. If this is an uncompressed SWF file (FWS signature), the FileLength field should exactly match the file size. If this is a compressed SWF file (CWS signature), the FileLength field indicates the total length of the file after decompression, and thus generally does not match the file size. Having the uncompressed size available can make the decompression process more efficient."
 
If I were to look at the hex value of a swf what would I look for to find the file size?

[Code].....

View 3 Replies

Professional :: SWF Player Not Finding The Flv File When Moving To Webpage?

Mar 10, 2011

Making simple player to allow viewing on website.Adding flv file to create a published player.Works fine after publishing on local system as long as the flv is located in the same directory as the swf player.When copying to a website, it seems the player does not know how to find the video file.

View 1 Replies

Flex :: AIR Application Not Finding Locale Properties File?

Feb 11, 2011

I have the problem that when I use a component from an existing Flex Library in my AIR project, the values that should be loaded from the appropriate locale .properties file are not loaded. The values are always null.

I am using Eclipse and have created an AIR project that refers to the existing Flex Library (of which I have the source code). When I use a component from that library it calls the following code:

var _resourceManager:IResourceManager = ResourceManager.getInstance();
var res:String = resourceManager.getString('resources', str, params);

"str" and "params" have valid values but res is always null.The properties file is located within the assets directory of the Flex library. I am deducing that the properties file is not being loaded (for some reason). This Flex library works for other Flex projects so it has to be something about the way my project is set up.

I have my compiler settings set to: -locale en_US Is there something special that AIR projects need to do to ensure that they can refer to properties files?

View 1 Replies

Professional :: How To Use UnCaughtErrorEvent - Unhanded Event Error (ioErrorEvent For Not Finding The Xml File)

May 27, 2010

I am trying to use the new unCaughtErrorEvent, as explained here: [URL] When testing the event I run across two problems:

1 - when testing the movie from the flash IDE, the uncaught error is indeed caught and handled (as in the example) BUT the original

error still gets thrown! For example, when loading an XML file that does not exist: - first the uncaughterror event gets called. (good!) - then I get an unhandled event error (ioErrorEvent for not finding the xml file). Isn't the whole point of catching uncaught errors that you can catch ALL these errors? This way it seems rather useless to me.

2 - when testing the uncaughterror handler from a html page, the debugger gives an entirely new error: VerifyError: Error #1014: Class flash.events::UncaughtErrorEvent could not be found. So for now, I'm truly baffled as to what UncaughtErrorEvent is supposed to do and why it doesn't work

View 4 Replies

List Database Records Using Amf Php

Jul 7, 2009

I'm trying to list in flash, several records that come from my database. I'm not talking about a datagrid or anything to fancy. I just want to list the values inside text boxes. (to allow editing). I already have fetch an array of records that come from the database, here:

[Code]...

My question is: How can I display several records, instead of only 1? Should I change the call to, instead of 1, uses a variable? But where would that variable comme from? Then I should loop again the addChild method for each child of form2 that needs to have different records on each of them?

View 1 Replies

ActionScript 2.0 :: Only 10 Xml Records At A Time?

Oct 19, 2006

How can i make sure i only can see the last 10 records of a xml file in flash 8?

and when clicked on a button goes to the rest after that 10 records. (this is easy)

but i don't know how to stop at 10 records at the homepage

View 2 Replies

Data Integration :: Flash To Load 10 Or 20 Records At

Dec 14, 2006

I have a created a flash searchable database with xml,following this tutorial url...It seem to be work great but my the xml file seems to be too
large so when certain words are search I get a script error and eventually freezing up, my question is Is there a way to tell flash to load the 10 or 20 records at a time? By loading sections of the xml one at a time will this stop the script error?

View 1 Replies

Flex :: Advanced Datagrid And Displying The 10 Records?

Jul 19, 2010

I have a advanced datagrid and displying the 10 records. but when loading the data, the first record should be selected.

View 1 Replies

Flex :: Charting A Count Of Records Returned?

Aug 29, 2011

I am trying to create some charts in Flex/FlashBuilder 4.5The issue I have it that the information I wish to display is the number of events within an area. I am using HTTP service to access a rails controller which is returning an XML list of the events.I need to figure out how to chart the number of events, eg number of records returned. There is no numeric value within chart, as there would be if I was charting sales or prices for example.

View 1 Replies

Flash :: Wowza Records Audio But Without Video?

Mar 29, 2012

I have a Wowza Media Server 2 running on Amazon EC2 and I've noticed from time to time a flv is recorded from a webcam using Flash that has audio but no video. It works fine most of the time but from time to time this error occurs

View 1 Replies

ActionScript 2.0 :: Pulling Back Random Xml Records?

Feb 5, 2009

I load in 8 XML records at random - the actual xml file contains about 37 + but the method i am using at the moment doesnt semm to be that random. It was done this way so i dont pull in the same record twice as i do not want duplicate entries

Code:
for (a = 0; a < randNo; a++)
{
var num:Number = xmlAd.firstChild.childNodes.length;

[Code].....

View 1 Replies

Actionscript 3.0 :: Update Multiple Records At Once Using AMFPHP?

Jul 7, 2009

programming and on AS3... have patience. :s

I have the following on my php service file :
Code: Select all function updateRecords($id,$name,$age){
$query = mysql_query("UPDATE data SET name= '$name', age= '$age' WHERE id = '$id'");

[code]....

View 4 Replies

ActionScript 2.0 :: Flash Mysql Records Not Showing?

Feb 18, 2008

I am getting problem in flash,php,mysql integration .The php page is fetching the data from database .But when i include this php page into flash document ,the data are not showing.

This is the sites.as file.
function lv(l, n, t, e, f) {
if (l == undefined) {

[code]....

View 2 Replies

ActionScript 2.0 :: How To Format Records In Flash MX From MySQL

Feb 23, 2005

I have results from my mysql coming to flash mx and I am trying to format it in rows like:
VENUENAME ADDRESS PHONENUMBER
And I want about 10 records to show in flash at a time....

Here is the actionscript and the PHP code:
// Create another LoadVars instance to receive the server's reply
replyData = new LoadVars();
// Specify a function to call when this new instance receives the reply.
replyData.onLoad = handleReply;
// Submit the order data
[Code] .....

View 1 Replies

ActionScript 3.0 :: Loading Records Into DataGrid Gradually - Fade Out / In

Apr 7, 2009

I've been searching all over for an answer to this, but have not had much luck. I have an .xml file that loads its data into a DataGrid. However, I don't want all the data to load up at once. I would like it to load the first five records, and after x amount of seconds fade out and fade in with the next five records.

View 2 Replies

Professional :: Move An Image In A Layer In CS3 And It Records The Movement!

Mar 1, 2011

I make my fla file and then want to move an image on the stage slightly without recording the movement!

I have tried many ways and cannot - I even set up guides as I end up deleting layer and resetting.

View 6 Replies

Flex :: Area Rendered Bellow Records In A AdvancedDataGrid?

Feb 2, 2011

In the AdvancedDataGrid shown bellow I have one groupingField as one can see. I would like to have the ability to click in a record (let´s say the 26/01/2011 - Pag.) and right bellow it to have some action buttons.

How can I do it? Would it be by using a AdvancedDataGridRendererProvider? I´ve tried to do it but didn´t get the expected result.

View 1 Replies

Flex :: PHP Reset DataGrid Records From WebService Results

Aug 8, 2011

I'm using Flex 4.5 with PHP Zend webservice framework. Basically, I have 2 DataGrids that can drag and drop between each other. At the initializing of the component, I call a webservice to populate the top DataGrid. Then the user can drag rows to the bottom DataGrid that get processed and saved later on. My problem is that I want to have a reset button (or cancel button), that will take the user to a new component in the ViewStack, and if they return to the component with the DataGrids, the top DataGrid has the original records and the bottom DataGrid is empty.

I just can't figure out a good way to repopulate the top DataGrid. I can clear it, but it doesn't seem to refresh with the original data. I've tried unsuccessfully to call the webservice again and set the dataprovider to the new lastResult token. I've also tried unsuccessfully to copy the results of the initial webservice call to an ArrayCollection and simply set a Bindable variable to that ArrayCollection (or a backup of that ArrayCollection holding original records).

<?xml version="1.0" encoding="utf-8"?>
<s:NavigatorContent xmlns:fx="[URL]"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:valueObjects="valueObjects.*"
[Code] .....

View 1 Replies

Create Something Which Records Audio From User / Allows Them To Send It To Email

Oct 5, 2011

I know how to use AS3 to record sound from the user and enable them to save it to their computer. However, I would really like instead to allow them to either send it to an email address right after recording (without them having to save it to their computer first and find the file), OR to let them save it so that the site owner can access it (They would know that it was happening.).

View 1 Replies

As3 :: Xml : Send Mutiple Records To Dynamic Textboxs In Flash?

Mar 22, 2012

Im creating a scoreboard within flash, ive got mysql data converted to xml and grabbed into flash, im trying to output the data: user, score, time into dynamic textboxs but can only get one record.If there is a better way, such as creating the textfields on output could someone point me in the right direction!

function outputXML()
{
for (var i=0; i<xmldata.item.length(); i++)

[URL]

View 1 Replies

ActionScript 2.0 :: Format Records In Flash Mx Coming From Mysql

Feb 23, 2005

i have results from my mysql coming to flash mx and im trying to format it in rows like:[code]and i want about 10 records to show in flash at a time.[code]

View 1 Replies

ActionScript 2.0 :: Searchable XML - Displaying/returning Only 10 Records At A Time?

Dec 20, 2006

I completed a similar xml searchable database based on this tutorial: http:[url]....I have a rather large xml that when you do a search flash times out and the user gets a scrip error,What I want to know is how would you go about only displaying/returning only 10 records at a time?

Code:

//Arrays
String.prototype.contains = function(searchString){
return (this.toLowerCase().indexOf(searchString.toLowerCase()) != -1);[code].....

View 1 Replies

ActionScript 3.0 :: Reading Mssql Database Records Within Flash CS3

Feb 6, 2009

I've got records being populated into our database from paypal's Instant payment notification methods...great. now i turn to our flash cs3 app to populate a component datagrid with the stored database data and to my surprise I'm unable to identify any examples on how this might even be done.

How do you connect to an mssql database from within flash cs3 to retrieve data for displaying within a flash datagrid?

I can write a cfc from coldfusion to return a dataset, but overall i'm not sure if i 'have' to learn Flex, or AIR or what to get the records 'read'.

My ActionScript 3.0 bible is vague at best and resorts to php. (which i dont know)

View 6 Replies

Flex :: Result In An Array And Show 20 Records In The Grid At A Time?

Sep 27, 2010

I have datagrid. the source for this datagrid is a url that returns n number of rows in json format.

i want to save this result in an array and show 20 records in the grid at a time. and cycle to the next 20 records in a time interval.

View 2 Replies

Flex :: Oracle - Remoteobject Multiple Records In Database Of Same Info?

Feb 11, 2012

Case1: When a client makes a remoteObject request ie to save some Info... A call is made to Java SAVE_INFO method. If request failed ie came back to FaultHandler ( we save the info in an arrayCollection).Later we call SAVE_INFO again for each item in arrayCollection ie( if arrayCollection has 10 items.. We call 10 times the same method.. I know that's kind of stupid but we have no control over java to write a overloading method). Some times we see there are multiple records of same info in DB. I am not sure if this happens when looping over arraycollection and making calls or during normal one time call. We could not find a pattern to reproduce. Java LOG level is at Error level in production. can't set to INFO in production to monitor all calls. We dont know if this multiple times saved record is, the one in arrayCollection or normal one.

Flex3 RemoteObject --> WAS 6.1 , lCDS 3.0, Java1.5 --> Webservice -- > Java (hibernate) --> Oracle 10gCase2: When application is left open and user leaves for the day and submits info the following morning, we see duplicate records in DB of that info.(No arrayCollection here. Simple straight one call)Flex3 RemoteObject --> OC4J Blazeds Java1.5 (JDBC) --> Oracle 10g.Recently one of our Testers testing case 2 application found this pattern and I am starting to think that may be in the case 1 also.. users might be leaving for lunch/break and resubmitted the arrayCollection after coming back. During lunch java might have killed the sessions for the client and after resubmitting 10 at same time.

View 1 Replies

ActionScript 3.0 :: Option Menu Which Records Info And Submits To Mysql DB

Jul 14, 2010

looking to create an option menu (at least that is what it is called in HTML).[code]looking to do this in flash though with AS3, PHP and MySQL. The data can be stored in XML. please let me know if anyone has done something like this before, or if they know of a good tutorial which details how.

View 1 Replies

ActionScript 2.0 :: Finding A Node In XML File Via Node Attrib?

May 26, 2005

I thought this was going to be easy! I would like to search an XML file for a particular data set i.e. set of nodes depending on a passed variable. However, storing a subset of my XML file via Code:var gallery = this.firstChild; and then searching 'gallery' as you would an array-using a for()-doesn't work since this.firstChild isn't returning an array

Code:
<gallery>
<collection title="Christmas 2004">

[code].....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved