ActionScript 3.0 :: Send A Bytearray Object To A Javascript Function?
Aug 11, 2009
I need to be able to send a bytearray object to a javascript function or a java method, but I was wondering if I could do it using XMLHTTPRequest.
import asfiles.encoding.JPEGEncoder;import flash.display.Bitmap;import flash.display.BitmapData;import flash.external.[code]...
So I have a video that plays stream from a webcam,I will click a button and take a picture. I encode that picture using JPEGEncoder then I store it in a ByteArray.How do I send that data over to either a javascript function or a java class?I don't want to use the navigateToURL (URLRequest) method because that will redirect my page.Is there a way to send the data to a function while still staying on the same page?For example, make a asynchronous call to a javascript function or java method?
View 1 Replies
Similar Posts:
Jan 10, 2010
How to send a jpg image as ByteArray from as3 to javescript? And how to convert ByteArray to image in javascript?
View 3 Replies
Jan 1, 2011
I have byte array, and I want to write into it a Function object, like the following:
var func:Function = function f(event:Event):void
{
trace('hello');
}
[Code]....
View 1 Replies
May 20, 2011
Here's the challenge: I have a Flash movie which will be embedded in a page using an unknown DOM ID that I want to be able to identify/store for callback in a JS function. My ideal user flow would be: User clicks button in Flash. Flash pauses any animations / video / sounds / etc. Flash calls an injected JS function to display a page-covering overlay experience. When user closes overlay experience, a callback method on the Flash object is called. Flash resumes playback.
The problem is, when AS3 uses the ExternalInterface.call("functionName", args...) method, there doesn't seem to be a DOM event triggered, and thus it is impossible to tell which object called a JS function, so having a "registerMe()" function doesn't seem to work. Basically, the injected JS function has no way to determine which DOM object to call, because the ID of the Flash object is unknown.
[Code]...
View 3 Replies
Nov 3, 2011
I am trying to send some information to a javascript function on the same html page as the swf file is in. I used the tutorial here on Kirupa but for same way it doesnt work.
ExternalInterface.call("fillForm('"+ l.x, l.y +"')");
ExternalInterface.call("fillForm", l.x, l.y);
These are the variations I tried.
View 1 Replies
Sep 23, 2011
Who knows how to send a ByteArray to FMS?
View 1 Replies
Mar 16, 2010
is it possible to send a string to a function and return a object??? here is the code, but it doesn't work
[Code]....
View 2 Replies
Sep 29, 2011
Say I have an object call "Mother". Inside this Mother object is a function called "Come back all my children" And all my Child Objects extends Mother.
Is there a way one of the Child could call the function "Come back all my children" and this function will be evoked in ALL Child objects ?
I tried creating a "Come back all my children" function as static in the Mother object but I am unable to use the "this" keyword for this.
View 4 Replies
May 11, 2010
I'm currently working on a small project. The user is supposed to draw/do a puzzle within flash, and also fill out a form with his details and comments.
When clicking the send-button, the image should be sent along with the form as an email.
I already know how to send the image as an email via php, and I know how to send a form as an email via php, BUT - I can't seem to do it together.
I've googled a bit and I found out that I cannot pass both the bytearray (from the image) and the form-data as URLVariables at the same time.
One way I got it to work is by passing the values from the form-data as a part of the URLRequest (and then use $_GET in the .php-file), but this has limitations as it can only pass 100 characters. As the user should be able to comment on his work, using GET with its limitations isn't an option.
View 2 Replies
Dec 18, 2010
I would like to use Flash to send a ByteArray (of a PNG image) to a php file, in a facebook application. Is there a way to do this by sending the ByteArray as just one POST variable instead of as the entirety of the POST data?
There was a nearly identical question here: How can I send a ByteArray (from Flash) and some form data to php? but the problem is different; instead of smuggling other variables in other parts of the request, the image itself has to be sent as just a variable because Facebook commandeers the post data and puts in its own junk.
If not, can I send the image in some form other than a byteArray?
View 2 Replies
Oct 3, 2010
I'm working on a Flash tool that needs to send some data in the form of a flash.utils.ByteArray instance to PHP (amfphp service class) and get that data back from the amfphp service as flash.utils.ByteArray instance. Now I can do all of these with the php_amf extension enabled on the local WAMP server. And the tool works fine. But how can I achieve this without the php_amf extension? I'm deploying on a shared hosting server and I don't have access to the php.ini and also the dl() function of PHP is disabled for security reason. With the extension disabled, I can send the ByteArray instance to PHP and save the data to DB. But the problem arises when I try to retrieve the data from DB, create a ByteArray instance (amfphp helper class) with the data and send back to Flash. I'm guessing here that proper AMF message is not being constructed because of the absence of the php_amf extension.
View 1 Replies
Apr 14, 2010
i use Adobe flash player in my site, and now i need to increment some filed in database, when user click on player.here is the script
<div id="conteiner" style="text-align: center;" ></div>
<script type="text/javascript">
var s1 = new SWFObject("player.swf","ply","420","380","9","#FFFFFF");[code]...
i deside to use ajax for it, but how can i write a function in the flash object?
UPDATE: i only have the swfobject.js file, which contains such data
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new [code]....
and the player.swf, and the html, i've shown allready. i don't now is this flash player or no, and what can i do?
View 1 Replies
Oct 17, 2011
I'm building an AIR desktop application. At one point the application loads a popup window (an MXML component based on s:Window), which contains an mx:HTML component which loads a local (in the application directory) html file, blank.html. The relevant elements in blank.html are:
<script src="jw/jwplayer.js"/> <!--JW Player's JS-based Embedder-->
<div id="jwtarget" /> <!-- the target that the embedder will use -->
Since the parameters I want to use are determined at runtime, I use the domWindow property to invoke the method which loads the player. Here's an example that works:
[Code]...
View 2 Replies
Dec 15, 2010
Im creating flash game that have the functionality to capture/record its gameplay that can be viewed later by the user, like a replay.
As for now Im already able to record the game and write it into a flv format in a ByteArray variable.
What Im working right now is how to send that ByteArray(the video file) to a php script and save it to a web server.
I've run into the URLLoader in flash where it can send the data and php will receive it thru the POST method. Unfortunately, the ByteArray containing the flv data must be first correclty encoded for php to read it. I figured this out from the example in the net where it does the same thing only that it is only sending a JPEG ByteArray instead of a FLV format using the JPEGENCODER.
Is there any existing class like the JpegEncoder for FLV format or any Video formats? Or any work around like creating the encoder my self?
here is my current code to send the ByteArray
//send byteArray to a php script
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;
[Code]....
View 1 Replies
Mar 8, 2010
I was recently searching for a way to call the print function on a PDF I was displaying in adobe air. I solved this problem with a little help from this fellow, and by calling postMessage on my PDF like so:
//this is the HTML I use to view my PDF
<object id="PDFObj" data="test.pdf" type="application/pdf"/>
//this actionscript lives in my air app
var pdfObj:Object = htmlLoader.window.document.getElementById("PDFObj");
pdfObj.postMessage([message]);
I've tried this in JavaScript as well, just to be sure it wasn't adobe sneaking in and helping me out..
[Code]...
View 1 Replies
Sep 4, 2010
I'm trying to have JavaScript call a function from my ActionScript.
ActionScript:
import flash.external.ExternalInterface;
ExternalInterface.addCallback( "playSong", playSong );
function playSong():void {
var _sound:Sound = new Sound();
var _request = new URLRequest("music.mp3");
_sound.load(_request);
_sound.play();
}
JavaScript:
swfobject.embedSWF('[URL]', 'musicplayercontrol1', '1', '1', '9', null, null, {
allowScriptAccess: 'always', wmode: 'transparent' }, { }, function( e ) {
document.getElementById('musicplayercontrol1').playSong();
});
I keep getting a function not defined from firebug. I tried having the song play as soon as the swf load, and that works for sure.
View 1 Replies
Feb 7, 2011
I am trying to call a Jscript function from a flash object. I want the function to be called when the animation ends.
Here is the embed code
<h1 align="center">
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="360" HEIGHT="250" id="Yourfilename" ALIGN="center">
[code].....
here is the action code I add to the last frame of the flash object
URLLoader("javascript:mainFunction();");
The object loads but the function is not called. I can call the function other ways such as using an "onclick = mainFunction()" event on a button for example.
View 1 Replies
Jul 11, 2011
My web application pass a javascript object to flex application using addCallback function.
when the flex application is in modal dialog in safari browser, the object in the flex application is null and when I open the flex application just in a new window, the object is passed correctly. But, I need the showmodaldialog to show the flex application.
The flex code:
ExternalInterface.addCallback( "handleEvent", handleEvent );
override public function handleEvent( event:Object ):Object {
Alert.show(String(event)); .....
View 1 Replies
Jul 21, 2011
I have a page with multiple flash objects which are written by a third party and thus can't be changed. They call a JS function but don't seem to pass any identifying parameters. Is there any way to determine inside the function which flash object called it?
View 2 Replies
Jul 8, 2010
I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that instead of storing the result in a variable $my_result I am echoing the result. Javascript function to call the PHP page and make the database query
[Code]....
View 2 Replies
Jan 25, 2011
I have an AS3 swf which users can upload jpg images to my EC2 instances which sit behind and Elastic Load Balancer. The jpg images are converted into bytearray data and sent using URLLoader.load(URLRequest)I make 2 calls when uploading, one to upload a large version, then another to upload a thumbnail version. A PHP script to which the bytearray data is uploaded converts this to a file using file_put_contents($destination,$GLOBALS["HTTP_RAW_POST_DATA"])Is it possible to combine these two requests into a single request which contains both the bytearray data for the large and thumbnail images and 'split' the HTTP_RAW_POST_DATA to create 2 files at the server. This would be better than uploading the bytearray for the large version then using something like ImageMagick to resize the resulting image into a thumbnail which I realise is another option.
View 1 Replies
Apr 14, 2012
I'm trying to upload a photo on Facebook using Javascript SDK. In particular I generate a base64 encoded bytearray from my Actionscript3 app, I pass it to Javascript file using ExternalInterface, and from that I decode the bytearray and I try to upload to FB. But it give me this error:
{"error":{"message":"(#324) Requires upload file","type":"OAuthException","code":324}}
I tried to upload an image simply from url, and in that way it goes well! This is my Javascript code:
upPhoto:function(photo) {
var img = F.decode_base64(photo);
FB.api('/me/photos', 'post', {
message:'test',
fileName:'test',
[Code] .....
View 1 Replies
Sep 7, 2011
I'm able to record sound with a Flash application embedded in my website, this audio is saved to a ByteArray, which I need to pass to Javascript in order to post to my server along with other required data.
I know I can use AS3 ExternalInterface class to communicate with Flash from Javascript, but what would be the appropriate format or variable type in javascript to hold the ByteArray, and how can I ensure that I won't lose much audio data when doing so?
View 1 Replies
Aug 24, 2010
how exactly you send an object using the "every" loop in as3?
var myFunction:Function = function(obj:Object):void {
obj.height=400*Math.random();
obj.width=400*Math.random();
}
[code]...
which is in the AS3docs but it doesn't work
View 1 Replies
Oct 14, 2010
I get Index out of bounds when trying to readObject on my Byte array into the XML object.
private var fr:FileReference;
private var data:ByteArray = new ByteArray();
[Bindable]
private var dataXML:XML = new XML();[code]....
The Byte array is created by loading a file using FileReference
View 2 Replies
Jan 9, 2010
I need a function to change an ByteArray to BitmapData in 1 function:
makeBitmapData(bytes:ByteArray):BitmapData
Is this possible? Cause all I can find about this is first put the bytes in a loader. add listener to the complete event and then call a function that make the bitmap/bitmapdata. can this also be done in 1 function?
View 5 Replies
Feb 10, 2010
I am trying to serialize & deserialize Vector. using ByteArray..[code]No matter what I do, I keep having this error: RangeError: Error #2006: The supplied index is out of bounds. at flash.utils::ByteArray/readObject()
View 3 Replies
Jun 25, 2010
The coding language is Java.I have a ByteArray embedded in ActionScriptObject.(Smartfox Server)I want to convert it into ByteArray.The idea is to save it as an image.This a sequel to the post --> Convert Byte Array from Action Script to Image in Java and save it
View 2 Replies
Oct 28, 2009
I am using Flex's Alchemy library to generate SWC's out of C files. I have a byte array (unsigned char buffer[size]) in the c-layer that I'd like to return to the ActionScript layer as a ByteArray. Do I have to iterate through the array and explicitly call AS3_Set on each element or is there a way to just return the entire C array at once?
View 2 Replies
May 14, 2009
I wrote an application that loads a FLV into a ByteArray object at runtime. Now I want to play this FLV into a Video object. The problem I have is that the Video object won't accept anything else than a NetStream (or a Camera) as its source, and I can't find a way to set an in-memory FLV as a NetStream's source for playing.
View 2 Replies