Loading/reading Binary Data
Hello all, I'm currently try to create a kind of GIS tool. My goal is to load data from a server and display a map to the end-user. As map data can be huge to send through "pure" XML, I have to send them in a binary format. Once received, I want to decode my binary data and then display my map. Unfortunately, as far as I am in my investigations, I do not find a solution to manage these binary data. Does someone can provide me some solutions or some path of investigation to reach my goal ?
In advance, many thanks,
Alf71.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 10-30-2006, 02:14 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Reading Binary Data
Hi all,
i'm trying to read a binary file containing a sequence of floats created in C.
Loading and reading the file works fine in php, but i can't get this to work
in actionscript:
Here's my approach:
Code:
in the constructor:
...
this.loader = new URLLoader();
this.loader.dataFormat = URLLoaderDataFormat.BINARY;
var bin = new URLRequest("http://path/to/some/binary/file");
this.loader.load(bin);
this.loader.addEventListener(Event.COMPLETE, completeHandler);
...
public function completeHandler() {
var data : ByteArray = loader.data;
while (data.bytesAvailable > 0 ) {
trace(data.readFloat);
}
}
However, the values i get are wrong. They are way too small compared
to the real ones. Around 1.9893951235729634e-38 as they should be
something like 0.234894.
Does anyone see something obvious i might be missing out ?
Thanks for your help.
-pulse00
Loading And Reading In Binary Files In Actionscrip 3.0
Anyone have sample code on loading and reading binary files ?
something like this:
bas = new ByteArrayInputStream( mapData );
DataInputStream is = new DataInputStream( bas );
int var1 = dis.readInt();
int var2 = dis.readInt();
int var3 = dis.readInt();
I'm trying to port Java code to Actionscript
Loading Binary Data From Jpeg... Possible?
Hello,
I'm using a Mysql database to store pictures in binary data, and I'm searching for a way to import this binary data directly form the database into flash and let flash reconstruct the jpeg.
Getting the data into Flash as a variable is not the problem, it's reconstructing the jpeg from the binary data.
Tx,
Ivan
Loading Binary Data From Jpeg... Possible?
Hello,
I'm using a Mysql database to store pictures in binary data, and I'm searching for a way to import this binary data directly form the database into flash and let flash reconstruct the jpeg.
Getting the data into Flash as a variable is not the problem, it's reconstructing the jpeg from the binary data.
Tx,
Ivan
Loading Binary Data From Jpeg... Possible?
Hello,
I'm using a Mysql database to store pictures in binary data, and I'm searching for a way to import this binary data directly form the database into flash and let flash reconstruct the jpeg.
Getting the data into Flash as a variable is not the problem, it's reconstructing the jpeg from the binary data.
Tx,
Ivan
Loading Binary Data Into Flash From An External File.
Does anyone know if it is possible to load binary data into flash from an external file, it has been sugested maybe using XML commands - like when you load a ROM into an emulator. It doesn't have to be whilst running though it could be when it is compiled however it would be nice to be parsed on the fly like a proper emulator!
Any help would be great so thanks in advance to anyone who helps.
Gary
Flash Reading Binary From A Database
i'm storing videos and images inside a blob in mysql and i need to have flash 8 read the files. right now i'm querying the database using php and then converting the php page to xml and then flash is parsing the xml. i need any feedback i can get. thanks in advance.
Locating Frames When Reading Swf File In Binary
Hello,
I'm trying to see if this is some how possible.
I'm trying to take a shockwave file (parent) where I have a start frame and and end frame - say start_frame = 2, end_frame = 8. I'm trying to make another shockwave file (child) w/ just these 6 frames and their content. I'm trying to do this by reading the binary data of the swf file using the PHP fread() function.
I know PHP has a whole slew of shockwave functions to create SWF files on the fly.
If I could isolate the specific frames from the binary read, I could rewrite the file w/ just those isolated frames.
Am I crazy?
Thanks,
Clem C
Locating Frames When Reading Swf File In Binary
Hello - it's me again w/ more crazy questions.
I'm trying to see if this is some how possible.
I'm trying to take a shockwave file (parent) where I have a start frame and and end frame - say start_frame = 2, end_frame = 8. I'm trying to make another shockwave file (child) w/ just these 6 frames and their content. I'm trying to do this by reading the binary data of the swf file using the PHP fread() function.
I know PHP has a whole slew of shockwave functions to create SWF files on the fly.
If I could isolate the specific frames from the binary read, I could rewrite the file w/ just those isolated frames.
Am I crazy?
Locating Frames When Reading Swf File In Binary
Hello,
I'm trying to see if this is some how possible.
I'm trying to take a shockwave file (parent) where I have a start frame and and end frame - say start_frame = 2, end_frame = 8. I'm trying to make another shockwave file (child) w/ just these 6 frames and their content. I'm trying to do this by reading the binary data of the swf file using the PHP fread() function.
I know PHP has a whole slew of shockwave functions to create SWF files on the fly.
If I could isolate the specific frames from the binary read, I could rewrite the file w/ just those isolated frames.
Am I crazy?
Thanks,
Clem C
Locating Frames When Reading Swf File In Binary
Hello,
I'm trying to see if this is some how possible.
I'm trying to take a shockwave file (parent) where I have a start frame and and end frame - say start_frame = 2, end_frame = 8. I'm trying to make another shockwave file (child) w/ just these 6 frames and their content. I'm trying to do this by reading the binary data of the swf file using the PHP fread() function.
I know PHP has a whole slew of shockwave functions to create SWF files on the fly.
If I could isolate the specific frames from the binary read, I could rewrite the file w/ just those isolated frames.
Am I crazy?
Thanks,
Clem C
Uploading Binary Data From As3
I was trying a few methods to uplaod binary data (jpeg) that I create in the action script (it's not a file on the system but self created by the action script)
I hold the data in a ByteArray object.
I see that I have two basic options to send the data:
1.
myRequest:URLRequest;
imageData:ByteArray;
myRequest.data = imageData;
navigateToURL(myRequest,"self");
2.
myRequest:URLRequest;
imageData:ByteArray;
myURLVariables:URLVariables;
defining the variables
myRequest.data = myURLVariables;
navigateToURL(myRequest,"self");
the problem:
if I choose the first method, I can only send one file, and from some reason I cann't get to it in ruby on rails (because it's a raw http post data and not multipart-form)
If I choose the second way I think the file is not being sent (it's also not multipart-form, but tries to be url-encoded) I try to examine the http request-response and it seems like the data is not proper in those requests.
If anyone can help me on how to manually set the needed properties of this data shipment so it would reach it's finaly destination I would really appreciate it.
TIA
Neer
neerfri@gmail.com
Binary Image Data To PHP - How?
hello,
I wrote an image editor for my cms and wanted to send the image respectively the through the BitmapData's getPixels()-method received ByteArray to a PHP-script that displays and finally saves the image. Obviously I didn't succeed.
How do I have to encode my binary data so that PHP is able to read it and how do I have to treat the bytes in PHP? I also tried encoding the image data with the corelib classes from http://actionscript3libraries.riaforge.org/ but it didn't work as well.
I'd be glad if somebody could help me.
Lukas
Hex/Binary Data Over Socket
I have a custom socket class designed to connect to a server and talk with it. At one point, the server uses hex data for speed, however Flash seems to not get ANY of this data. In fact, it doesn't get ANY of the data from that point to the next packet. Any ideas how to get that data?
Binary Data And Amfphp
Based on the last amfphp tutorial I've been trying this and it does not work.
I have this php file in the services dir which hace this function that I call throuh actionscript
Code:
function getData($image)
{
$data = mysql_query("Insert into table01 (image) values ('$image')");
if($data == null) {
return false;
}eles{
return true;
}
}
in the mysql database there is a longblob field image and in fd I wrote:
Code:
[Embed(source = 'mail[1].jpg')]
private var _img:Class;
private var img:Bitmap = new _img();
private var gw:NetConnection;
private var res:Responder;
private var TF:TextField = new TextField();
private var ba:ByteArray;
private var encoder:JPGEncoder;
private var bd:BitmapData;
public function Main():void {
TF.autoSize = TextFieldAutoSize.LEFT;
addChild(TF);
bd = new BitmapData(img.width, img.height);
bd.draw(img);
encoder = new JPGEncoder(90);
ba = encoder.encode(bd);
gw = new NetConnection();
gw.connect("http://localhost/amfphp/amfphp/gateway.php");
res = new Responder(onResult, onFault);
gw.call("Test.getData", res, ba.toString());// without toString() amfphp throws me an error that says
//"Object of class ByteArray could not be converted to string"
}
private function onResult(responds:Object):void {
TF.text = String(responds);
}
private function onFault(responds:Object):void {
for (var i:* in responds) {
TF.text = String(responds[i]);
}
}
The blob field in the database is filled with four or five chars but it is not an image.
I believe that the byteArray send to the php file is not the same as sent as amf doesn't serialize it appropriately.
Is there something I missed in the AS or PHP?
Laoding Binary Data From Jpeg... Possible?
Hello,
I'm using a Mysql database to store pictures in binary data, and I'm searching for a way to import this binary data directly form the database into flash and let flash reconstruct the jpeg.
Getting the data into Flash as a variable is not the problem, it's reconstructing the jpeg from the binary data.
Tx,
Ivan
Uploading Binary Data From Flash
We ran up against a problem that I was hoping someone could help with. I’ll try to spare whatever details are not needed.
Basically, I want to upload an image that has been loaded into Flash to a server. I can download from a server to the movie with a simple LoadMovie. However, sending it back has me perplexed.
I know about the FileReference class in Flash 8, but it seems to only work for uploading actual images on a user’s hard drive that they select.
Let’s assume that instead we have a JPEG in our movie and we want to send it back to the server for whatever reason. I’m aware that we can loop though each pixel and convert it to a string, and send that string. Unfortunately, that doesn’t work out for us in our unique situation. We really need a binary method of transmitting it.
Does anyone know if this is possible? If not in Flash 8, can it be done in Flash 9/Flex?
Any help would be greatly appreciated!
XML Combined With Binary Data, Solved =)
Just wanna share my experiences here, heh.
I've been working on a flash-app that writes binary files that another one reads. And I've been wanting to add xml-data to the binary file to easily be able to change a few basic things in the file.
And I thought it would be convenient if the xml and binarydata are part of the same file, instead of having an xml file that holds a url to the binary-file.
So I've been googling for a way of combining them. Found several articles describing just that.
http://www.stylusstudio.com/binary_xml.html
http://www.xml.com/pub/a/98/07/binary/binary.html
http://articles.techrepublic.com.com...1-1050529.html
http://www.perfectxml.com/articles/xml/binary.asp
They listed a few possibilities, but in the end they basically just gave 2 choices. Either store a url to the binary file in the xml, or encode the binary data to text with base64 or UUencode or such.
Encoding a lot of data is slow though, so why should i go that route and have the user wait longer for the app to load when i could just use 2 files...
But then i thought of another idea which I had not read about.
The idea is to have a binary file, which starts with the xml-data. And they are separated with some delimiter byte which is illegal in xml, i went with byte value 3.
In flash, i scan through the file from the start until i reach the delimiter byte, remembers the position of it, go back to position 0, readUTF to the delimiter byte, and make that string into an xml object.
Jump over the delimiter byte and then read the rest of the binary data like normal.
Got it all up and working.. I thought.
Until i changed the xml data using notepad, and then the swf couldn't read the file anymore.
Didn't understand why. Just opening it in notepad and saving it without changes would destroy it.
I inspected the file with a hex-editor and noticed notepad added a couple bytes at the beginning, and sadly it couldn't save all those illegal characters properly.
So my choices basically were to skip this whole thing, or use a hex-editor every time i want to change the xml-data and that doesn't sound very appealing.
Instead I tried a bunch of different text editors¬epads and stuff. Every time i saved, the file got ruined. I was just about to give up when I finally tried Notepad++, which successfully opens, edits, and saves the file without changing the binary data.
And Notepad++ is sweet. Has all kinds of stuff, and has programming language tools. Even for Actionscript!
Syntax Highlighting and Syntax Folding, Auto-completion , Brace and Indent guideline Highlighting(I wish flash had that!!!), Reindent code(Something I fancy, I dont dare using flash's autoformat cause it keeps breaking code) etc, dozens of plugins. Just a great text editor program.
Heh, you probably think I'm weird to put all that work into doing that. And I admit it would probably have been saner to just go with url-to-binary.
I just wont give up when there's something I'm trying to accomplish...
Upload Binary Data From Flash
We ran up against a problem that I was hoping someone could help with. I’ll try to spare whatever details are not needed.
Basically, I want to upload an image that has been loaded into Flash to a server. I can download from a server to the movie with a simple LoadMovie. However, sending it back has me perplexed.
I know about the FileReference class in Flash 8, but it seems to only work for uploading actual images on a user’s hard drive that they select.
Let’s assume that instead we have a JPEG in our movie and we want to send it back to the server for whatever reason. I’m aware that we can loop though each pixel and convert it to a string, and send that string. Unfortunately, that doesn’t work out for us in our unique situation. We really need a binary method of transmitting it.
Does anyone know if this is possible? If not in Flash 8, can it be done in Flash 9/Flex?
Any help would be greatly appreciated!
Convert A MC To Image Using Binary Data
How can I change this so it saves the image as binary data. This code works fine but when the image is created the file size is too big.PLEASE HELP!!
Code:
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
/**
* Little and simple print flash screen class
*/
class PrintScreen {
public var addListener:Function;
public var broadcastMessage:Function;
private var id:Number;
public var record:LoadVars;
function PrintScreen () {
AsBroadcaster.initialize (this);
}
public function print (mc:MovieClip, x:Number, y:Number, w:Number, h:Number) {
broadcastMessage ("onStart",mc);
if (x == undefined) {
x = 0;
}
if (y == undefined) {
y = 0;
}
if (w == undefined) {
w = mc._width;
}
if (h == undefined) {
h = mc._height;
}
var bmp:BitmapData = new BitmapData (w, h, false);
record = new LoadVars ();
record.width = w;
record.height = h;
record.cols = 0;
record.rows = 0;
var matrix = new Matrix ();
matrix.translate (-x,-y);
bmp.draw (mc,matrix,new ColorTransform (),1,new Rectangle (0, 0, w, h));
id = setInterval (copysource, 2, this, mc, bmp);
}
private function copysource (scope, movie, bit) {
var pixel:Number;
var str_pixel:String;
scope.record["px" + scope.record.rows] = new Array ();
for (var a = 0; a < bit.width; a++) {
pixel = bit.getPixels (a, scope.record.rows);
str_pixel = pixel.toString (16);
if (pixel == 0xFFFFFF) {
str_pixel = "";
}
// don't send blank pixel
scope.record["px" + scope.record.rows].push (str_pixel);
}
scope.broadcastMessage ("onProgress",movie,scope.record.rows,bit.height);// send back the progress status
scope.record.rows += 1;
if (scope.record.rows >= bit.height) {
clearInterval (scope.id);
scope.broadcastMessage ("onComplete",movie,scope.record);// completed!
bit.dispose ();
}
}
}
Upload Binary Data From Flash
We ran up against a problem that I was hoping someone could help with. I’ll try to spare whatever details are not needed.
Basically, I want to upload an image that has been loaded into Flash to a server. I can download from a server to the movie with a simple LoadMovie. However, sending it back has me perplexed.
I know about the FileReference class in Flash 8, but it seems to only work for uploading actual images on a user’s hard drive that they select.
Let’s assume that instead we have a JPEG in our movie and we want to send it back to the server for whatever reason. I’m aware that we can loop though each pixel and convert it to a string, and send that string. Unfortunately, that doesn’t work out for us in our unique situation. We really need a binary method of transmitting it.
Does anyone know if this is possible? If not in Flash 8, can it be done in Flash 9/Flex?
Any help would be greatly appreciated!
Uploading Binary Data With NO HEADERS
I am posting this here as well because some of it relates Flash 8 specifically (FileReference)...
I am trying to send binary data to a server side script which takes a variable called file, and saves it as a binary file.
so if I have a variable in my flash movie "myfile", with a value of "asdf", and I send that to the server, it will make a file on the file system called "myfile", and the contents of it will be asdf
Now, the trick is to send the script an image or video file. I have tried the following ways:
1) Using the FileReference class (Flash 8)
--- This works with php and move_uploaded_file.
--- This does NOT work the server side script mentioned above. It adds headers to the file. The same headers found here:
http://livedocs.adobe.com/flash/8/ma...=00002225.html
Namely:
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="Filedata"; filename="example.jpg"
Content-Type: application/octet-stream
... contents of example.jpg ...
--AaB03x--
PHP can handle this, the other script cannot. Unfortunately we are stuck with the other script. So I looked at different ways to send binary data to the server, without using FileReference.
2) Flex Builder 2.
Here we have some new classes. Such as URLRequest and URLLoader, where you can use URLLoaderDataFormat.BINARY. This transferred the file to the server using the script we are stuck with perfectly. No errors or problems.
Unfortunately they want a Flash Player 8 solution.
3) Some examples on the web where people have taken a BitmapData object in Flash 8 and programmatically convert a bitmap into an array of string data which represents pixel data, which is converted on the server to an image.
-- Is this method possible with LoadVars to send a binary stream of data to a script via POST, which will make it think it's the same as a file upload???
Well these are my three options
1) FileReference -- Flash 8 --> Is there a way to eliminate the headers its sending by default?
2) Flex Builder 2 - URLLoader class --> Any way to use this in Flash Player 8? (Doesn't seem possible)
3) Manually encode binary data into a variable and pass it through loadVars making the server think it's a file upload. Possible???
OR
4) Any other possibility I may have overlooked?
Thanks for any help,
-Carlos-
Uploading Binary Data With NO HEADERS
I am trying to send binary data to a server side script which takes a variable called file, and saves it as a binary file.
so if I have a variable in my flash movie "myfile", with a value of "asdf", and I send that to the server, it will make a file on the file system called "myfile", and the contents of it will be asdf
Now, the trick is to send the script an image or video file. I have tried the following ways:
1) Using the FileReference class (Flash 8)
--- This works with php and move_uploaded_file.
--- This does NOT work the server side script mentioned above. It adds headers to the file. The same headers found here:
http://livedocs.adobe.com/flash/8/ma...=00002225.html
Namely:
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="Filedata"; filename="example.jpg"
Content-Type: application/octet-stream
... contents of example.jpg ...
--AaB03x--
PHP can handle this, the other script cannot. Unfortunately we are stuck with the other script. So I looked at different ways to send binary data to the server, without using FileReference.
2) Flex Builder 2.
Here we have some new classes. Such as URLRequest and URLLoader, where you can use URLLoaderDataFormat.BINARY. This transferred the file to the server using the script we are stuck with perfectly. No errors or problems.
Unfortunately they want a Flash Player 8 solution.
3) Some examples on the web where people have taken a BitmapData object in Flash 8 and programmatically convert a bitmap into an array of string data which represents pixel data, which is converted on the server to an image.
-- Is this method possible with LoadVars to send a binary stream of data to a script via POST, which will make it think it's the same as a file upload???
Well these are my three options
1) FileReference -- Flash 8 --> Is there a way to eliminate the headers its sending by default?
2) Flex Builder 2 - URLLoader class --> Any way to use this in Flash Player 8? (Doesn't seem possible)
3) Manually encode binary data into a variable and pass it through loadVars making the server think it's a file upload. Possible???
OR
4) Any other possibility I may have overlooked?
Thanks for any help,
-Carlos-
Socket.readBytes() - Problem Getting All The Binary Data Sent
Hi,
I'm trying to receive data from a Socket() class with readBytes(). It works fine but sometimes not all data sent are received. So lets say my server sent 1500 bytes. 5 out of 6 times the value of connection.bytesAvailable is 1500 (like expected). Bute sometimes it is only 1300 and with the next call of the event handler 200 bytes (so it needs two cycles to fetch all data).
Is there any way to fetch aLL data in one cycle? I tried a while(connection.bytesAvailable > 0) {} but this wont work because of the wrong bytesAvailable value.
Here is my stripped down code of the ProgressEvent.SOCKET_DATA event handler:
ActionScript Code:
private function receiveDataCompleteHandler(event:Event):void {
byteArray = new ByteArray();
connection.readBytes(byteArray, 0, connection.bytesAvailable);
}
Thanks in advance!
Regards, Axeo
Is It Possible To Use Actionscript To Create Binary Data Objects?
I would like to write an Actionscript class which can convert arrays and other data objects to a serialized format for transmission across a socket connection. I realize this is pretty straightforward in XML but I was hoping for something less bloated and faster like AMF.
Is there any spec out there on how to serialize into AMF format? I've got the AMFPHP source code and have been reading it but that code is in PHP. Also, nearly all open source AMF efforts I have found appear to be reverse-engineering efforts rather than working from any sort of spec.
The bottom line I guess is how might I convert an array, for instance, into some kind of binary format?
Convert JPEG Image Into A Binary Data
Is it possible to convert an JPEG image to binary data. Because if this would be possible
then you can insert this data in a database.
Regards,
Micehal.
Load A Binary Data File In Flash MX 2004?
I've been animating in Flash for about 9 months and am now looking at a more serious programming project in Flash MX 2004.
My question is - is there a way to load a binary file of arbitrary content into Flash? I know Flash recognizes certain types of media files, but I just want to access a URL with a raw binary bytestream and interpret the data directly. I looked at the Item class but didn't see an obvious way to do this.
Am I trying to push Flash in a direction it's not meant to go?
Question About Generate Image Binary Data With Swf File
I want to generate image binary data with swf file.
For example, sprite1 which is Sprite's instance has lots of displaying
object child, we can use addChild(sprite1) to show them on the screen.
I want to generate image binary data from sprite1, the image looks
like the spirte1 displaying in the flash player on the screen. So I
can send the image binary data to server, and save it.
Can any one give me some suggestion, thanks a lot.
PNGEncode is not the way, because PNGEncode read the image information
with getPixel32 method of BitmapData class, but Sprite has no this
method. Please see the bleow code.
var ld:Loader = new Loader();
var url:String = "
Loading Jpegs In Flash From Mysql Binary Blob Field.
Greetings actionscripters,
I've been browsing through the threads and tutorials for a solution to this, found stuff, did help, but I'm still stucked.
As the title obviously state, I'm trying to load jpegs into movieclips from blob fields inside mysql database.
It's so easy with text... Why must it be so tough with darn jpegs.
In my .swf I have this tiny snippet in the first frame :
-----------------------------------
_root.myclip.loadMovie("view.php");
-----------------------------------
The view.php file looks like this :
<?
include 'connection.php';
$query = "SELECT id, type, content FROM pictures WHERE id = 2";
$result = @ mysql_query($query, $connection);
$data = @ mysql_fetch_array($result);
$image = $data["content"];
if (!empty($data["content"]))
{
//Begin writing headers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: image/jpeg");
print $image;
}
?>
Then nothing happens, the browser keeps loading ( or think it is loading ) the jpeg but it it never displayed in flash. I managed to load a jpeg from a flat file taken from the webserver, but that is not what I want to do, it must come from the binary blob field.
Theory 1 : Header problem...
Theory 2 : I should use LoadVars instead?
Any help is welcome!
Reading Data From From XML Or CSV
I want to make a flash application that displays the current temperature at a specific location. (For this Example: Melbourne, Australia)
I can get the information sent to my server (every hour) via two different methods... XML or CSV
The Data contained is: (XML)
Code:
<weatherlatest>
<location id="94868" name="Melbourne" date="20050629" time="0500Z">
<wind direction="270" speed="2" gust="-" />
<condition value="Foggy" />
<conditioncode value="209" />
<temperature c="13.7" f="56.7" />
<dewpoint value="8.0" />
<pressure current="1029.5" tendency="-2.3" />
<rain last10min="-" since9am="-" />
<humidity value="68" />
<cloud value="25" />
<visibility km="15" miles="9.3" />
<awsflag value="1" />
</location>
</weatherlatest>
(CSV)
Code:
ID,LOCATION,UTC_DATE,UTC_TIME,WIND_DIR,WIND_SPEED,WIND_GUST,WEATHER,TEMPERATURE,DEW_POINT,PRESSURE,TENDENCY,RAIN_10MIN,RAIN_9AM,HUMIDITY,CLOUD,VISIBILITY,AWS_FLAG
94868,"Melbourne",20050629,0500Z,270,2,"-","Foggy",13.7,8.0,1029.5,-2.3,"-","-",68,25,15000,1
Now what i want to do is display this information in my flash program.
What is the best way of doing this? and how should i do it?
Also, i have a icons to match the conditions (foggy, rain, sunny, etc...) would the best way to do this be using a single MC as a container, then just say something like:
if(weather == "foggy")
{
mcWeatherIcon.gotoAndStop(4) 'where 4 is a foggy icon
}
or is there a switch command like JavaScript that i could use???
Thanks in Advance
DKEEGH
Can Someone Help Me Regarding Reading Data?
I am using Flash CS3 Professional on Windows XP Pro SP2. I'm fine with either an AS2 or AS3 solution, and I appreciate you looking over this thread.
What I want to do is have a Coldfusion page output some data that is called by the Flash file. I can make the CF page and output the data fine, but how do I go about getting the Flash file to read that page and pull the data into it?
A sample of the data is:
1,'Title','Content','URL'|2,'Title','Content','URL'|1,'Title','Content','URL'
It's a | delimited list that create 3 lists, and then each list is iterated through to pull info. The first is a number which correlates internally about an icon to display, and then Title is text that's loaded into a textbox, and the Content is loaded into another textbox, then finally the URL is used if the user clicks on the flash file.
If I can figure out how to pull in the data, I think I can code the rest of it (where it loads it into the fields and rotates through the rest)
Reading Data From Excel
writing data into a .txt is very cumbersome, especially if we r talking 500 multiple choice questions, with 5 answers each. it wub be a blessing to have flash read datafrom an excel spreadsheet. the question is HOW??!!
simply put
loadVariablesNum(data.xls,0);
just doesnt work!!
any suggestions?
Reading XML Data Into Flash
I have FlashMX 2004 Professional and I was wondering if there was a way to load xml data into flash without using the "nextchild" or "nextsibling" commands. What I was wondering is, is there a way to just tell it to pull what's between say the "name" tag. For example:
<Person>
<Name>Jane Doe</Name>
<Job>Garbageman</Job>
</Person>
I was hoping there was a way to tell it to just grab what's between the <Name> tags. Right now I'm going through it with the nextchild/nextsibling/etc commands and then having to using string manipulation to remove the start and end tags cause it pulls those too. It just seems kinda weird to me, cause I'm not interested in pulling in the meta data, just the data.
Reading Data From Flash..
Hi,
I have this data in text.txt file.
&text=1
&text=3
&text=5
I found out that when I tried to access/read the data from flash, it will only read the last one: &text=5.. how to make it read the three data?
Reading Data From A Textfile
hi all,
i'm trying to read in some data from a text file to use in flash. the text file is in tab delimited format. anyone know if it's possible to read in this delimited type? i don't think it is unless i use the URL encoding character for a tab (%09) or some other special encoding character. I know you can use commas or pipes("|"), but was wondering if there's a way to encode the tab character.
also, i've read in simple text data before but in this case, i'm trying to read in the following data from the textfile. it's similar to a database table.
Code:
activeevent_namelinkstart_dayend_day
yesmyEventsomelink.htmmondaytuesday
yesyourEventlink2.htmwednesdaywednesday
nooldEventlink4.htmfridaysaturday
not sure how i would set up the text file (as far as any special characters go) so that i could read this into flash. if anyone can give me a head start on how to read it in (as far as the actionscript goes) that would be great.
i could do this with XML or via a database but in this case, i need to do it from a text file.
thanks in advance for anyone who can help with this.
Reading Image Data
I have a lot of photos cataloged using the standards: EXIF, IPTC, file and image data.
Right now each jpg for instance is loaded into a target_mc via a button that uses the MovieClipLoader class. I was wondering is there any way to directly read any of the above data that is stored in each jpg directly, on the Init portion of the loader is triggered? This would make things even easier, or else Im just stuck using XML, not that its hard - but its just one more thing to update.
Txt Field Reading Only First Data Of Xml
I need serious help on this.
I meet a strange problem by extracting xml datas to a dynamic txt field( name txtThumb) nested in a movie clip( name mcThumb).
I can extract particular datas from the xml:
initThumb.number=(xmlPhotos.firstChild.childNodes[i].childNodes[3].firstChild);// tracing is ok.( nodes are numbers bteew 1 to 78)
But text field only reads the first data of the list :
initThumb.onRelease = function() {
_root.mcScroller[thumbname].txtThumb.text = this.number;
}// target the text located in the mc but only the number 1 is read and repeats itself( tracing gives the same: 1 1 1 1 1 1 and not 1 2 3 4 5 etc..)
Here is the function that creates the mcThumb.
function makeAThumb(num) {
thumbname = "mcThumb"+num;
mcScroller.attachMovie("thumb", thumbname, num, initThumb);
mcScroller[thumbname].mcPhoto.loadMovie("images/tthumb/"+mcScroller[thumbname].photo+"");
}
NOTE : everything apart from that works great. All datas are loaded as for movie clips as for other dynamic text fields located on the main stage.
Somebody could help me, I really have no clue of what is happening,
Thank you.
Trouble Reading XML Data
My Flash file is able to read all the data in my xml file, which has four child nodes, and 3-4 children in each of those nodes. However, while it reads and stores the data for the first 2 nodes (<one> and <two>) it iterates over but does not store the data for the last 2 nodes (<three> and <four>). I've retyped the xml file from scratch to make sure there wasn't anything corrupt in it and that didn't solve the problem. It's reading the nodes for the children of <three> and <four>, but just isn't displaying their values for some reason. Any ideas why?
Reading Xml Data Into An Array
hi,
the code below should read the data from an xml file into an array then into a datagrid but its not working? i get the errors:
"TypeError: Error #1009: Cannot access a property or method of a null object reference.
at xmlreader_fla::MainTimeline/LoadXML()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader:nComplete()"
I'm not sure what any of theses errors really mean so i can't really debug the below code??
the function is called by
Code:
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
Could someone explain the errors to me?
Code:
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
trace(xmlData);
var nodes = xmlData.firstChild.childNodes;
for(var i:int =0;i<nodes.length;i++){
trace("New Data In Array"+i);
var xml_array:Array = new Array(nodes[i].firstChild.nodeValue);
}
for (var x:int = 0; x < xml_array.length; x++) {
var User_Login:String = xml_array[x];
dataGridMain.addItem({Username:User_Login});
}
dataGridMain.setStyle("fontFamily", "Verdana");
dataGridMain.setStyle("headerColor", "0xA6CBDD");
dataGridMain.setStyle("alternatingRowColors", ["0xF0F0F0", "0xFFFFFF"]);
dataGridMain.setStyle("rollOverColor", "0xDCEBF1");
dataGridMain.setStyle("selectionColor", "0xFFF97D");
dataGridMain.setStyle("selectionDuration", 300);
}
the xmlData variable holds data becuase it gets traced so i know the variable has values in it.
Thanks
Jon
Reading XML Data And Drawing....
I'm trying to generate a chart using XML data which gives flash output....
With fixed stage dimension I can do it....
But my Data can be dynamic too.... Means X,Y axis can be of any length...
In that case I was not able to resize the stage...
Is there any way to create .swf file runtime whose dimensions can be decided runtime???......
I thought of proportenate drawing.... but font sizes will become too small..... unless zoomed...
thanks...
johns221b
Reading SPECIFIC XML Data*
Trying to read in Specific XML Data into a Flash Dynamic TXT Box via ActionScript, See the following code:
I want to read in the 5th (Doorplan)
Code:
<VehicleData DataProvider="VDS" DateRequested="02 November 2005 14:17:42" VehicleFound="true">
<DATEOFTRANSACTION>2005/11/02 14:17:42</DATEOFTRANSACTION>
<VRM>X932YFS</VRM>
<VINCONFIRMATIONFLAG>1</VINCONFIRMATIONFLAG>
<ENGINECAPACITY>01588</ENGINECAPACITY>
<DOORPLAN>06</DOORPLAN>
<DATEFIRSTREGISTERED>20001130</DATEFIRSTREGISTERED>
<YEAROFMANUFACTURE>2000</YEAROFMANUFACTURE>
<SCRAPPED>0</SCRAPPED>
</VehicleData>
there is more thats just an example.
Reading Data From Mysql, Please Help
I have an online database application im building, but thats put me in front of some unsolvable by my levels problem. I want to load images and text externally from a tabe in mysql, and have each record printed in a seperate "window" within a "window".. if you see my attached picture, you'll understand.
If you by any means have any idea on how to go about thsi in the most effecient manner, please do help.
thanx.
Txt Field Reading Only First Data Of Xml
I meet a strange problem by extracting xml datas to a dynamic txt field( name txtThumb) nested in a movie clip( name mcThumb).
I can extract particular datas from the xml:
initThumb.number=(xmlPhotos.firstChild.childNodes[i].childNodes[3].firstChild);// tracing is ok.( nodes are numbers bteew 1 to 78)
But text field only reads the first data of the list :
initThumb.onRelease = function() {
_root.mcScroller[thumbname].txtThumb.text = this.number;
}// target the text located in the mc but only the number 1 is read and repeats itself( tracing gives the same: 1 1 1 1 1 1 and not 1 2 3 4 5 etc..)
Here is the function that creates the mcThumb.
function makeAThumb(num) {
thumbname = "mcThumb"+num;
mcScroller.attachMovie("thumb", thumbname, num, initThumb);
mcScroller[thumbname].mcPhoto.loadMovie("images/tthumb/"+mcScroller[thumbname].photo+"");
}
NOTE : everything apart from that works great. All datas are loaded as for movie clips as for other dynamic text fields located on the main stage.
Somebody could help me, I really have no clue of what is happening,
Thank you.
....
....
...
Reading Menu Data From XML
Do you know what's the problem with my function that I'm not able to print the fetched Xml value outside of the function? See the Trace commands with the comments.
Thank you.
Code:
function fetchMainMenuData() {
var my_xml:XML = new XML();
my_xml.ignoreWhite = true;
my_xml.load("mainMenu.xml");
my_xml.onLoad = function(success:Boolean) {
if (success)
{
if (!root) { var root:XMLNode = my_xml.firstChild; }
if (!lines) { var lines:Array = root.childNodes; }
for (i=0; i<lines.length; i++)
{
if (!itemNameEn) { var itemNameEn:Array = new Array(); }
itemNameEn[i] = my_xml.firstChild.childNodes[i].childNodes[0].childNodes[0].nodeValue;
trace (itemNameEn); // THIS LINE PRODUCES CORRECT OUTPUT.
}
}
else trace ("Error");
}
}
fetchMainMenuData();
trace (itemNameEn[1]); // THIS LINE DOES NOT PRODUCE WISHED OUTPUT.
AS2
Reading XML Data And Drawing....
I'm trying to generate a chart using XML data which gives flash output....
With fixed stage dimension I can do it....
But my Data can be dynamic too.... Means X,Y axis can be of any length...
In that case I was not able to resize the stage...
Is there any way to create .swf file runtime whose dimensions can be decided runtime???......
I thought of proportenate drawing.... but font sizes will become too small..... unless zoomed...
thanks...
johns221b
Reading External Data
If a SWF was placed in a PHP file, does it have the ability to read any of the PHP file's variables? I would like to re-use a SWF on multiple PHP pages and have it behave differently based on certain conditions.
An example is a a PHP URL like showAnimation.php?picURL=http://www.site.com/image.jpg and the embedded SWF would do some crazy animation with the picture. How would the SWF be able to read $_GET['picURL'] ?
If this is not possible, what other languages could Flash coordinate with? All I need is for Flash to read data from the page it's embedded in.
Reading Sound Data?
OK, i'm sorry if this has been asked before, but i've never posted in this forum before so forgive me please ><
OK, anyway, i've seen sound visualisers on many many many websites. I was wondering if there was an actionscript command that reads data off sound being played in Flash and can then print that data in a form that can be used for visualisation? If there is can someone please explain to me how to use it? Thanks beforehand.
Oh, and i've already looked at Flash MX 2k4's listed actionscript commands for sound, and i havent seen anything that might help.
Reading Data(.dat) Files In FLASH MX
Hi All,
THE EXPERTS PLEASE HELP !!!
1> How can FLASH MX read an data file(.dat) ?
2> If flash can read, how can i search for particular line based on
user input, the structure of data file is something like this:
Column1 | Column2 | ................ | Column(n)
Value1 | Value2 | ................ | Value3
.
.
.
.
3> If this is not possible, then, how can i make flash pass
parameters to any vb/vc.exe, which read specified data and
then send data back to flash for display
Any advice/guidence/help is highly appreciable
Thanks & Regards
:
[F8] Writing And Reading Data Between Flash And PHP
I'm making a game and the game tracks scores. At the end of the game I'd like to be able to record high scores to a mySQL db and then display the Top 10. Is that only possible with flash communication server? I know you can post data to php but from what I understand that requires a submit action that will refresh the whole page, which obviously isn't what I want.
Any ideas?
|